From ecac67da790d51068bc2bdf1fed0a68df1eecf69 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Thu, 10 Jan 2019 16:56:27 +0200 Subject: [android] Add layer_manager_initialize.cpp file The newly added `layer_manager_initialize.cpp` file encapsulates the parts of the layer manager implementation, responsible for enabling/disabling of the layer modules. The client code can provide its own `layer_manager_initialize.cpp` file in order to disable certain layer types. --- platform/android/core-files.json | 1 + .../android/src/style/layers/layer_manager.cpp | 25 +-------------- .../android/src/style/layers/layer_manager.hpp | 2 ++ .../src/style/layers/layer_manager_initialize.cpp | 36 ++++++++++++++++++++++ 4 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 platform/android/src/style/layers/layer_manager_initialize.cpp diff --git a/platform/android/core-files.json b/platform/android/core-files.json index 6e3efd019f..e5b470529c 100644 --- a/platform/android/core-files.json +++ b/platform/android/core-files.json @@ -64,6 +64,7 @@ "platform/android/src/style/layers/hillshade_layer.cpp", "platform/android/src/style/layers/layer.cpp", "platform/android/src/style/layers/layer_manager.cpp", + "platform/android/src/style/layers/layer_manager_initialize.cpp", "platform/android/src/style/layers/line_layer.cpp", "platform/android/src/style/layers/raster_layer.cpp", "platform/android/src/style/layers/symbol_layer.cpp", diff --git a/platform/android/src/style/layers/layer_manager.cpp b/platform/android/src/style/layers/layer_manager.cpp index 2f023bd3ae..283fb66b20 100644 --- a/platform/android/src/style/layers/layer_manager.cpp +++ b/platform/android/src/style/layers/layer_manager.cpp @@ -6,33 +6,12 @@ #include #include -#include "background_layer.hpp" -#include "circle_layer.hpp" -#include "custom_layer.hpp" -#include "fill_extrusion_layer.hpp" -#include "fill_layer.hpp" -#include "heatmap_layer.hpp" -#include "hillshade_layer.hpp" -#include "line_layer.hpp" -#include "raster_layer.hpp" -#include "symbol_layer.hpp" -#include "fill_extrusion_layer.hpp" - namespace mbgl { namespace android { LayerManagerAndroid::LayerManagerAndroid() { - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); - addLayerType(std::make_unique()); + initialize(); } LayerManagerAndroid::~LayerManagerAndroid() = default; @@ -123,6 +102,4 @@ LayerManager* LayerManager::get() noexcept { return android::LayerManagerAndroid::get(); } -const bool LayerManager::annotationsEnabled = true; - } // namespace mbgl diff --git a/platform/android/src/style/layers/layer_manager.hpp b/platform/android/src/style/layers/layer_manager.hpp index 807ded1737..1ad21d00be 100644 --- a/platform/android/src/style/layers/layer_manager.hpp +++ b/platform/android/src/style/layers/layer_manager.hpp @@ -29,6 +29,8 @@ public: private: LayerManagerAndroid(); + + void initialize(); /** * @brief Enables a layer type for both JSON style and runtime API. */ diff --git a/platform/android/src/style/layers/layer_manager_initialize.cpp b/platform/android/src/style/layers/layer_manager_initialize.cpp new file mode 100644 index 0000000000..5f1c6dd43f --- /dev/null +++ b/platform/android/src/style/layers/layer_manager_initialize.cpp @@ -0,0 +1,36 @@ +#include "layer_manager.hpp" + +#include "background_layer.hpp" +#include "circle_layer.hpp" +#include "custom_layer.hpp" +#include "fill_extrusion_layer.hpp" +#include "fill_layer.hpp" +#include "heatmap_layer.hpp" +#include "hillshade_layer.hpp" +#include "line_layer.hpp" +#include "raster_layer.hpp" +#include "symbol_layer.hpp" +#include "fill_extrusion_layer.hpp" + +namespace mbgl { + +namespace android { + +void LayerManagerAndroid::initialize() { + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); + addLayerType(std::make_unique()); +} + +} // namespace android + +const bool LayerManager::annotationsEnabled = true; + +} // namespace mbgl -- cgit v1.2.1