[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:
Mikhail Pozdnyakov
2018-11-28 16:03:09 +02:00
parent a0b8f01c1b
commit ad03e42b28
9 changed files with 93 additions and 18 deletions

View File

@@ -85,8 +85,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
assert(BackendScope::exists());
updateParameters.annotationManager.updateData();
if (LayerManager::annotationsEnabled) {
updateParameters.annotationManager.updateData();
}
const bool zoomChanged = zoomHistory.update(updateParameters.transformState.getZoom(), updateParameters.timePoint);
@@ -698,6 +699,7 @@ std::vector<Feature> Renderer::Impl::queryRenderedFeatures(const ScreenLineStrin
}
std::vector<Feature> Renderer::Impl::queryShapeAnnotations(const ScreenLineString& geometry) const {
assert(LayerManager::annotationsEnabled);
std::vector<const RenderLayer*> shapeAnnotationLayers;
RenderedQueryOptions options;
for (const auto& layerImpl : *layerImpls) {