diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-28 16:03:09 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-28 17:18:38 +0200 |
commit | ad03e42b2890fd430e99e543a40be42f09f47fba (patch) | |
tree | 0644ddaab4f30ac1dc2c59507125cad832b366b2 /src/mbgl/renderer/renderer.cpp | |
parent | a0b8f01c1baf640f34c0f46ba22efd399b7a0012 (diff) | |
download | qtlocation-mapboxgl-ad03e42b2890fd430e99e543a40be42f09f47fba.tar.gz |
[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.
Diffstat (limited to 'src/mbgl/renderer/renderer.cpp')
-rw-r--r-- | src/mbgl/renderer/renderer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index c7bd46106d..9976c1b6dc 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -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>()); |