From 8ace0d37d10e8174268f259dec38cf88e2494ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 26 May 2016 13:12:23 -0700 Subject: [core] AnnotationTileLayer vends its own name (#5163) Fixes #5159. --- src/mbgl/annotation/annotation_manager.cpp | 2 +- src/mbgl/annotation/annotation_tile.cpp | 3 +++ src/mbgl/annotation/annotation_tile.hpp | 7 ++++++- src/mbgl/annotation/shape_annotation_impl.cpp | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index 1febc757a4..e5f43eb3b6 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -90,7 +90,7 @@ std::unique_ptr AnnotationManager::getTile(const CanonicalTileID AnnotationTileLayer& pointLayer = *tile->layers.emplace( PointLayerID, - std::make_unique()).first->second; + std::make_unique(PointLayerID)).first->second; LatLngBounds tileBounds(tileID); diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp index 8f754ed6da..ba4b69108c 100644 --- a/src/mbgl/annotation/annotation_tile.cpp +++ b/src/mbgl/annotation/annotation_tile.cpp @@ -21,6 +21,9 @@ optional AnnotationTileFeature::getValue(const std::string& key) const { return optional(); } +AnnotationTileLayer::AnnotationTileLayer(const std::string &name_) + : name(name_) {} + util::ptr AnnotationTile::getLayer(const std::string& name) const { auto it = layers.find(name); if (it != layers.end()) { diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp index 5943eb11c9..d607d563d4 100644 --- a/src/mbgl/annotation/annotation_tile.hpp +++ b/src/mbgl/annotation/annotation_tile.hpp @@ -24,11 +24,16 @@ public: class AnnotationTileLayer : public GeometryTileLayer { public: + AnnotationTileLayer(const std::string&); + std::size_t featureCount() const override { return features.size(); } util::ptr getFeature(std::size_t i) const override { return features[i]; } - std::string getName() const override { return ""; }; + std::string getName() const override { return name; }; std::vector> features; + +private: + std::string name; }; class AnnotationTile : public GeometryTile { diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 9b9ea3bf26..3afc6044d7 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -119,7 +119,7 @@ void ShapeAnnotationImpl::updateTile(const CanonicalTileID& tileID, AnnotationTi return; AnnotationTileLayer& layer = *tile.layers.emplace(layerID, - std::make_unique()).first->second; + std::make_unique(layerID)).first->second; for (auto& shapeFeature : shapeTile.features) { FeatureType featureType = FeatureType::Unknown; -- cgit v1.2.1