core: Update Hillshade Algorithms and add Color-Relief Layer support (#3965)
This commit is contained in:
@@ -121,6 +121,18 @@ public:
|
||||
return {Nan::To<std::int32_t>(value).ToChecked()};
|
||||
} else if (value->IsNumber()) {
|
||||
return {Nan::To<double>(value).ToChecked()};
|
||||
} else if (value->IsArray()) {
|
||||
v8::Local<v8::Array> array = value.As<v8::Array>();
|
||||
std::vector<Value> result;
|
||||
result.reserve(array->Length());
|
||||
for (uint32_t i = 0; i < array->Length(); ++i) {
|
||||
v8::Local<v8::Value> item = Nan::Get(array, i).ToLocalChecked();
|
||||
auto converted = toValue(item);
|
||||
if (converted) {
|
||||
result.push_back(*converted);
|
||||
}
|
||||
}
|
||||
return {result};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ type::Type parseType(v8::Local<v8::Object> type) {
|
||||
{"formatted", type::Formatted},
|
||||
{"number-format", type::String},
|
||||
{"resolvedImage", type::Image},
|
||||
{"variableAnchorOffsetCollection", type::VariableAnchorOffsetCollection}};
|
||||
{"variableAnchorOffsetCollection", type::VariableAnchorOffsetCollection},
|
||||
{"numberArray", type::Array(type::Number)},
|
||||
{"colorArray", type::Array(type::Color)}};
|
||||
|
||||
v8::Local<v8::Value> v8kind = Nan::Get(type, Nan::New("kind").ToLocalChecked()).ToLocalChecked();
|
||||
std::string kind(*v8::String::Utf8Value(v8::Isolate::GetCurrent(), v8kind));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
|
||||
#include <mbgl/style/layers/heatmap_layer.hpp>
|
||||
#include <mbgl/style/layers/hillshade_layer.hpp>
|
||||
#include <mbgl/style/layers/color_relief_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
|
||||
Reference in New Issue
Block a user