summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/conversion/layer.cpp20
-rw-r--r--src/mbgl/style/conversion/make_property_setters.hpp15
-rw-r--r--src/mbgl/style/conversion/source.cpp27
-rw-r--r--src/mbgl/style/expression/value.cpp4
-rw-r--r--src/mbgl/style/layers/hillshade_layer.cpp238
-rw-r--r--src/mbgl/style/layers/hillshade_layer_impl.cpp11
-rw-r--r--src/mbgl/style/layers/hillshade_layer_impl.hpp21
-rw-r--r--src/mbgl/style/layers/hillshade_layer_properties.cpp9
-rw-r--r--src/mbgl/style/layers/hillshade_layer_properties.hpp49
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs2
-rw-r--r--src/mbgl/style/sources/raster_dem_source.cpp19
-rw-r--r--src/mbgl/style/sources/raster_source.cpp4
-rw-r--r--src/mbgl/style/sources/raster_source_impl.cpp4
-rw-r--r--src/mbgl/style/sources/raster_source_impl.hpp2
-rw-r--r--src/mbgl/style/style_impl.cpp1
-rw-r--r--src/mbgl/style/types.cpp5
16 files changed, 424 insertions, 7 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 {
diff --git a/src/mbgl/style/conversion/make_property_setters.hpp b/src/mbgl/style/conversion/make_property_setters.hpp
index 18370df636..adfcc4dd61 100644
--- a/src/mbgl/style/conversion/make_property_setters.hpp
+++ b/src/mbgl/style/conversion/make_property_setters.hpp
@@ -10,6 +10,7 @@
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <unordered_map>
@@ -70,6 +71,7 @@ inline auto makeLayoutPropertySetters() {
+
return result;
}
@@ -194,6 +196,19 @@ inline auto makePaintPropertySetters() {
result["raster-fade-duration"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterFadeDuration>;
result["raster-fade-duration-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterFadeDurationTransition>;
+ result["hillshade-illumination-direction"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeIlluminationDirection>;
+ result["hillshade-illumination-direction-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationDirectionTransition>;
+ result["hillshade-illumination-anchor"] = &setProperty<HillshadeLayer, PropertyValue<HillshadeIlluminationAnchorType>, &HillshadeLayer::setHillshadeIlluminationAnchor>;
+ result["hillshade-illumination-anchor-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationAnchorTransition>;
+ result["hillshade-exaggeration"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeExaggeration>;
+ result["hillshade-exaggeration-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeExaggerationTransition>;
+ result["hillshade-shadow-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeShadowColor>;
+ result["hillshade-shadow-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeShadowColorTransition>;
+ result["hillshade-highlight-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeHighlightColor>;
+ result["hillshade-highlight-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeHighlightColorTransition>;
+ result["hillshade-accent-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeAccentColor>;
+ result["hillshade-accent-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeAccentColorTransition>;
+
result["background-color"] = &setProperty<BackgroundLayer, PropertyValue<Color>, &BackgroundLayer::setBackgroundColor>;
result["background-color-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundColorTransition>;
result["background-pattern"] = &setProperty<BackgroundLayer, PropertyValue<std::string>, &BackgroundLayer::setBackgroundPattern>;
diff --git a/src/mbgl/style/conversion/source.cpp b/src/mbgl/style/conversion/source.cpp
index c10d0babcf..670f50c041 100644
--- a/src/mbgl/style/conversion/source.cpp
+++ b/src/mbgl/style/conversion/source.cpp
@@ -5,6 +5,7 @@
#include <mbgl/style/conversion/tileset.hpp>
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/style/sources/raster_source.hpp>
+#include <mbgl/style/sources/raster_dem_source.hpp>
#include <mbgl/style/sources/vector_source.hpp>
#include <mbgl/style/sources/image_source.hpp>
#include <mbgl/util/geo.hpp>
@@ -55,6 +56,28 @@ static optional<std::unique_ptr<Source>> convertRasterSource(const std::string&
return { std::make_unique<RasterSource>(id, std::move(*urlOrTileset), tileSize) };
}
+static optional<std::unique_ptr<Source>> convertRasterDEMSource(const std::string& id,
+ const Convertible& value,
+ Error& error) {
+ optional<variant<std::string, Tileset>> urlOrTileset = convertURLOrTileset(value, error);
+ if (!urlOrTileset) {
+ return {};
+ }
+
+ uint16_t tileSize = util::tileSize;
+ auto tileSizeValue = objectMember(value, "tileSize");
+ if (tileSizeValue) {
+ optional<float> size = toNumber(*tileSizeValue);
+ if (!size || *size < 0 || *size > std::numeric_limits<uint16_t>::max()) {
+ error = { "invalid tileSize" };
+ return {};
+ }
+ tileSize = *size;
+ }
+
+ return { std::make_unique<RasterDEMSource>(id, std::move(*urlOrTileset), tileSize) };
+}
+
static optional<std::unique_ptr<Source>> convertVectorSource(const std::string& id,
const Convertible& value,
Error& error) {
@@ -155,9 +178,11 @@ optional<std::unique_ptr<Source>> Converter<std::unique_ptr<Source>>::operator()
error = { "source type must be a string" };
return {};
}
-
+ const std::string tname = *type;
if (*type == "raster") {
return convertRasterSource(id, value, error);
+ } else if (*type == "raster-dem") {
+ return convertRasterDEMSource(id, value, error);
} else if (*type == "vector") {
return convertVectorSource(id, value, error);
} else if (*type == "geojson") {
diff --git a/src/mbgl/style/expression/value.cpp b/src/mbgl/style/expression/value.cpp
index ef4769df02..faa44e78aa 100644
--- a/src/mbgl/style/expression/value.cpp
+++ b/src/mbgl/style/expression/value.cpp
@@ -305,6 +305,10 @@ template type::Type valueTypeToExpressionType<TranslateAnchorType>();
template optional<TranslateAnchorType> fromExpressionValue<TranslateAnchorType>(const Value&);
template Value toExpressionValue(const TranslateAnchorType&);
+template type::Type valueTypeToExpressionType<HillshadeIlluminationAnchorType>();
+template optional<HillshadeIlluminationAnchorType> fromExpressionValue<HillshadeIlluminationAnchorType>(const Value&);
+template Value toExpressionValue(const HillshadeIlluminationAnchorType&);
+
template type::Type valueTypeToExpressionType<LightAnchorType>();
template optional<LightAnchorType> fromExpressionValue<LightAnchorType>(const Value&);
template Value toExpressionValue(const LightAnchorType&);
diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp
new file mode 100644
index 0000000000..ea736af1ad
--- /dev/null
+++ b/src/mbgl/style/layers/hillshade_layer.cpp
@@ -0,0 +1,238 @@
+// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
+
+#include <mbgl/style/layers/hillshade_layer.hpp>
+#include <mbgl/style/layers/hillshade_layer_impl.hpp>
+#include <mbgl/style/layer_observer.hpp>
+
+namespace mbgl {
+namespace style {
+
+HillshadeLayer::HillshadeLayer(const std::string& layerID, const std::string& sourceID)
+ : Layer(makeMutable<Impl>(LayerType::Hillshade, layerID, sourceID)) {
+}
+
+HillshadeLayer::HillshadeLayer(Immutable<Impl> impl_)
+ : Layer(std::move(impl_)) {
+}
+
+HillshadeLayer::~HillshadeLayer() = default;
+
+const HillshadeLayer::Impl& HillshadeLayer::impl() const {
+ return static_cast<const Impl&>(*baseImpl);
+}
+
+Mutable<HillshadeLayer::Impl> HillshadeLayer::mutableImpl() const {
+ return makeMutable<Impl>(impl());
+}
+
+std::unique_ptr<Layer> HillshadeLayer::cloneRef(const std::string& id_) const {
+ auto impl_ = mutableImpl();
+ impl_->id = id_;
+ impl_->paint = HillshadePaintProperties::Transitionable();
+ return std::make_unique<HillshadeLayer>(std::move(impl_));
+}
+
+void HillshadeLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
+}
+
+// Source
+
+const std::string& HillshadeLayer::getSourceID() const {
+ return impl().source;
+}
+
+
+// Visibility
+
+void HillshadeLayer::setVisibility(VisibilityType value) {
+ if (value == getVisibility())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->visibility = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+// Zoom range
+
+void HillshadeLayer::setMinZoom(float minZoom) {
+ auto impl_ = mutableImpl();
+ impl_->minZoom = minZoom;
+ baseImpl = std::move(impl_);
+}
+
+void HillshadeLayer::setMaxZoom(float maxZoom) {
+ auto impl_ = mutableImpl();
+ impl_->maxZoom = maxZoom;
+ baseImpl = std::move(impl_);
+}
+
+// Layout properties
+
+
+// Paint properties
+
+PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() {
+ return { 335 };
+}
+
+PropertyValue<float> HillshadeLayer::getHillshadeIlluminationDirection() const {
+ return impl().paint.template get<HillshadeIlluminationDirection>().value;
+}
+
+void HillshadeLayer::setHillshadeIlluminationDirection(PropertyValue<float> value) {
+ if (value == getHillshadeIlluminationDirection())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeIlluminationDirection>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeIlluminationDirection>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const {
+ return impl().paint.template get<HillshadeIlluminationDirection>().options;
+}
+
+PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() {
+ return { HillshadeIlluminationAnchorType::Viewport };
+}
+
+PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getHillshadeIlluminationAnchor() const {
+ return impl().paint.template get<HillshadeIlluminationAnchor>().value;
+}
+
+void HillshadeLayer::setHillshadeIlluminationAnchor(PropertyValue<HillshadeIlluminationAnchorType> value) {
+ if (value == getHillshadeIlluminationAnchor())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeIlluminationAnchor>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeIlluminationAnchor>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const {
+ return impl().paint.template get<HillshadeIlluminationAnchor>().options;
+}
+
+PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() {
+ return { 0.5 };
+}
+
+PropertyValue<float> HillshadeLayer::getHillshadeExaggeration() const {
+ return impl().paint.template get<HillshadeExaggeration>().value;
+}
+
+void HillshadeLayer::setHillshadeExaggeration(PropertyValue<float> value) {
+ if (value == getHillshadeExaggeration())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeExaggeration>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeExaggerationTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeExaggeration>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const {
+ return impl().paint.template get<HillshadeExaggeration>().options;
+}
+
+PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() {
+ return { Color::black() };
+}
+
+PropertyValue<Color> HillshadeLayer::getHillshadeShadowColor() const {
+ return impl().paint.template get<HillshadeShadowColor>().value;
+}
+
+void HillshadeLayer::setHillshadeShadowColor(PropertyValue<Color> value) {
+ if (value == getHillshadeShadowColor())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeShadowColor>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeShadowColor>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const {
+ return impl().paint.template get<HillshadeShadowColor>().options;
+}
+
+PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() {
+ return { Color::white() };
+}
+
+PropertyValue<Color> HillshadeLayer::getHillshadeHighlightColor() const {
+ return impl().paint.template get<HillshadeHighlightColor>().value;
+}
+
+void HillshadeLayer::setHillshadeHighlightColor(PropertyValue<Color> value) {
+ if (value == getHillshadeHighlightColor())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeHighlightColor>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeHighlightColorTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeHighlightColor>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const {
+ return impl().paint.template get<HillshadeHighlightColor>().options;
+}
+
+PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() {
+ return { Color::black() };
+}
+
+PropertyValue<Color> HillshadeLayer::getHillshadeAccentColor() const {
+ return impl().paint.template get<HillshadeAccentColor>().value;
+}
+
+void HillshadeLayer::setHillshadeAccentColor(PropertyValue<Color> value) {
+ if (value == getHillshadeAccentColor())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeAccentColor>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<HillshadeAccentColor>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const {
+ return impl().paint.template get<HillshadeAccentColor>().options;
+}
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/layers/hillshade_layer_impl.cpp b/src/mbgl/style/layers/hillshade_layer_impl.cpp
new file mode 100644
index 0000000000..ed5aa922bf
--- /dev/null
+++ b/src/mbgl/style/layers/hillshade_layer_impl.cpp
@@ -0,0 +1,11 @@
+#include <mbgl/style/layers/hillshade_layer_impl.hpp>
+
+namespace mbgl {
+namespace style {
+
+bool HillshadeLayer::Impl::hasLayoutDifference(const Layer::Impl&) const {
+ return false;
+}
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/layers/hillshade_layer_impl.hpp b/src/mbgl/style/layers/hillshade_layer_impl.hpp
new file mode 100644
index 0000000000..5618b7dfe2
--- /dev/null
+++ b/src/mbgl/style/layers/hillshade_layer_impl.hpp
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/hillshade_layer.hpp>
+#include <mbgl/style/layers/hillshade_layer_properties.hpp>
+
+namespace mbgl {
+namespace style {
+
+class HillshadeLayer::Impl : public Layer::Impl {
+public:
+ using Layer::Impl::Impl;
+
+ bool hasLayoutDifference(const Layer::Impl&) const override;
+ void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override;
+
+ HillshadePaintProperties::Transitionable paint;
+};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/layers/hillshade_layer_properties.cpp b/src/mbgl/style/layers/hillshade_layer_properties.cpp
new file mode 100644
index 0000000000..f296ab4520
--- /dev/null
+++ b/src/mbgl/style/layers/hillshade_layer_properties.cpp
@@ -0,0 +1,9 @@
+// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
+
+#include <mbgl/style/layers/hillshade_layer_properties.hpp>
+
+namespace mbgl {
+namespace style {
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/layers/hillshade_layer_properties.hpp b/src/mbgl/style/layers/hillshade_layer_properties.hpp
new file mode 100644
index 0000000000..260d7ea808
--- /dev/null
+++ b/src/mbgl/style/layers/hillshade_layer_properties.hpp
@@ -0,0 +1,49 @@
+// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
+
+#pragma once
+
+#include <mbgl/style/types.hpp>
+#include <mbgl/style/layout_property.hpp>
+#include <mbgl/style/paint_property.hpp>
+#include <mbgl/style/properties.hpp>
+#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
+
+namespace mbgl {
+namespace style {
+
+struct HillshadeIlluminationDirection : PaintProperty<float> {
+ static float defaultValue() { return 335; }
+};
+
+struct HillshadeIlluminationAnchor : PaintProperty<HillshadeIlluminationAnchorType> {
+ static HillshadeIlluminationAnchorType defaultValue() { return HillshadeIlluminationAnchorType::Viewport; }
+};
+
+struct HillshadeExaggeration : PaintProperty<float> {
+ static float defaultValue() { return 0.5; }
+};
+
+struct HillshadeShadowColor : PaintProperty<Color> {
+ static Color defaultValue() { return Color::black(); }
+};
+
+struct HillshadeHighlightColor : PaintProperty<Color> {
+ static Color defaultValue() { return Color::white(); }
+};
+
+struct HillshadeAccentColor : PaintProperty<Color> {
+ static Color defaultValue() { return Color::black(); }
+};
+
+class HillshadePaintProperties : public Properties<
+ HillshadeIlluminationDirection,
+ HillshadeIlluminationAnchor,
+ HillshadeExaggeration,
+ HillshadeShadowColor,
+ HillshadeHighlightColor,
+ HillshadeAccentColor
+> {};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index 573aabda8b..be44bb353d 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -59,7 +59,7 @@ const std::string& <%- camelize(type) %>Layer::getSourceID() const {
return impl().source;
}
-<% if (type !== 'raster') { -%>
+<% if (type !== 'raster' && type !== 'hillshade') { -%>
void <%- camelize(type) %>Layer::setSourceLayer(const std::string& sourceLayer) {
auto impl_ = mutableImpl();
impl_->sourceLayer = sourceLayer;
diff --git a/src/mbgl/style/sources/raster_dem_source.cpp b/src/mbgl/style/sources/raster_dem_source.cpp
new file mode 100644
index 0000000000..dc9feb8eeb
--- /dev/null
+++ b/src/mbgl/style/sources/raster_dem_source.cpp
@@ -0,0 +1,19 @@
+#include <mbgl/style/sources/raster_dem_source.hpp>
+#include <mbgl/style/sources/raster_source_impl.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion/tileset.hpp>
+#include <mbgl/storage/file_source.hpp>
+#include <mbgl/util/mapbox.hpp>
+
+namespace mbgl {
+namespace style {
+
+RasterDEMSource::RasterDEMSource(std::string id, variant<std::string, Tileset> urlOrTileset_, uint16_t tileSize)
+ : RasterSource(std::move(id), urlOrTileset_, tileSize, SourceType::RasterDEM){
+}
+
+
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp
index 0a0412a4ed..53f29d660b 100644
--- a/src/mbgl/style/sources/raster_source.cpp
+++ b/src/mbgl/style/sources/raster_source.cpp
@@ -9,8 +9,8 @@
namespace mbgl {
namespace style {
-RasterSource::RasterSource(std::string id, variant<std::string, Tileset> urlOrTileset_, uint16_t tileSize)
- : Source(makeMutable<Impl>(std::move(id), tileSize)),
+RasterSource::RasterSource(std::string id, variant<std::string, Tileset> urlOrTileset_, uint16_t tileSize, SourceType sourceType)
+ : Source(makeMutable<Impl>(sourceType, std::move(id), tileSize)),
urlOrTileset(std::move(urlOrTileset_)) {
}
diff --git a/src/mbgl/style/sources/raster_source_impl.cpp b/src/mbgl/style/sources/raster_source_impl.cpp
index 50dae1f07e..4db25aafd1 100644
--- a/src/mbgl/style/sources/raster_source_impl.cpp
+++ b/src/mbgl/style/sources/raster_source_impl.cpp
@@ -3,8 +3,8 @@
namespace mbgl {
namespace style {
-RasterSource::Impl::Impl(std::string id_, uint16_t tileSize_)
- : Source::Impl(SourceType::Raster, std::move(id_)),
+RasterSource::Impl::Impl(SourceType sourceType, std::string id_, uint16_t tileSize_)
+ : Source::Impl(sourceType, std::move(id_)),
tileSize(tileSize_) {
}
diff --git a/src/mbgl/style/sources/raster_source_impl.hpp b/src/mbgl/style/sources/raster_source_impl.hpp
index c41d5485b2..96f59a2159 100644
--- a/src/mbgl/style/sources/raster_source_impl.hpp
+++ b/src/mbgl/style/sources/raster_source_impl.hpp
@@ -8,7 +8,7 @@ namespace style {
class RasterSource::Impl : public Source::Impl {
public:
- Impl(std::string id, uint16_t tileSize);
+ Impl(SourceType sourceType, std::string id, uint16_t tileSize);
Impl(const Impl&, Tileset);
optional<Tileset> getTileset() const;
diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp
index 3214c6316e..f2a9c0f222 100644
--- a/src/mbgl/style/style_impl.cpp
+++ b/src/mbgl/style/style_impl.cpp
@@ -9,6 +9,7 @@
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layer_impl.hpp>
#include <mbgl/style/parser.hpp>
#include <mbgl/style/transition_options.hpp>
diff --git a/src/mbgl/style/types.cpp b/src/mbgl/style/types.cpp
index cd5e597fc0..bdfa20a047 100644
--- a/src/mbgl/style/types.cpp
+++ b/src/mbgl/style/types.cpp
@@ -25,6 +25,11 @@ MBGL_DEFINE_ENUM(TranslateAnchorType, {
{ TranslateAnchorType::Viewport, "viewport" },
});
+MBGL_DEFINE_ENUM(HillshadeIlluminationAnchorType, {
+ { HillshadeIlluminationAnchorType::Map, "map" },
+ { HillshadeIlluminationAnchorType::Viewport, "viewport" },
+});
+
MBGL_DEFINE_ENUM(RotateAnchorType, {
{ RotateAnchorType::Map, "map" },
{ RotateAnchorType::Viewport, "viewport" },