diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-29 12:00:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-06 14:29:22 -0700 |
commit | fe2a26225f3746381b36ad8b6c6a3ce7727bf655 (patch) | |
tree | 62507ffd6a28654a377469d35e21719ff7a12fdc /test/src | |
parent | 3a48c60813b18c092c8d8d75c80a318bdd8859bb (diff) | |
download | qtlocation-mapboxgl-fe2a26225f3746381b36ad8b6c6a3ce7727bf655.tar.gz |
[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.
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/mbgl/test/stub_layer_observer.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/src/mbgl/test/stub_layer_observer.hpp b/test/src/mbgl/test/stub_layer_observer.hpp new file mode 100644 index 0000000000..500103055d --- /dev/null +++ b/test/src/mbgl/test/stub_layer_observer.hpp @@ -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; +}; |