summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-12-02 18:04:06 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-12-03 14:20:17 +0200
commit5d46cd662fe5c441618204241f61c986af200f48 (patch)
tree37449a128ea6b4c6f4052f370ebadbea095bfd41 /platform/node
parent684000fc263ac6c4064e80505bd1a2f6c15fb0fa (diff)
downloadqtlocation-mapboxgl-5d46cd662fe5c441618204241f61c986af200f48.tar.gz
[android][node][qt] Update platform code for style::Layer::setProperty()
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_map.cpp40
-rw-r--r--platform/node/src/node_map.hpp3
2 files changed, 5 insertions, 38 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 5ce201da2e..e55460fa29 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -106,8 +106,8 @@ ParseError)JS").ToLocalChecked()).ToLocalChecked();
Nan::SetPrototypeMethod(tpl, "addImage", AddImage);
Nan::SetPrototypeMethod(tpl, "removeImage", RemoveImage);
Nan::SetPrototypeMethod(tpl, "setLayerZoomRange", SetLayerZoomRange);
- Nan::SetPrototypeMethod(tpl, "setLayoutProperty", SetLayoutProperty);
- Nan::SetPrototypeMethod(tpl, "setPaintProperty", SetPaintProperty);
+ Nan::SetPrototypeMethod(tpl, "setLayoutProperty", SetLayerProperty);
+ Nan::SetPrototypeMethod(tpl, "setPaintProperty", SetLayerProperty);
Nan::SetPrototypeMethod(tpl, "setFilter", SetFilter);
Nan::SetPrototypeMethod(tpl, "setCenter", SetCenter);
Nan::SetPrototypeMethod(tpl, "setZoom", SetZoom);
@@ -850,7 +850,7 @@ void NodeMap::SetLayerZoomRange(const Nan::FunctionCallbackInfo<v8::Value>& info
layer->setMaxZoom(info[2]->NumberValue());
}
-void NodeMap::SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+void NodeMap::SetLayerProperty(const Nan::FunctionCallbackInfo<v8::Value>& info) {
using namespace mbgl::style;
using namespace mbgl::style::conversion;
@@ -874,39 +874,7 @@ void NodeMap::SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>& info
return Nan::ThrowTypeError("Second argument must be a string");
}
- mbgl::optional<Error> error = layer->setLayoutProperty(*Nan::Utf8String(info[1]), Convertible(info[2]));
- if (error) {
- return Nan::ThrowTypeError(error->message.c_str());
- }
-
- info.GetReturnValue().SetUndefined();
-}
-
-void NodeMap::SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- 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() < 3) {
- return Nan::ThrowTypeError("Three arguments required");
- }
-
- if (!info[0]->IsString()) {
- return Nan::ThrowTypeError("First argument must be a string");
- }
-
- mbgl::style::Layer* layer = nodeMap->map->getStyle().getLayer(*Nan::Utf8String(info[0]));
- if (!layer) {
- return Nan::ThrowTypeError("layer not found");
- }
-
- if (!info[1]->IsString()) {
- return Nan::ThrowTypeError("Second argument must be a string");
- }
-
- mbgl::optional<Error> error = layer->setPaintProperty(*Nan::Utf8String(info[1]), Convertible(info[2]));
+ mbgl::optional<Error> error = layer->setProperty(*Nan::Utf8String(info[1]), Convertible(info[2]));
if (error) {
return Nan::ThrowTypeError(error->message.c_str());
}
diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp
index 381e10381b..aa440d2323 100644
--- a/platform/node/src/node_map.hpp
+++ b/platform/node/src/node_map.hpp
@@ -50,8 +50,7 @@ public:
static void AddImage(const Nan::FunctionCallbackInfo<v8::Value>&);
static void RemoveImage(const Nan::FunctionCallbackInfo<v8::Value>&);
static void SetLayerZoomRange(const Nan::FunctionCallbackInfo<v8::Value>&);
- static void SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>&);
- static void SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>&);
+ static void SetLayerProperty(const Nan::FunctionCallbackInfo<v8::Value>&);
static void SetFilter(const Nan::FunctionCallbackInfo<v8::Value>&);
static void SetCenter(const Nan::FunctionCallbackInfo<v8::Value>&);
static void SetZoom(const Nan::FunctionCallbackInfo<v8::Value>&);