[core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update

This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
This commit is contained in:
John Firebaugh
2016-08-29 12:00:08 -07:00
parent 3a48c60813
commit fe2a26225f
33 changed files with 426 additions and 148 deletions

View File

@@ -0,0 +1,28 @@
#pragma once
#include <mbgl/style/layer_observer.hpp>
using namespace mbgl;
using namespace mbgl::style;
/**
* An implementation of style::LayerObserver that forwards all methods to dynamically-settable lambas.
*/
class StubLayerObserver : public style::LayerObserver {
public:
void onLayerFilterChanged(Layer& layer) override {
if (layerFilterChanged) layerFilterChanged(layer);
}
void onLayerPaintPropertyChanged(Layer& layer) override {
if (layerPaintPropertyChanged) layerPaintPropertyChanged(layer);
}
void onLayerLayoutPropertyChanged(Layer& layer) override {
if (layerLayoutPropertyChanged) layerLayoutPropertyChanged(layer);
}
std::function<void (Layer&)> layerFilterChanged;
std::function<void (Layer&)> layerPaintPropertyChanged;
std::function<void (Layer&)> layerLayoutPropertyChanged;
};