diff options
Diffstat (limited to 'src/mbgl/style/layers')
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer.cpp | 238 | ||||
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer_impl.cpp | 11 | ||||
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer_impl.hpp | 21 | ||||
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer_properties.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer_properties.hpp | 49 | ||||
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 2 |
6 files changed, 329 insertions, 1 deletions
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; |