summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/geojson_tile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/tile/geojson_tile.cpp')
-rw-r--r--src/mbgl/tile/geojson_tile.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp
index 85d8b75619..5a2a72f50b 100644
--- a/src/mbgl/tile/geojson_tile.cpp
+++ b/src/mbgl/tile/geojson_tile.cpp
@@ -1,5 +1,6 @@
#include <mbgl/tile/geojson_tile.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
+#include <mbgl/style/query.hpp>
#include <mapbox/geojsonvt.hpp>
#include <supercluster.hpp>
@@ -90,5 +91,27 @@ void GeoJSONTile::updateData(const mapbox::geometry::feature_collection<int16_t>
}
void GeoJSONTile::setNecessity(Necessity) {}
+
+void GeoJSONTile::querySourceFeatures(
+ std::vector<Feature>& result,
+ const style::SourceQueryOptions& options) {
+
+ // Ignore the sourceLayer, there is only one
+ auto layer = getData()->getLayer({});
+
+ if (layer) {
+ auto featureCount = layer->featureCount();
+ for (std::size_t i = 0; i < featureCount; i++) {
+ auto feature = layer->getFeature(i);
+
+ // Apply filter, if any
+ if (options.filter && !(*options.filter)(*feature)) {
+ continue;
+ }
+
+ result.push_back(convertFeature(*feature, id.canonical));
+ }
+ }
+}
} // namespace mbgl