[node] Added 'removeLayer' binding
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
"express": "^4.11.1",
|
||||
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#4d1f89514bf03536c8e682439df165c33a37122a",
|
||||
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#d4c5c157397a2df619ba1eecf69a08b34159b3e1",
|
||||
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#3fabb909ba50af1175a2409e9a3cda56fb41b5c7",
|
||||
"node-gyp": "^3.3.1",
|
||||
"request": "^2.72.0",
|
||||
"tape": "^4.5.1"
|
||||
|
||||
@@ -60,6 +60,7 @@ NAN_MODULE_INIT(NodeMap::Init) {
|
||||
Nan::SetPrototypeMethod(tpl, "addClass", AddClass);
|
||||
Nan::SetPrototypeMethod(tpl, "addSource", AddSource);
|
||||
Nan::SetPrototypeMethod(tpl, "addLayer", AddLayer);
|
||||
Nan::SetPrototypeMethod(tpl, "removeLayer", RemoveLayer);
|
||||
Nan::SetPrototypeMethod(tpl, "setLayoutProperty", SetLayoutProperty);
|
||||
Nan::SetPrototypeMethod(tpl, "setPaintProperty", SetPaintProperty);
|
||||
Nan::SetPrototypeMethod(tpl, "setFilter", SetFilter);
|
||||
@@ -531,6 +532,24 @@ NAN_METHOD(NodeMap::AddLayer) {
|
||||
nodeMap->map->addLayer(std::move(*layer));
|
||||
}
|
||||
|
||||
NAN_METHOD(NodeMap::RemoveLayer) {
|
||||
using namespace mbgl::style;
|
||||
using namespace mbgl::style::conversion;
|
||||
|
||||
auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder());
|
||||
if (!nodeMap->map) return Nan::ThrowError(releasedMessage());
|
||||
|
||||
if (info.Length() != 1) {
|
||||
return Nan::ThrowTypeError("One argument required");
|
||||
}
|
||||
|
||||
if (!info[0]->IsString()) {
|
||||
return Nan::ThrowTypeError("First argument must be a string");
|
||||
}
|
||||
|
||||
nodeMap->map->removeLayer(*Nan::Utf8String(info[0]));
|
||||
}
|
||||
|
||||
NAN_METHOD(NodeMap::SetLayoutProperty) {
|
||||
using namespace mbgl::style;
|
||||
using namespace mbgl::style::conversion;
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
static NAN_METHOD(AddClass);
|
||||
static NAN_METHOD(AddSource);
|
||||
static NAN_METHOD(AddLayer);
|
||||
static NAN_METHOD(RemoveLayer);
|
||||
static NAN_METHOD(SetLayoutProperty);
|
||||
static NAN_METHOD(SetPaintProperty);
|
||||
static NAN_METHOD(SetFilter);
|
||||
|
||||
Reference in New Issue
Block a user