[core] query source features

This commit is contained in:
Ivo van Dongen
2017-03-04 18:44:33 -08:00
committed by Ivo van Dongen
parent 548675a196
commit 0d10d2df1c
15 changed files with 191 additions and 2 deletions

View File

@@ -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);
}