summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/hillshade_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/hillshade_layer.cpp')
-rw-r--r--src/mbgl/style/layers/hillshade_layer.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp
index 28a3d903da..a55c079c49 100644
--- a/src/mbgl/style/layers/hillshade_layer.cpp
+++ b/src/mbgl/style/layers/hillshade_layer.cpp
@@ -1,5 +1,3 @@
-// clang-format off
-
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
#include <mbgl/style/layers/hillshade_layer.hpp>
@@ -251,7 +249,7 @@ constexpr uint8_t toUint8(T t) noexcept {
return uint8_t(mbgl::underlying_type(t));
}
-MAPBOX_ETERNAL_CONSTEXPR const auto paintProperties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>(
+MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>(
{{"hillshade-accent-color", toUint8(Property::HillshadeAccentColor)},
{"hillshade-exaggeration", toUint8(Property::HillshadeExaggeration)},
{"hillshade-highlight-color", toUint8(Property::HillshadeHighlightColor)},
@@ -265,11 +263,12 @@ MAPBOX_ETERNAL_CONSTEXPR const auto paintProperties = mapbox::eternal::hash_map<
{"hillshade-illumination-direction-transition", toUint8(Property::HillshadeIlluminationDirectionTransition)},
{"hillshade-shadow-color-transition", toUint8(Property::HillshadeShadowColorTransition)}});
+constexpr uint8_t lastPaintPropertyIndex = toUint8(Property::HillshadeShadowColorTransition);
} // namespace
optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const Convertible& value) {
- const auto it = paintProperties.find(name.c_str());
- if (it == paintProperties.end()) {
+ const auto it = layerProperties.find(name.c_str());
+ if (it == layerProperties.end() || it->second > lastPaintPropertyIndex) {
return Error{"layer doesn't support this property"};
}
@@ -372,8 +371,8 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
}
StyleProperty HillshadeLayer::getProperty(const std::string& name) const {
- const auto it = paintProperties.find(name.c_str());
- if (it == paintProperties.end()) {
+ const auto it = layerProperties.find(name.c_str());
+ if (it == layerProperties.end()) {
return {};
}
@@ -420,5 +419,3 @@ Mutable<Layer::Impl> HillshadeLayer::mutableBaseImpl() const {
} // namespace style
} // namespace mbgl
-
-// clang-format on