diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-03-04 18:44:33 -0800 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-03-09 13:11:23 -0800 |
commit | 0d10d2df1c6d246004e7291511f3aab7a8781d59 (patch) | |
tree | 3667c583d44c5237380ad7b79498787caa24a322 /src/mbgl/style/source_impl.cpp | |
parent | 548675a196f9e55d87cf8fce837b6e60393cb1b9 (diff) | |
download | qtlocation-mapboxgl-0d10d2df1c6d246004e7291511f3aab7a8781d59.tar.gz |
[core] query source features
Diffstat (limited to 'src/mbgl/style/source_impl.cpp')
-rw-r--r-- | src/mbgl/style/source_impl.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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); } |