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.
This commit is contained in:
Mikhail Pozdnyakov
2018-10-25 16:15:31 +03:00
parent fdd8b54900
commit 7a9461a8d4
30 changed files with 203 additions and 929 deletions

View File

@@ -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) {