diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-10-25 16:15:31 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-10-25 22:42:43 +0300 |
commit | 7a9461a8d439458b18656ecfb839923adc5f0e9b (patch) | |
tree | 5617367418dafc5b7b45c4ba7cca4b74f40200f3 /platform/node | |
parent | fdd8b54900d963d01f9b643fa7edd9e988eb7785 (diff) | |
download | qtlocation-mapboxgl-7a9461a8d439458b18656ecfb839923adc5f0e9b.tar.gz |
Consolidate `style::Layer` properties API
The `style::Layer` class now exposes all the properties contained at `style::LayerImpl`.
This allowed to drop `style::Layer::accept()` method usage, avoid the repeated generated code
and thus save some binary size.
This patch is a part of the layers modularization effort.
Diffstat (limited to 'platform/node')
-rw-r--r-- | platform/node/src/node_map.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 5693edbd03..6dccdf5292 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -892,31 +892,6 @@ void NodeMap::SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>& info) info.GetReturnValue().SetUndefined(); } -struct SetFilterVisitor { - mbgl::style::Filter& filter; - - void operator()(mbgl::style::CustomLayer&) { - Nan::ThrowTypeError("layer doesn't support filters"); - } - - void operator()(mbgl::style::RasterLayer&) { - Nan::ThrowTypeError("layer doesn't support filters"); - } - - void operator()(mbgl::style::HillshadeLayer&) { - Nan::ThrowTypeError("layer doesn't support filters"); - } - - void operator()(mbgl::style::BackgroundLayer&) { - Nan::ThrowTypeError("layer doesn't support filters"); - } - - template <class VectorLayer> - void operator()(VectorLayer& layer) { - layer.setFilter(filter); - } -}; - void NodeMap::SetFilter(const Nan::FunctionCallbackInfo<v8::Value>& info) { using namespace mbgl::style; using namespace mbgl::style::conversion; @@ -949,7 +924,7 @@ void NodeMap::SetFilter(const Nan::FunctionCallbackInfo<v8::Value>& info) { filter = std::move(*converted); } - layer->accept(SetFilterVisitor { filter }); + layer->setFilter(filter); } void NodeMap::SetCenter(const Nan::FunctionCallbackInfo<v8::Value>& info) { |