summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/annotation/annotation_manager.cpp11
-rw-r--r--src/mbgl/annotation/annotation_manager.hpp2
-rw-r--r--src/mbgl/annotation/annotation_tile.cpp8
-rw-r--r--src/mbgl/annotation/annotation_tile.hpp5
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp2
-rw-r--r--src/mbgl/annotation/symbol_annotation_impl.cpp3
-rw-r--r--src/mbgl/map/map.cpp16
7 files changed, 24 insertions, 23 deletions
diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp
index 0cd6bdf231..4e837d370d 100644
--- a/src/mbgl/annotation/annotation_manager.cpp
+++ b/src/mbgl/annotation/annotation_manager.cpp
@@ -115,17 +115,6 @@ void AnnotationManager::removeAndAdd(const AnnotationID& id, const Annotation& a
});
}
-AnnotationIDs AnnotationManager::getPointAnnotationsInBounds(const LatLngBounds& bounds) const {
- AnnotationIDs result;
-
- symbolTree.query(boost::geometry::index::intersects(bounds),
- boost::make_function_output_iterator([&](const auto& val){
- result.push_back(val->id);
- }));
-
- return result;
-}
-
std::unique_ptr<AnnotationTileData> AnnotationManager::getTileData(const CanonicalTileID& tileID) {
if (symbolAnnotations.empty() && shapeAnnotations.empty())
return nullptr;
diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp
index ffe6cd163a..a0f25fdf57 100644
--- a/src/mbgl/annotation/annotation_manager.hpp
+++ b/src/mbgl/annotation/annotation_manager.hpp
@@ -33,8 +33,6 @@ public:
Update updateAnnotation(const AnnotationID&, const Annotation&, const uint8_t maxZoom);
void removeAnnotation(const AnnotationID&);
- AnnotationIDs getPointAnnotationsInBounds(const LatLngBounds&) const;
-
void addIcon(const std::string& name, std::shared_ptr<const SpriteImage>);
void removeIcon(const std::string& name);
double getTopOffsetPixelsForIcon(const std::string& name);
diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp
index 91b7f7ddc1..06ae82adb3 100644
--- a/src/mbgl/annotation/annotation_tile.cpp
+++ b/src/mbgl/annotation/annotation_tile.cpp
@@ -21,9 +21,11 @@ AnnotationTile::~AnnotationTile() {
void AnnotationTile::setNecessity(Necessity) {}
-AnnotationTileFeature::AnnotationTileFeature(FeatureType type_, GeometryCollection geometries_,
- std::unordered_map<std::string, std::string> properties_)
- : type(type_),
+AnnotationTileFeature::AnnotationTileFeature(const AnnotationID id_,
+ FeatureType type_, GeometryCollection geometries_,
+ std::unordered_map<std::string, std::string> properties_)
+ : id(id_),
+ type(type_),
properties(std::move(properties_)),
geometries(std::move(geometries_)) {}
diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp
index 3e7c2c447f..4e0b1551d7 100644
--- a/src/mbgl/annotation/annotation_tile.hpp
+++ b/src/mbgl/annotation/annotation_tile.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <mbgl/annotation/annotation.hpp>
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
@@ -25,13 +26,15 @@ private:
class AnnotationTileFeature : public GeometryTileFeature {
public:
- AnnotationTileFeature(FeatureType, GeometryCollection,
+ AnnotationTileFeature(AnnotationID, FeatureType, GeometryCollection,
std::unordered_map<std::string, std::string> properties = {{}});
FeatureType getType() const override { return type; }
optional<Value> getValue(const std::string&) const override;
+ optional<FeatureIdentifier> getID() const override { return { id }; }
GeometryCollection getGeometries() const override { return geometries; }
+ const AnnotationID id;
const FeatureType type;
const std::unordered_map<std::string, std::string> properties;
const GeometryCollection geometries;
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index 445ee76511..345fe3acda 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -55,7 +55,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati
}
layer.features.emplace_back(
- std::make_shared<AnnotationTileFeature>(featureType, renderGeometry));
+ std::make_shared<AnnotationTileFeature>(id, featureType, renderGeometry));
}
}
diff --git a/src/mbgl/annotation/symbol_annotation_impl.cpp b/src/mbgl/annotation/symbol_annotation_impl.cpp
index 5ac2581949..20454e05c1 100644
--- a/src/mbgl/annotation/symbol_annotation_impl.cpp
+++ b/src/mbgl/annotation/symbol_annotation_impl.cpp
@@ -31,7 +31,8 @@ void SymbolAnnotationImpl::updateLayer(const CanonicalTileID& tileID, Annotation
projected *= double(util::EXTENT);
layer.features.emplace_back(
- std::make_shared<const AnnotationTileFeature>(FeatureType::Point,
+ std::make_shared<const AnnotationTileFeature>(id,
+ FeatureType::Point,
GeometryCollection {{ {{ convertPoint<int16_t>(projected) }} }},
featureProperties));
}
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 659832dc77..7570a8d303 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -703,10 +703,6 @@ void Map::removeAnnotation(AnnotationID annotation) {
update(Update::AnnotationStyle | Update::AnnotationData);
}
-AnnotationIDs Map::getPointAnnotationsInBounds(const LatLngBounds& bounds) {
- return impl->annotationManager->getPointAnnotationsInBounds(bounds);
-}
-
#pragma mark - Feature query api
std::vector<Feature> Map::queryRenderedFeatures(const ScreenCoordinate& point, const optional<std::vector<std::string>>& layerIDs) {
@@ -735,6 +731,18 @@ std::vector<Feature> Map::queryRenderedFeatures(const ScreenBox& box, const opti
});
}
+AnnotationIDs Map::queryPointAnnotations(const ScreenBox& box) {
+ auto features = queryRenderedFeatures(box, {{ AnnotationManager::PointLayerID }});
+ AnnotationIDs ids;
+ ids.reserve(features.size());
+ for (auto &feature : features) {
+ assert(feature.id);
+ assert(*feature.id <= std::numeric_limits<AnnotationID>::max());
+ ids.push_back(static_cast<AnnotationID>(feature.id->get<uint64_t>()));
+ }
+ return ids;
+}
+
#pragma mark - Style API
style::Source* Map::getSource(const std::string& sourceID) {