[core] Add support for queryRenderedFeatures filter
This commit is contained in:
committed by
Ivo van Dongen
parent
ac4e13416a
commit
60d10dd27d
@@ -12,7 +12,6 @@
|
||||
#include <mbgl/style/observer.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
#include <mbgl/style/update_parameters.hpp>
|
||||
#include <mbgl/style/query_parameters.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/storage/file_source.hpp>
|
||||
#include <mbgl/storage/resource.hpp>
|
||||
@@ -810,20 +809,20 @@ void Map::removeAnnotation(AnnotationID annotation) {
|
||||
|
||||
#pragma mark - Feature query api
|
||||
|
||||
std::vector<Feature> Map::queryRenderedFeatures(const ScreenCoordinate& point, const optional<std::vector<std::string>>& layerIDs) {
|
||||
std::vector<Feature> Map::queryRenderedFeatures(const ScreenCoordinate& point, const QueryOptions& options) {
|
||||
if (!impl->style) return {};
|
||||
|
||||
return impl->style->queryRenderedFeatures({
|
||||
return impl->style->queryRenderedFeatures(
|
||||
{ point },
|
||||
impl->transform.getState(),
|
||||
layerIDs
|
||||
});
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<Feature> Map::queryRenderedFeatures(const ScreenBox& box, const optional<std::vector<std::string>>& layerIDs) {
|
||||
std::vector<Feature> Map::queryRenderedFeatures(const ScreenBox& box, const QueryOptions& options) {
|
||||
if (!impl->style) return {};
|
||||
|
||||
return impl->style->queryRenderedFeatures({
|
||||
return impl->style->queryRenderedFeatures(
|
||||
{
|
||||
box.min,
|
||||
{ box.max.x, box.min.y },
|
||||
@@ -832,12 +831,14 @@ std::vector<Feature> Map::queryRenderedFeatures(const ScreenBox& box, const opti
|
||||
box.min
|
||||
},
|
||||
impl->transform.getState(),
|
||||
layerIDs
|
||||
});
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
AnnotationIDs Map::queryPointAnnotations(const ScreenBox& box) {
|
||||
auto features = queryRenderedFeatures(box, {{ AnnotationManager::PointLayerID }});
|
||||
QueryOptions options;
|
||||
options.layerIDs = {{ AnnotationManager::PointLayerID }};
|
||||
auto features = queryRenderedFeatures(box, options);
|
||||
std::set<AnnotationID> set;
|
||||
for (auto &feature : features) {
|
||||
assert(feature.id);
|
||||
|
||||
Reference in New Issue
Block a user