summaryrefslogtreecommitdiff
path: root/platform/default
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/default
parentdd3027c9b851e92b872caaccfaf3e4e602f14516 (diff)
downloadqtlocation-mapboxgl-24468956fc49ba1495e4dba7363a15b6f07f25e7.tar.gz
Ability to disable any layer using pre-processing flags.
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/src/mbgl/layermanager/layer_manager.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/platform/default/src/mbgl/layermanager/layer_manager.cpp b/platform/default/src/mbgl/layermanager/layer_manager.cpp
index 05d0f4d1ae..b8abf794fc 100644
--- a/platform/default/src/mbgl/layermanager/layer_manager.cpp
+++ b/platform/default/src/mbgl/layermanager/layer_manager.cpp
@@ -16,7 +16,7 @@
#include <vector>
namespace mbgl {
-
+
class LayerManagerDefault final : public LayerManager {
public:
LayerManagerDefault();
@@ -32,16 +32,36 @@ private:
};
LayerManagerDefault::LayerManagerDefault() {
+#if !defined(MBGL_LAYER_FILL_DISABLE_ALL)
addLayerType(std::make_unique<FillLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_LINE_DISABLE_ALL)
addLayerType(std::make_unique<LineLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_CIRCLE_DISABLE_ALL)
addLayerType(std::make_unique<CircleLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_SYMBOL_DISABLE_ALL)
addLayerType(std::make_unique<SymbolLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_RASTER_DISABLE_ALL)
addLayerType(std::make_unique<RasterLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_BACKGROUND_DISABLE_ALL)
addLayerType(std::make_unique<BackgroundLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_HILLSHADE_DISABLE_ALL)
addLayerType(std::make_unique<HillshadeLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_FILL_EXTRUSION_DISABLE_ALL)
addLayerType(std::make_unique<FillExtrusionLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_HEATMAP_DISABLE_ALL)
addLayerType(std::make_unique<HeatmapLayerFactory>());
+#endif
+#if !defined(MBGL_LAYER_CUSTOM_DISABLE_ALL)
addLayerType(std::make_unique<CustomLayerFactory>());
+#endif
}
void LayerManagerDefault::addLayerType(std::unique_ptr<LayerFactory> factory) {
@@ -68,12 +88,16 @@ LayerFactory* LayerManagerDefault::getFactory(const std::string& type) noexcept
return (search != typeToFactory.end()) ? search->second : nullptr;
}
-// static
+// static
LayerManager* LayerManager::get() noexcept {
static LayerManagerDefault instance;
return &instance;
}
+#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