Introduce the style::Layer factory classes

This patch introduces the initial implementation of
- A `LayerFactory` abstract class that creates `style::Layer` instances of
  a certain layer type (line, hillshade, round, ..)
- A singleton `LayerManager` class, which is responsible for initializing
  the `LayerFactory` instances and forwarding the `create()` calls to the
  corresponding factory.
This commit is contained in:
Mikhail Pozdnyakov
2018-10-28 22:33:06 +02:00
parent 278aa33703
commit cfcb53128b
23 changed files with 400 additions and 114 deletions

View File

@@ -270,5 +270,16 @@ Mutable<Layer::Impl> BackgroundLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
BackgroundLayerFactory::~BackgroundLayerFactory() = default;
const char* BackgroundLayerFactory::type() const {
return "background";
}
std::unique_ptr<style::Layer> BackgroundLayerFactory::createLayer(const std::string& id, const conversion::Convertible& value) {
(void)value;
return std::unique_ptr<style::Layer>(new BackgroundLayer(id));
}
} // namespace style
} // namespace mbgl