summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/src/style/layers/background_layer.hpp4
-rw-r--r--platform/android/src/style/layers/circle_layer.hpp4
-rw-r--r--platform/android/src/style/layers/custom_layer.hpp4
-rw-r--r--platform/android/src/style/layers/fill_extrusion_layer.hpp4
-rw-r--r--platform/android/src/style/layers/fill_layer.hpp4
-rw-r--r--platform/android/src/style/layers/heatmap_layer.hpp4
-rw-r--r--platform/android/src/style/layers/hillshade_layer.hpp4
-rw-r--r--platform/android/src/style/layers/layer.hpp2
-rw-r--r--platform/android/src/style/layers/layer.hpp.ejs4
-rw-r--r--platform/android/src/style/layers/layer_manager.cpp41
-rw-r--r--platform/android/src/style/layers/layer_manager.hpp19
-rw-r--r--platform/android/src/style/layers/line_layer.hpp4
-rw-r--r--platform/android/src/style/layers/raster_layer.hpp4
-rw-r--r--platform/android/src/style/layers/symbol_layer.hpp4
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLFillStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLHeatmapStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLHillshadeStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLLineStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer_Private.h4
-rw-r--r--platform/darwin/src/MGLStyleLayerManager.h12
-rw-r--r--platform/darwin/src/MGLStyleLayerManager.mm39
-rw-r--r--platform/darwin/src/MGLStyleLayer_Private.h2
-rw-r--r--platform/darwin/src/MGLStyleLayer_Private.h.ejs4
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer_Private.h4
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLHeatmapStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLHillshadeStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs2
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm2
-rw-r--r--platform/default/layer_manager.cpp62
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj8
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj8
41 files changed, 148 insertions, 153 deletions
diff --git a/platform/android/src/style/layers/background_layer.hpp b/platform/android/src/style/layers/background_layer.hpp
index efe882d531..c1b25b41bd 100644
--- a/platform/android/src/style/layers/background_layer.hpp
+++ b/platform/android/src/style/layers/background_layer.hpp
@@ -39,7 +39,7 @@ public:
}; // class BackgroundLayer
-class BackgroundJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::BackgroundLayerFactory {
+class BackgroundJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::BackgroundLayerFactory {
public:
~BackgroundJavaLayerPeerFactory() override;
@@ -49,7 +49,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class BackgroundJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/circle_layer.hpp b/platform/android/src/style/layers/circle_layer.hpp
index 5c53f6c191..6db97127c0 100644
--- a/platform/android/src/style/layers/circle_layer.hpp
+++ b/platform/android/src/style/layers/circle_layer.hpp
@@ -65,7 +65,7 @@ public:
}; // class CircleLayer
-class CircleJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::CircleLayerFactory {
+class CircleJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::CircleLayerFactory {
public:
~CircleJavaLayerPeerFactory() override;
@@ -75,7 +75,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class CircleJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/custom_layer.hpp b/platform/android/src/style/layers/custom_layer.hpp
index ea4a3d79a5..814cfea3ca 100644
--- a/platform/android/src/style/layers/custom_layer.hpp
+++ b/platform/android/src/style/layers/custom_layer.hpp
@@ -25,7 +25,7 @@ public:
}; // class CustomLayer
-class CustomJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::CustomLayerFactory {
+class CustomJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::CustomLayerFactory {
public:
~CustomJavaLayerPeerFactory() override;
@@ -35,7 +35,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class CustomJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/fill_extrusion_layer.hpp b/platform/android/src/style/layers/fill_extrusion_layer.hpp
index ace8cd1357..fe7204985c 100644
--- a/platform/android/src/style/layers/fill_extrusion_layer.hpp
+++ b/platform/android/src/style/layers/fill_extrusion_layer.hpp
@@ -53,7 +53,7 @@ public:
}; // class FillExtrusionLayer
-class FillExtrusionJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::FillExtrusionLayerFactory {
+class FillExtrusionJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::FillExtrusionLayerFactory {
public:
~FillExtrusionJavaLayerPeerFactory() override;
@@ -63,7 +63,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class FillExtrusionJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/fill_layer.hpp b/platform/android/src/style/layers/fill_layer.hpp
index c7b469ac90..776f2c3a88 100644
--- a/platform/android/src/style/layers/fill_layer.hpp
+++ b/platform/android/src/style/layers/fill_layer.hpp
@@ -51,7 +51,7 @@ public:
}; // class FillLayer
-class FillJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::FillLayerFactory {
+class FillJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::FillLayerFactory {
public:
~FillJavaLayerPeerFactory() override;
@@ -61,7 +61,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class FillJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/heatmap_layer.hpp b/platform/android/src/style/layers/heatmap_layer.hpp
index 45c194b0f0..51966ec93e 100644
--- a/platform/android/src/style/layers/heatmap_layer.hpp
+++ b/platform/android/src/style/layers/heatmap_layer.hpp
@@ -43,7 +43,7 @@ public:
}; // class HeatmapLayer
-class HeatmapJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::HeatmapLayerFactory {
+class HeatmapJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::HeatmapLayerFactory {
public:
~HeatmapJavaLayerPeerFactory() override;
@@ -53,7 +53,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class HeatmapJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/hillshade_layer.hpp b/platform/android/src/style/layers/hillshade_layer.hpp
index db0ea736b4..b63f85e36c 100644
--- a/platform/android/src/style/layers/hillshade_layer.hpp
+++ b/platform/android/src/style/layers/hillshade_layer.hpp
@@ -47,7 +47,7 @@ public:
}; // class HillshadeLayer
-class HillshadeJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::HillshadeLayerFactory {
+class HillshadeJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::HillshadeLayerFactory {
public:
~HillshadeJavaLayerPeerFactory() override;
@@ -57,7 +57,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class HillshadeJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/layer.hpp b/platform/android/src/style/layers/layer.hpp
index 633630b891..c405bc17c1 100644
--- a/platform/android/src/style/layers/layer.hpp
+++ b/platform/android/src/style/layers/layer.hpp
@@ -117,7 +117,7 @@ public:
*
* @return style::LayerFactory* must not be \c nullptr.
*/
- virtual style::LayerFactory* getLayerFactory() = 0;
+ virtual LayerFactory* getLayerFactory() = 0;
};
diff --git a/platform/android/src/style/layers/layer.hpp.ejs b/platform/android/src/style/layers/layer.hpp.ejs
index 5791c16501..e82470e270 100644
--- a/platform/android/src/style/layers/layer.hpp.ejs
+++ b/platform/android/src/style/layers/layer.hpp.ejs
@@ -43,7 +43,7 @@ public:
}; // class <%- camelize(type) %>Layer
-class <%- camelize(type) %>JavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::<%- camelize(type) %>LayerFactory {
+class <%- camelize(type) %>JavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::<%- camelize(type) %>LayerFactory {
public:
~<%- camelize(type) %>JavaLayerPeerFactory() override;
@@ -53,7 +53,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class <%- camelize(type) %>JavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/layer_manager.cpp b/platform/android/src/style/layers/layer_manager.cpp
index 9ad62121e6..9f13fa0640 100644
--- a/platform/android/src/style/layers/layer_manager.cpp
+++ b/platform/android/src/style/layers/layer_manager.cpp
@@ -1,17 +1,6 @@
#include "layer_manager.hpp"
-#include <mbgl/style/layer.hpp>
#include <mbgl/style/layer_impl.hpp>
-#include <mbgl/style/layers/background_layer.hpp>
-#include <mbgl/style/layers/circle_layer.hpp>
-#include <mbgl/style/layers/fill_extrusion_layer.hpp>
-#include <mbgl/style/layers/fill_layer.hpp>
-#include <mbgl/style/layers/heatmap_layer.hpp>
-#include <mbgl/style/layers/hillshade_layer.hpp>
-#include <mbgl/style/layers/line_layer.hpp>
-#include <mbgl/style/layers/raster_layer.hpp>
-#include <mbgl/style/layers/symbol_layer.hpp>
-#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/filter.hpp>
@@ -49,14 +38,14 @@ LayerManagerAndroid::LayerManagerAndroid() {
LayerManagerAndroid::~LayerManagerAndroid() = default;
jni::Local<jni::Object<Layer>> LayerManagerAndroid::createJavaLayerPeer(jni::JNIEnv& env, mbgl::Map& map, mbgl::style::Layer& layer) {
- if (JavaLayerPeerFactory* factory = getPeerFactory(&layer)) {
+ if (JavaLayerPeerFactory* factory = getPeerFactory(layer.getTypeInfo())) {
return factory->createJavaLayerPeer(env, map, layer);
}
return jni::Local<jni::Object<Layer>>();
}
jni::Local<jni::Object<Layer>> LayerManagerAndroid::createJavaLayerPeer(jni::JNIEnv& env, mbgl::Map& map, std::unique_ptr<mbgl::style::Layer> layer) {
- if (JavaLayerPeerFactory* factory = getPeerFactory(layer.get())) {
+ if (JavaLayerPeerFactory* factory = getPeerFactory(layer->getTypeInfo())) {
return factory->createJavaLayerPeer(env, map, std::move(layer));
}
return jni::Local<jni::Object<Layer>>();
@@ -78,8 +67,7 @@ void LayerManagerAndroid::addLayerType(std::unique_ptr<JavaLayerPeerFactory> fac
factories.emplace_back(std::move(factory));
}
-JavaLayerPeerFactory* LayerManagerAndroid::getPeerFactory(mbgl::style::Layer* layer) {
- auto* typeInfo = layer->baseImpl->getTypeInfo();
+JavaLayerPeerFactory* LayerManagerAndroid::getPeerFactory(const mbgl::style::LayerTypeInfo* typeInfo) {
assert(typeInfo);
for (const auto& factory: factories) {
if (factory->getLayerFactory()->getTypeInfo() == typeInfo) {
@@ -90,20 +78,14 @@ JavaLayerPeerFactory* LayerManagerAndroid::getPeerFactory(mbgl::style::Layer* la
return nullptr;
}
-std::unique_ptr<style::Layer> LayerManagerAndroid::createLayer(const std::string& type,
- const std::string& id,
- const style::conversion::Convertible& value,
- style::conversion::Error& error) noexcept {
+LayerFactory* LayerManagerAndroid::getFactory(const std::string& type) noexcept {
auto search = typeToFactory.find(type);
- if (search != typeToFactory.end()) {
- auto layer = search->second->createLayer(id, value);
- if (!layer) {
- error.message = "Error parsing a layer of type: " + type;
- }
- return layer;
- }
- error.message = "Unsupported layer type: " + type;
- return nullptr;
+ return (search != typeToFactory.end()) ? search->second : nullptr;
+}
+
+LayerFactory* LayerManagerAndroid::getFactory(const mbgl::style::LayerTypeInfo* info) noexcept {
+ JavaLayerPeerFactory* peerFactory = getPeerFactory(info);
+ return (peerFactory != nullptr) ? peerFactory->getLayerFactory() : nullptr;
}
// static
@@ -114,11 +96,8 @@ LayerManagerAndroid* LayerManagerAndroid::get() noexcept {
} // namespace android
-namespace style {
-// static
LayerManager* LayerManager::get() noexcept {
return android::LayerManagerAndroid::get();
}
-} // style
} // namespace mbgl
diff --git a/platform/android/src/style/layers/layer_manager.hpp b/platform/android/src/style/layers/layer_manager.hpp
index 396521cc4a..1521645cce 100644
--- a/platform/android/src/style/layers/layer_manager.hpp
+++ b/platform/android/src/style/layers/layer_manager.hpp
@@ -3,6 +3,8 @@
#include <mbgl/map/map.hpp>
#include <mbgl/style/layer.hpp>
+#include <mbgl/renderer/render_layer.hpp>
+
#include "layer.hpp"
#include <jni/jni.hpp>
@@ -16,9 +18,9 @@ namespace android {
/**
* @brief A singleton class forwarding calls to the corresponding \c JavaLayerPeerFactory instance.
*/
-class LayerManagerAndroid : public mbgl::style::LayerManager {
+class LayerManagerAndroid final : public mbgl::LayerManager {
public:
- ~LayerManagerAndroid() override;
+ ~LayerManagerAndroid() final;
static LayerManagerAndroid* get() noexcept;
jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Layer&);
@@ -29,13 +31,14 @@ public:
private:
LayerManagerAndroid();
void addLayerType(std::unique_ptr<JavaLayerPeerFactory>);
- JavaLayerPeerFactory* getPeerFactory(mbgl::style::Layer*);
- // mbgl:style::LayerManager overrides.
- std::unique_ptr<style::Layer> createLayer(const std::string& type, const std::string& id, const style::conversion::Convertible& value, style::conversion::Error& error) noexcept final;
+ JavaLayerPeerFactory* getPeerFactory(const mbgl::style::LayerTypeInfo*);
+ // mbgl::LayerManager overrides.
+ LayerFactory* getFactory(const std::string& type) noexcept final;
+ LayerFactory* getFactory(const mbgl::style::LayerTypeInfo* info) noexcept final;
std::vector<std::unique_ptr<JavaLayerPeerFactory>> factories;
- std::map<std::string, style::LayerFactory*> typeToFactory;
+ std::map<std::string, mbgl::LayerFactory*> typeToFactory;
};
-}
-}
+} // namespace android
+} // namespace mbgl
diff --git a/platform/android/src/style/layers/line_layer.hpp b/platform/android/src/style/layers/line_layer.hpp
index 4dbc855ca9..7c16822ef8 100644
--- a/platform/android/src/style/layers/line_layer.hpp
+++ b/platform/android/src/style/layers/line_layer.hpp
@@ -75,7 +75,7 @@ public:
}; // class LineLayer
-class LineJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::LineLayerFactory {
+class LineJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::LineLayerFactory {
public:
~LineJavaLayerPeerFactory() override;
@@ -85,7 +85,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class LineJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/raster_layer.hpp b/platform/android/src/style/layers/raster_layer.hpp
index 492b3562fc..6be6792776 100644
--- a/platform/android/src/style/layers/raster_layer.hpp
+++ b/platform/android/src/style/layers/raster_layer.hpp
@@ -55,7 +55,7 @@ public:
}; // class RasterLayer
-class RasterJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::RasterLayerFactory {
+class RasterJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::RasterLayerFactory {
public:
~RasterJavaLayerPeerFactory() override;
@@ -65,7 +65,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class RasterJavaLayerPeerFactory
diff --git a/platform/android/src/style/layers/symbol_layer.hpp b/platform/android/src/style/layers/symbol_layer.hpp
index 5df7ac3687..b38a659b06 100644
--- a/platform/android/src/style/layers/symbol_layer.hpp
+++ b/platform/android/src/style/layers/symbol_layer.hpp
@@ -153,7 +153,7 @@ public:
}; // class SymbolLayer
-class SymbolJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::style::SymbolLayerFactory {
+class SymbolJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::SymbolLayerFactory {
public:
~SymbolJavaLayerPeerFactory() override;
@@ -163,7 +163,7 @@ public:
void registerNative(jni::JNIEnv&) final;
- style::LayerFactory* getLayerFactory() final { return this; }
+ LayerFactory* getLayerFactory() final { return this; }
}; // class SymbolJavaLayerPeerFactory
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer_Private.h b/platform/darwin/src/MGLBackgroundStyleLayer_Private.h
index 07021669dc..a6295a7c5a 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer_Private.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class BackgroundStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::BackgroundLayerFactory {
+class BackgroundStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::BackgroundLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLCircleStyleLayer_Private.h b/platform/darwin/src/MGLCircleStyleLayer_Private.h
index 3813a9a068..a023e2a88b 100644
--- a/platform/darwin/src/MGLCircleStyleLayer_Private.h
+++ b/platform/darwin/src/MGLCircleStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class CircleStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::CircleLayerFactory {
+class CircleStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CircleLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h b/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h
index 2b9a53f59f..fdd99d74f4 100644
--- a/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h
+++ b/platform/darwin/src/MGLFillExtrusionStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class FillExtrusionStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::FillExtrusionLayerFactory {
+class FillExtrusionStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::FillExtrusionLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLFillStyleLayer_Private.h b/platform/darwin/src/MGLFillStyleLayer_Private.h
index f31d397434..28f24f056d 100644
--- a/platform/darwin/src/MGLFillStyleLayer_Private.h
+++ b/platform/darwin/src/MGLFillStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class FillStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::FillLayerFactory {
+class FillStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::FillLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLHeatmapStyleLayer_Private.h b/platform/darwin/src/MGLHeatmapStyleLayer_Private.h
index 16ad816be4..e81920ae39 100644
--- a/platform/darwin/src/MGLHeatmapStyleLayer_Private.h
+++ b/platform/darwin/src/MGLHeatmapStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class HeatmapStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::HeatmapLayerFactory {
+class HeatmapStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::HeatmapLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLHillshadeStyleLayer_Private.h b/platform/darwin/src/MGLHillshadeStyleLayer_Private.h
index 28958512d7..e92cc7f3ec 100644
--- a/platform/darwin/src/MGLHillshadeStyleLayer_Private.h
+++ b/platform/darwin/src/MGLHillshadeStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class HillshadeStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::HillshadeLayerFactory {
+class HillshadeStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::HillshadeLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLLineStyleLayer_Private.h b/platform/darwin/src/MGLLineStyleLayer_Private.h
index ba50ebbc0d..85dbffb8ca 100644
--- a/platform/darwin/src/MGLLineStyleLayer_Private.h
+++ b/platform/darwin/src/MGLLineStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class LineStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::LineLayerFactory {
+class LineStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::LineLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer_Private.h b/platform/darwin/src/MGLOpenGLStyleLayer_Private.h
index 1188c50cd5..cce062b53d 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer_Private.h
+++ b/platform/darwin/src/MGLOpenGLStyleLayer_Private.h
@@ -6,9 +6,9 @@
namespace mbgl {
-class OpenGLStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::CustomLayerFactory {
+class OpenGLStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::CustomLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLRasterStyleLayer_Private.h b/platform/darwin/src/MGLRasterStyleLayer_Private.h
index 1070751a61..5388d64302 100644
--- a/platform/darwin/src/MGLRasterStyleLayer_Private.h
+++ b/platform/darwin/src/MGLRasterStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class RasterStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::RasterLayerFactory {
+class RasterStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::RasterLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLStyleLayerManager.h b/platform/darwin/src/MGLStyleLayerManager.h
index 0f7fab00ed..2fa34991a1 100644
--- a/platform/darwin/src/MGLStyleLayerManager.h
+++ b/platform/darwin/src/MGLStyleLayerManager.h
@@ -10,7 +10,7 @@
namespace mbgl {
-class LayerManagerDarwin : public style::LayerManager {
+class LayerManagerDarwin : public LayerManager {
public:
static LayerManagerDarwin* get() noexcept;
~LayerManagerDarwin();
@@ -20,11 +20,13 @@ public:
private:
LayerManagerDarwin();
void addLayerType(std::unique_ptr<LayerPeerFactory>);
- // LayerManager overrides.
- std::unique_ptr<style::Layer> createLayer(const std::string& type, const std::string& id, const style::conversion::Convertible& value, style::conversion::Error& error) noexcept final;
-
+ LayerPeerFactory* getPeerFactory(const style::LayerTypeInfo* typeInfo);
+ // mbgl::LayerManager overrides.
+ LayerFactory* getFactory(const std::string& type) noexcept final;
+ LayerFactory* getFactory(const mbgl::style::LayerTypeInfo* info) noexcept final;
+
std::vector<std::unique_ptr<LayerPeerFactory>> factories;
- std::map<std::string, style::LayerFactory*> typeToFactory;
+ std::map<std::string, LayerFactory*> typeToFactory;
};
} // namespace mbgl
diff --git a/platform/darwin/src/MGLStyleLayerManager.mm b/platform/darwin/src/MGLStyleLayerManager.mm
index 2cb919dd9d..90272851c3 100644
--- a/platform/darwin/src/MGLStyleLayerManager.mm
+++ b/platform/darwin/src/MGLStyleLayerManager.mm
@@ -31,14 +31,9 @@ LayerManagerDarwin::LayerManagerDarwin() {
LayerManagerDarwin::~LayerManagerDarwin() = default;
MGLStyleLayer* LayerManagerDarwin::createPeer(style::Layer* layer) {
- auto* typeInfo = layer->getTypeInfo();
- assert(typeInfo);
- for (const auto& factory: factories) {
- if (factory->getCoreLayerFactory()->getTypeInfo() == typeInfo) {
- return factory->createPeer(layer);
- }
+ if (auto* factory = getPeerFactory(layer->getTypeInfo())) {
+ return factory->createPeer(layer);
}
- assert(false);
return nullptr;
}
@@ -51,34 +46,36 @@ void LayerManagerDarwin::addLayerType(std::unique_ptr<LayerPeerFactory> factory)
factories.emplace_back(std::move(factory));
}
-std::unique_ptr<style::Layer> LayerManagerDarwin::createLayer(const std::string& type,
- const std::string& id,
- const style::conversion::Convertible& value,
- style::conversion::Error& error) noexcept {
- auto search = typeToFactory.find(type);
- if (search != typeToFactory.end()) {
- auto layer = search->second->createLayer(id, value);
- if (!layer) {
- error.message = "Error parsing a layer of type: " + type;
+LayerPeerFactory* LayerManagerDarwin::getPeerFactory(const mbgl::style::LayerTypeInfo* typeInfo) {
+ assert(typeInfo);
+ for (const auto& factory: factories) {
+ if (factory->getCoreLayerFactory()->getTypeInfo() == typeInfo) {
+ return factory.get();
}
- return layer;
}
- error.message = "Unsupported layer type: " + type;
+ assert(false);
return nullptr;
}
+LayerFactory* LayerManagerDarwin::getFactory(const std::string& type) noexcept {
+ auto search = typeToFactory.find(type);
+ return (search != typeToFactory.end()) ? search->second : nullptr;
+}
+
+LayerFactory* LayerManagerDarwin::getFactory(const mbgl::style::LayerTypeInfo* info) noexcept {
+ LayerPeerFactory* peerFactory = getPeerFactory(info);
+ return (peerFactory != nullptr) ? peerFactory->getCoreLayerFactory() : nullptr;
+}
+
// static
LayerManagerDarwin* LayerManagerDarwin::get() noexcept {
static LayerManagerDarwin impl;
return &impl;
}
-namespace style {
-
// static
LayerManager* LayerManager::get() noexcept {
return LayerManagerDarwin::get();
}
-} // namespace style
} // namespace mbgl
diff --git a/platform/darwin/src/MGLStyleLayer_Private.h b/platform/darwin/src/MGLStyleLayer_Private.h
index 0d6e4094bd..656f74ca42 100644
--- a/platform/darwin/src/MGLStyleLayer_Private.h
+++ b/platform/darwin/src/MGLStyleLayer_Private.h
@@ -90,7 +90,7 @@ public:
/**
Get the corresponding core layer factory.
*/
- virtual style::LayerFactory* getCoreLayerFactory() = 0;
+ virtual LayerFactory* getCoreLayerFactory() = 0;
/**
Creates an MGLStyleLayer instance with a raw pointer to the backing store.
*/
diff --git a/platform/darwin/src/MGLStyleLayer_Private.h.ejs b/platform/darwin/src/MGLStyleLayer_Private.h.ejs
index 245eeec29e..8cb8d6281a 100644
--- a/platform/darwin/src/MGLStyleLayer_Private.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer_Private.h.ejs
@@ -15,9 +15,9 @@
namespace mbgl {
-class <%- camelize(type) %>StyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::<%- camelize(type) %>LayerFactory {
+class <%- camelize(type) %>StyleLayerPeerFactory : public LayerPeerFactory, public mbgl::<%- camelize(type) %>LayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/src/MGLSymbolStyleLayer_Private.h b/platform/darwin/src/MGLSymbolStyleLayer_Private.h
index 6ba7c7bfd0..5e5755ad67 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer_Private.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer_Private.h
@@ -8,9 +8,9 @@
namespace mbgl {
-class SymbolStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::style::SymbolLayerFactory {
+class SymbolStyleLayerPeerFactory : public LayerPeerFactory, public mbgl::SymbolLayerFactory {
// LayerPeerFactory overrides.
- style::LayerFactory* getCoreLayerFactory() final { return this; }
+ LayerFactory* getCoreLayerFactory() final { return this; }
virtual MGLStyleLayer* createPeer(style::Layer*) final;
};
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index d76cd8cd6d..600f81acfe 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -22,7 +22,7 @@
- (void)testProperties {
MGLBackgroundStyleLayer *layer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"layerID"];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Background);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"background");
auto rawLayer = static_cast<mbgl::style::BackgroundLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index 213416109c..5f789f4faf 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Circle);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"circle");
auto rawLayer = static_cast<mbgl::style::CircleLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
index 7c4e147026..ecfa2134a0 100644
--- a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLFillExtrusionStyleLayer *layer = [[MGLFillExtrusionStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::FillExtrusion);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"fill-extrusion");
auto rawLayer = static_cast<mbgl::style::FillExtrusionLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index b8c39918c5..3762c4095e 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Fill);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"fill");
auto rawLayer = static_cast<mbgl::style::FillLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
index bde8a5b1c8..98d314cb9f 100644
--- a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLHeatmapStyleLayer *layer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Heatmap);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"heatmap");
auto rawLayer = static_cast<mbgl::style::HeatmapLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
index 5c8a45beab..a52f36e8c6 100644
--- a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
@@ -25,7 +25,7 @@
MGLHillshadeStyleLayer *layer = [[MGLHillshadeStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Hillshade);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"hillshade");
auto rawLayer = static_cast<mbgl::style::HillshadeLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index c8868635ef..f4fd714ad7 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Line);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"line");
auto rawLayer = static_cast<mbgl::style::LineLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index f0ce055b3a..5168d2e0d4 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -25,7 +25,7 @@
MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Raster);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"raster");
auto rawLayer = static_cast<mbgl::style::RasterLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index 68d61072f8..ba878b8bbe 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -54,7 +54,7 @@
MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source];
<% } -%>
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::<%- camelize(type) %>);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"<%- type %>");
auto rawLayer = static_cast<mbgl::style::<%- camelize(type) %>Layer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index daf63355e6..f02c5d496e 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -43,7 +43,7 @@
MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Symbol);
+ XCTAssertEqualObjects(@(layer.rawLayer->getTypeInfo()->type), @"symbol");
auto rawLayer = static_cast<mbgl::style::SymbolLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/default/layer_manager.cpp b/platform/default/layer_manager.cpp
index 0a27c0b512..60cd0855b8 100644
--- a/platform/default/layer_manager.cpp
+++ b/platform/default/layer_manager.cpp
@@ -1,37 +1,36 @@
-#include <mbgl/style/layer.hpp>
-#include <mbgl/style/layers/symbol_layer.hpp>
-#include <mbgl/style/layers/background_layer.hpp>
-#include <mbgl/style/layers/circle_layer.hpp>
-#include <mbgl/style/layers/custom_layer.hpp>
-#include <mbgl/style/layers/fill_extrusion_layer.hpp>
-#include <mbgl/style/layers/fill_layer.hpp>
-#include <mbgl/style/layers/heatmap_layer.hpp>
-#include <mbgl/style/layers/hillshade_layer.hpp>
-#include <mbgl/style/layers/line_layer.hpp>
-#include <mbgl/style/layers/raster_layer.hpp>
-#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/renderer/render_layer.hpp>
+#include <mbgl/renderer/layers/render_background_layer.hpp>
+#include <mbgl/renderer/layers/render_circle_layer.hpp>
+#include <mbgl/renderer/layers/render_custom_layer.hpp>
+#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
+#include <mbgl/renderer/layers/render_fill_layer.hpp>
+#include <mbgl/renderer/layers/render_hillshade_layer.hpp>
+#include <mbgl/renderer/layers/render_line_layer.hpp>
+#include <mbgl/renderer/layers/render_raster_layer.hpp>
+#include <mbgl/renderer/layers/render_symbol_layer.hpp>
+#include <mbgl/renderer/layers/render_heatmap_layer.hpp>
#include <map>
#include <memory>
#include <vector>
namespace mbgl {
-namespace style {
-class LayerManagerBase : public LayerManager {
+class LayerManagerDefault final : public LayerManager {
public:
- LayerManagerBase();
+ LayerManagerDefault();
private:
void addLayerType(std::unique_ptr<LayerFactory>);
// LayerManager overrides.
- std::unique_ptr<Layer> createLayer(const std::string& type, const std::string& id, const conversion::Convertible& value, conversion::Error& error) noexcept final;
+ LayerFactory* getFactory(const std::string& type) noexcept final;
+ LayerFactory* getFactory(const style::LayerTypeInfo*) noexcept final;
std::vector<std::unique_ptr<LayerFactory>> factories;
std::map<std::string, LayerFactory*> typeToFactory;
};
-LayerManagerBase::LayerManagerBase() {
+LayerManagerDefault::LayerManagerDefault() {
addLayerType(std::make_unique<FillLayerFactory>());
addLayerType(std::make_unique<LineLayerFactory>());
addLayerType(std::make_unique<CircleLayerFactory>());
@@ -44,7 +43,7 @@ LayerManagerBase::LayerManagerBase() {
addLayerType(std::make_unique<CustomLayerFactory>());
}
-void LayerManagerBase::addLayerType(std::unique_ptr<LayerFactory> factory) {
+void LayerManagerDefault::addLayerType(std::unique_ptr<LayerFactory> factory) {
std::string type{factory->getTypeInfo()->type};
if (!type.empty()) {
typeToFactory.emplace(std::make_pair(std::move(type), factory.get()));
@@ -52,27 +51,26 @@ void LayerManagerBase::addLayerType(std::unique_ptr<LayerFactory> factory) {
factories.emplace_back(std::move(factory));
}
-std::unique_ptr<Layer> LayerManagerBase::createLayer(const std::string& type,
- const std::string& id,
- const conversion::Convertible& value,
- conversion::Error& error) noexcept {
- auto search = typeToFactory.find(type);
- if (search != typeToFactory.end()) {
- auto layer = search->second->createLayer(id, value);
- if (!layer) {
- error.message = "Error parsing a layer of type: " + type;
+LayerFactory* LayerManagerDefault::getFactory(const mbgl::style::LayerTypeInfo* typeInfo) noexcept {
+ assert(typeInfo);
+ for (const auto& factory: factories) {
+ if (factory->getTypeInfo() == typeInfo) {
+ return factory.get();
}
- return layer;
}
- error.message = "Unsupported layer type: " + type;
+ assert(false);
return nullptr;
}
+LayerFactory* LayerManagerDefault::getFactory(const std::string& type) noexcept {
+ auto search = typeToFactory.find(type);
+ return (search != typeToFactory.end()) ? search->second : nullptr;
+}
+
// static
LayerManager* LayerManager::get() noexcept {
- static LayerManagerBase impl;
- return &impl;
+ static LayerManagerDefault instance;
+ return &instance;
}
-} // namespace style
} // namespace mbgl
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 1b2334c657..f0ddbb346d 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -3770,6 +3770,10 @@
"$(geometry_cflags)",
"$(geojson_cflags)",
);
+ OTHER_LDFLAGS = (
+ "$(mbgl_core_LINK_LIBRARIES)",
+ "$(mbgl_filesource_LINK_LIBRARIES)",
+ );
OTHER_SWIFT_FLAGS = "-warnings-as-errors";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3797,6 +3801,10 @@
"$(geometry_cflags)",
"$(geojson_cflags)",
);
+ OTHER_LDFLAGS = (
+ "$(mbgl_core_LINK_LIBRARIES)",
+ "$(mbgl_filesource_LINK_LIBRARIES)",
+ );
OTHER_SWIFT_FLAGS = "-warnings-as-errors";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 60ac8e6843..3cd807be7e 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -2144,6 +2144,10 @@
"$(geometry_cflags)",
"$(geojson_cflags)",
);
+ OTHER_LDFLAGS = (
+ "$(mbgl_core_LINK_LIBRARIES)",
+ "$(mbgl_filesource_LINK_LIBRARIES)",
+ );
OTHER_SWIFT_FLAGS = "-warnings-as-errors";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2172,6 +2176,10 @@
"$(geometry_cflags)",
"$(geojson_cflags)",
);
+ OTHER_LDFLAGS = (
+ "$(mbgl_core_LINK_LIBRARIES)",
+ "$(mbgl_filesource_LINK_LIBRARIES)",
+ );
OTHER_SWIFT_FLAGS = "-warnings-as-errors";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.test;
PRODUCT_NAME = "$(TARGET_NAME)";