summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-03-04 18:44:33 -0800
committerJesse Bounds <jesse@rebounds.net>2017-03-10 11:08:32 -0800
commit517659b1b44a4e31e1035d4da9c444380454ad58 (patch)
tree45777ce2cf3ca4cb4d22ab42c6a82c6b4118b530 /src/mbgl/style
parent4d325879b89323439e9c2955ba5271d03c910490 (diff)
downloadqtlocation-mapboxgl-517659b1b44a4e31e1035d4da9c444380454ad58.tar.gz
[core] query source features
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/source.cpp4
-rw-r--r--src/mbgl/style/source_impl.cpp18
-rw-r--r--src/mbgl/style/source_impl.hpp3
3 files changed, 25 insertions, 0 deletions
diff --git a/src/mbgl/style/source.cpp b/src/mbgl/style/source.cpp
index cfb268006b..25c06024d6 100644
--- a/src/mbgl/style/source.cpp
+++ b/src/mbgl/style/source.cpp
@@ -17,6 +17,10 @@ const std::string& Source::getID() const {
optional<std::string> Source::getAttribution() const {
return baseImpl->getAttribution();
}
+
+std::vector<Feature> Source::querySourceFeatures(const SourceQueryOptions& options) {
+ return baseImpl->querySourceFeatures(options);
+}
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/source_impl.cpp b/src/mbgl/style/source_impl.cpp
index f83579d0d0..1f8301629f 100644
--- a/src/mbgl/style/source_impl.cpp
+++ b/src/mbgl/style/source_impl.cpp
@@ -10,6 +10,7 @@
#include <mbgl/util/tile_cover.hpp>
#include <mbgl/util/enum.hpp>
#include <mbgl/map/query.hpp>
+#include <mbgl/style/query.hpp>
#include <mbgl/algorithm/update_renderables.hpp>
#include <mbgl/algorithm/generate_clip_ids.hpp>
@@ -258,6 +259,23 @@ std::unordered_map<std::string, std::vector<Feature>> Source::Impl::queryRendere
return result;
}
+std::vector<Feature> Source::Impl::querySourceFeatures(const SourceQueryOptions& options) {
+
+ // Only VectorSource and GeoJSON source supported
+ if (type != SourceType::GeoJSON && type != SourceType::Vector) {
+ Log::Warning(Event::General, "Source type not supported");
+ return {};
+ }
+
+ std::vector<Feature> result;
+
+ for (const auto& pair : tiles) {
+ pair.second->querySourceFeatures(result, options);
+ }
+
+ return result;
+}
+
void Source::Impl::setCacheSize(size_t size) {
cache.setSize(size);
}
diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp
index 6e16a31e5a..b9707edaa7 100644
--- a/src/mbgl/style/source_impl.hpp
+++ b/src/mbgl/style/source_impl.hpp
@@ -7,6 +7,7 @@
#include <mbgl/tile/tile.hpp>
#include <mbgl/tile/tile_cache.hpp>
#include <mbgl/style/types.hpp>
+#include <mbgl/style/query.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/mat4.hpp>
@@ -70,6 +71,8 @@ public:
const TransformState& transformState,
const RenderedQueryOptions& options) const;
+ std::vector<Feature> querySourceFeatures(const SourceQueryOptions&);
+
void setCacheSize(size_t);
void onLowMemory();