diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-05 19:49:40 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-07 16:34:20 +0200 |
commit | ffdeef3a26306e447f1cc52a8e14d42fb035611d (patch) | |
tree | 7e3217d761581161d39b2552072d1b3cef8df67a /src/mbgl/style/layers/background_layer.cpp | |
parent | f560b4f9efebb4d448181724304f63b683a26b67 (diff) | |
download | qtlocation-mapboxgl-ffdeef3a26306e447f1cc52a8e14d42fb035611d.tar.gz |
Refer corresponding LayerFactory instance from the Layer::Impl
Diffstat (limited to 'src/mbgl/style/layers/background_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/background_layer.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp index b2db8332bc..8b3ce5ff68 100644 --- a/src/mbgl/style/layers/background_layer.cpp +++ b/src/mbgl/style/layers/background_layer.cpp @@ -42,6 +42,10 @@ std::unique_ptr<Layer> BackgroundLayer::cloneRef(const std::string& id_) const { void BackgroundLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const { } +LayerFactory* BackgroundLayer::Impl::getLayerFactory() const { + return BackgroundLayerFactory::get(); +} + // Layout properties @@ -270,10 +274,23 @@ Mutable<Layer::Impl> BackgroundLayer::mutableBaseImpl() const { return staticMutableCast<Layer::Impl>(mutableImpl()); } +BackgroundLayerFactory* BackgroundLayerFactory::instance = nullptr; + +BackgroundLayerFactory::BackgroundLayerFactory() { + assert(!instance); + instance = this; +} + BackgroundLayerFactory::~BackgroundLayerFactory() = default; -const char* BackgroundLayerFactory::type() const { - return "background"; +// static +BackgroundLayerFactory* BackgroundLayerFactory::get() { + assert(instance); + return instance; +} + +bool BackgroundLayerFactory::supportsType(const std::string& type) const { + return type == "background"; } std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) { |