[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:
28
test/src/mbgl/test/stub_layer_observer.hpp
Normal file
28
test/src/mbgl/test/stub_layer_observer.hpp
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user