summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-26 17:47:24 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-06 12:52:13 -0700
commit0afd14ae29e03f2781981180ddc42208e3da67c0 (patch)
tree8e585306bab3a02e2941490e8380e563c1ecd53a /src/mbgl/annotation
parent1c51b43dafdcf74000290cbb09d7307253e683ab (diff)
downloadqtlocation-mapboxgl-0afd14ae29e03f2781981180ddc42208e3da67c0.tar.gz
[core] Eliminate use of util::ptr in GeometryTile* interfaces
Diffstat (limited to 'src/mbgl/annotation')
-rw-r--r--src/mbgl/annotation/annotation_manager.cpp4
-rw-r--r--src/mbgl/annotation/annotation_tile.cpp4
-rw-r--r--src/mbgl/annotation/annotation_tile.hpp8
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp6
-rw-r--r--src/mbgl/annotation/symbol_annotation_impl.cpp9
5 files changed, 13 insertions, 18 deletions
diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp
index f1ddf99602..fac494f223 100644
--- a/src/mbgl/annotation/annotation_manager.cpp
+++ b/src/mbgl/annotation/annotation_manager.cpp
@@ -124,9 +124,7 @@ std::unique_ptr<AnnotationTileData> AnnotationManager::getTileData(const Canonic
auto tileData = std::make_unique<AnnotationTileData>();
- AnnotationTileLayer& pointLayer = *tileData->layers.emplace(
- PointLayerID,
- std::make_unique<AnnotationTileLayer>(PointLayerID)).first->second;
+ AnnotationTileLayer& pointLayer = tileData->layers.emplace(PointLayerID, PointLayerID).first->second;
LatLngBounds tileBounds(tileID);
diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp
index 2c676420dd..6b225ce20b 100644
--- a/src/mbgl/annotation/annotation_tile.cpp
+++ b/src/mbgl/annotation/annotation_tile.cpp
@@ -40,10 +40,10 @@ optional<Value> AnnotationTileFeature::getValue(const std::string& key) const {
AnnotationTileLayer::AnnotationTileLayer(std::string name_)
: name(std::move(name_)) {}
-util::ptr<const GeometryTileLayer> AnnotationTileData::getLayer(const std::string& name) const {
+const GeometryTileLayer* AnnotationTileData::getLayer(const std::string& name) const {
auto it = layers.find(name);
if (it != layers.end()) {
- return it->second;
+ return &it->second;
}
return nullptr;
}
diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp
index 78ed9e4080..19a731ee7b 100644
--- a/src/mbgl/annotation/annotation_tile.hpp
+++ b/src/mbgl/annotation/annotation_tile.hpp
@@ -45,10 +45,10 @@ public:
AnnotationTileLayer(std::string);
std::size_t featureCount() const override { return features.size(); }
- util::ptr<const GeometryTileFeature> getFeature(std::size_t i) const override { return features[i]; }
+ std::unique_ptr<GeometryTileFeature> getFeature(std::size_t i) const override { return std::make_unique<AnnotationTileFeature>(features[i]); }
std::string getName() const override { return name; };
- std::vector<util::ptr<const AnnotationTileFeature>> features;
+ std::vector<AnnotationTileFeature> features;
private:
std::string name;
@@ -56,9 +56,9 @@ private:
class AnnotationTileData : public GeometryTileData {
public:
- util::ptr<const GeometryTileLayer> getLayer(const std::string&) const override;
+ const GeometryTileLayer* getLayer(const std::string&) const override;
- std::unordered_map<std::string, util::ptr<AnnotationTileLayer>> layers;
+ std::unordered_map<std::string, AnnotationTileLayer> layers;
};
} // namespace mbgl
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index 345fe3acda..d3ddf62b9e 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -38,8 +38,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati
if (shapeTile.features.empty())
return;
- AnnotationTileLayer& layer = *data.layers.emplace(layerID,
- std::make_unique<AnnotationTileLayer>(layerID)).first->second;
+ AnnotationTileLayer& layer = data.layers.emplace(layerID, layerID).first->second;
ToGeometryCollection toGeometryCollection;
ToFeatureType toFeatureType;
@@ -54,8 +53,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati
renderGeometry = fixupPolygons(renderGeometry);
}
- layer.features.emplace_back(
- std::make_shared<AnnotationTileFeature>(id, featureType, renderGeometry));
+ layer.features.emplace_back(id, featureType, renderGeometry);
}
}
diff --git a/src/mbgl/annotation/symbol_annotation_impl.cpp b/src/mbgl/annotation/symbol_annotation_impl.cpp
index 20454e05c1..040de21214 100644
--- a/src/mbgl/annotation/symbol_annotation_impl.cpp
+++ b/src/mbgl/annotation/symbol_annotation_impl.cpp
@@ -30,11 +30,10 @@ void SymbolAnnotationImpl::updateLayer(const CanonicalTileID& tileID, Annotation
projected.y = std::fmod(projected.y, 1);
projected *= double(util::EXTENT);
- layer.features.emplace_back(
- std::make_shared<const AnnotationTileFeature>(id,
- FeatureType::Point,
- GeometryCollection {{ {{ convertPoint<int16_t>(projected) }} }},
- featureProperties));
+ layer.features.emplace_back(id,
+ FeatureType::Point,
+ GeometryCollection {{ {{ convertPoint<int16_t>(projected) }} }},
+ featureProperties);
}
} // namespace mbgl