summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-11-28 16:03:09 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-11-28 17:18:38 +0200
commitad03e42b2890fd430e99e543a40be42f09f47fba (patch)
tree0644ddaab4f30ac1dc2c59507125cad832b366b2 /include
parenta0b8f01c1baf640f34c0f46ba22efd399b7a0012 (diff)
downloadqtlocation-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 'include')
-rw-r--r--include/mbgl/style/layer.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index 9e73e994e6..d85f459815 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -152,6 +152,12 @@ protected:
/**
* @brief A singleton class responsible for creating layer instances.
+ *
+ * The LayerManager has implementation per platform. The LayerManager implementation
+ * defines what layer types are available and it can also disable annotations.
+ *
+ * Linker excludes the unreachable code for the disabled annotations and layers
+ * from the binaries, significantly reducing their size.
*/
class LayerManager {
public:
@@ -168,6 +174,22 @@ public:
/// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise.
std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept;
+ /**
+ * @brief a build-time flag to enable/disable annotations in mapbox-gl-native core.
+ *
+ * At the moment, the annotations implementation in 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
+ * implementation).
+ *
+ * Note: in future, annotations implemantation will be moved from the core to platform
+ * SDK (see https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation)
+ * and this flag won't be needed any more.
+ */
+ static const bool annotationsEnabled;
+
protected:
virtual ~LayerManager() = default;
virtual LayerFactory* getFactory(const std::string& type) noexcept = 0;