summaryrefslogtreecommitdiff
path: root/src/mbgl/style/conversion/layer.cpp
diff options
context:
space:
mode:
authorMolly Lloyd <mollymerp@users.noreply.github.com>2018-01-23 10:49:23 -0800
committerGitHub <noreply@github.com>2018-01-23 10:49:23 -0800
commitf3294200c6c866e5ab031ad8346c59a76aa37249 (patch)
tree6d9aedb552552607641a15c415a60be99a0877d5 /src/mbgl/style/conversion/layer.cpp
parent2d15aed43c9faa875a8f625c3afc286f1175e0ce (diff)
downloadqtlocation-mapboxgl-f3294200c6c866e5ab031ad8346c59a76aa37249.tar.gz
[core] add raster-dem source type and hillshade layer type (#10642)
Diffstat (limited to 'src/mbgl/style/conversion/layer.cpp')
-rw-r--r--src/mbgl/style/conversion/layer.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mbgl/style/conversion/layer.cpp b/src/mbgl/style/conversion/layer.cpp
index 0ca582f8dc..8f624e3324 100644
--- a/src/mbgl/style/conversion/layer.cpp
+++ b/src/mbgl/style/conversion/layer.cpp
@@ -6,6 +6,7 @@
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
+#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
@@ -96,6 +97,23 @@ static optional<std::unique_ptr<Layer>> convertRasterLayer(const std::string& id
return { std::make_unique<RasterLayer>(id, *source) };
}
+static optional<std::unique_ptr<Layer>> convertHillshadeLayer(const std::string& id, const Convertible& value, Error& error) {
+ auto sourceValue = objectMember(value, "source");
+ if (!sourceValue) {
+ error = { "layer must have a source" };
+ return {};
+ }
+
+ optional<std::string> source = toString(*sourceValue);
+ if (!source) {
+ error = { "layer source must be a string" };
+ return {};
+ }
+
+ return { std::make_unique<HillshadeLayer>(id, *source) };
+}
+
+
static optional<std::unique_ptr<Layer>> convertBackgroundLayer(const std::string& id, const Convertible&, Error&) {
return { std::make_unique<BackgroundLayer>(id) };
}
@@ -144,6 +162,8 @@ optional<std::unique_ptr<Layer>> Converter<std::unique_ptr<Layer>>::operator()(c
converted = convertVectorLayer<SymbolLayer>(*id, value, error);
} else if (*type == "raster") {
converted = convertRasterLayer(*id, value, error);
+ } else if (*type == "hillshade") {
+ converted = convertHillshadeLayer(*id, value, error);
} else if (*type == "background") {
converted = convertBackgroundLayer(*id, value, error);
} else {