summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLStyleLayerManager.mm
diff options
context:
space:
mode:
authorMichael Muesch <muesch@fb.com>2019-01-10 15:25:19 -0500
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-17 18:56:58 +0200
commit24468956fc49ba1495e4dba7363a15b6f07f25e7 (patch)
tree7fe783926cc5c46e490727995c28b1ad5e64112c /platform/darwin/src/MGLStyleLayerManager.mm
parentdd3027c9b851e92b872caaccfaf3e4e602f14516 (diff)
downloadqtlocation-mapboxgl-24468956fc49ba1495e4dba7363a15b6f07f25e7.tar.gz
Ability to disable any layer using pre-processing flags.
Diffstat (limited to 'platform/darwin/src/MGLStyleLayerManager.mm')
-rw-r--r--platform/darwin/src/MGLStyleLayerManager.mm44
1 files changed, 44 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLStyleLayerManager.mm b/platform/darwin/src/MGLStyleLayerManager.mm
index a05e24bd9d..c0b72e4451 100644
--- a/platform/darwin/src/MGLStyleLayerManager.mm
+++ b/platform/darwin/src/MGLStyleLayerManager.mm
@@ -16,16 +16,56 @@
namespace mbgl {
LayerManagerDarwin::LayerManagerDarwin() {
+#if defined(MBGL_LAYER_FILL_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<FillStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_FILL_DISABLE_ALL)
addLayerType(std::make_unique<FillStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_LINE_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<LineStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_LINE_DISABLE_ALL)
addLayerType(std::make_unique<LineStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_CIRCLE_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<CircleStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_CIRCLE_DISABLE_ALL)
addLayerType(std::make_unique<CircleStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_SYMBOL_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<SymbolStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_SYMBOL_DISABLE_ALL)
addLayerType(std::make_unique<SymbolStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_RASTER_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<RasterStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_RASTER_DISABLE_ALL)
addLayerType(std::make_unique<RasterStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_BACKGROUND_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<BackgroundStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_BACKGROUND_DISABLE_ALL)
addLayerType(std::make_unique<BackgroundStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_HILLSHADE_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<HillshadeStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_HILLSHADE_DISABLE_ALL)
addLayerType(std::make_unique<HillshadeStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_FILL_EXTRUSION_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<FillExtrusionStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_FILL_EXTRUSION_DISABLE_ALL)
addLayerType(std::make_unique<FillExtrusionStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_HEATMAP_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<HeatmapStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_HEATMAP_DISABLE_ALL)
addLayerType(std::make_unique<HeatmapStyleLayerPeerFactory>());
+#endif
+#if defined(MBGL_LAYER_CUSTOM_DISABLE_RUNTIME)
+ addLayerTypeCoreOnly(std::make_unique<OpenGLStyleLayerPeerFactory>());
+#elif !defined(MBGL_LAYER_CUSTOM_DISABLE_ALL)
addLayerType(std::make_unique<OpenGLStyleLayerPeerFactory>());
+#endif
}
LayerManagerDarwin::~LayerManagerDarwin() = default;
@@ -98,6 +138,10 @@ LayerManager* LayerManager::get() noexcept {
return LayerManagerDarwin::get();
}
+#if defined(MBGL_LAYER_LINE_DISABLE_ALL) || defined(MBGL_LAYER_SYMBOL_DISABLE_ALL) || defined(MBGL_LAYER_FILL_DISABLE_ALL)
+const bool LayerManager::annotationsEnabled = false;
+#else
const bool LayerManager::annotationsEnabled = true;
+#endif
} // namespace mbgl