[core] Refactor CustomLayer internals

Move the responsibility for initialization/deinitialization/rendering to RenderCustomLayer. This eliminates special case code from Map and Style.
This commit is contained in:
John Firebaugh
2017-06-14 16:21:02 -07:00
parent e4201e207c
commit be7e9bbb8d
10 changed files with 70 additions and 85 deletions

View File

@@ -904,20 +904,14 @@ Layer* Map::getLayer(const std::string& layerID) {
void Map::addLayer(std::unique_ptr<Layer> layer, const optional<std::string>& before) {
impl->styleMutated = true;
BackendScope guard(impl->backend);
impl->style->addLayer(std::move(layer), before);
impl->onUpdate(Update::Repaint);
}
std::unique_ptr<Layer> Map::removeLayer(const std::string& id) {
impl->styleMutated = true;
BackendScope guard(impl->backend);
auto removedLayer = impl->style->removeLayer(id);
impl->onUpdate(Update::Repaint);
return removedLayer;
return impl->style->removeLayer(id);
}
void Map::addImage(std::unique_ptr<style::Image> image) {