[core] LayerManager can disable annotations
At the moment, the annotations implementation in the `mapbox-gl-native` core is creating concrete layer instances apart from `LayerManager/LayerFactory` code path. So, annotations must be disabled if the `LayerManager` implementation does not provide line, fill or symbol layers (those, used by the annotations). Note: in future, annotations implementation will be moved from the core to the platform SDK level(see https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation) and `LayerManager` won't need to disable it.
This commit is contained in:
@@ -55,6 +55,9 @@ std::vector<Feature> Renderer::queryRenderedFeatures(const ScreenBox& box, const
|
||||
}
|
||||
|
||||
AnnotationIDs Renderer::queryPointAnnotations(const ScreenBox& box) const {
|
||||
if (!LayerManager::annotationsEnabled) {
|
||||
return {};
|
||||
}
|
||||
RenderedQueryOptions options;
|
||||
options.layerIDs = {{ AnnotationManager::PointLayerID }};
|
||||
auto features = queryRenderedFeatures(box, options);
|
||||
@@ -62,6 +65,9 @@ AnnotationIDs Renderer::queryPointAnnotations(const ScreenBox& box) const {
|
||||
}
|
||||
|
||||
AnnotationIDs Renderer::queryShapeAnnotations(const ScreenBox& box) const {
|
||||
if (!LayerManager::annotationsEnabled) {
|
||||
return {};
|
||||
}
|
||||
auto features = impl->queryShapeAnnotations({
|
||||
box.min,
|
||||
{box.max.x, box.min.y},
|
||||
@@ -73,6 +79,9 @@ AnnotationIDs Renderer::queryShapeAnnotations(const ScreenBox& box) const {
|
||||
}
|
||||
|
||||
AnnotationIDs Renderer::getAnnotationIDs(const std::vector<Feature>& features) const {
|
||||
if (!LayerManager::annotationsEnabled) {
|
||||
return {};
|
||||
}
|
||||
std::set<AnnotationID> set;
|
||||
for (auto &feature : features) {
|
||||
assert(feature.id.is<uint64_t>());
|
||||
|
||||
Reference in New Issue
Block a user