[core] Source should receive a ref to MapData just once

This commit is contained in:
Bruno de Oliveira Abinader
2015-11-27 10:35:09 +02:00
parent 1f0820c8e8
commit d55aa7929c
9 changed files with 54 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/annotation/annotation_tile.hpp>
#include <mbgl/map/map_data.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/layer/symbol_layer.hpp>
@@ -10,7 +11,8 @@ namespace mbgl {
const std::string AnnotationManager::SourceID = "com.mapbox.annotations";
const std::string AnnotationManager::PointLayerID = "com.mapbox.annotations.points";
AnnotationManager::AnnotationManager() = default;
AnnotationManager::AnnotationManager(MapData& data_) : data(data_) {}
AnnotationManager::~AnnotationManager() = default;
AnnotationIDs
@@ -108,7 +110,7 @@ std::unique_ptr<AnnotationTile> AnnotationManager::getTile(const TileID& tileID)
void AnnotationManager::updateStyle(Style& style) {
// Create annotation source, point layer, and point bucket
if (!style.getSource(SourceID)) {
std::unique_ptr<Source> source = std::make_unique<Source>();
std::unique_ptr<Source> source = std::make_unique<Source>(data);
source->info.type = SourceType::Annotations;
source->info.source_id = SourceID;
source->enabled = true;