diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-26 17:58:58 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-09-27 13:08:53 +0300 |
commit | 5304bbc438afd60853c97d74cd38f04a50effa06 (patch) | |
tree | 916119557766873a5a83baf8068b8b9bb9e5e0a6 /src/mbgl/style/layers/hillshade_layer.cpp | |
parent | f3146e43cd19bdf85957d6d62132ac7c31eacc50 (diff) | |
download | qtlocation-mapboxgl-5304bbc438afd60853c97d74cd38f04a50effa06.tar.gz |
[core] Layer::getProperty supports layout properties
Diffstat (limited to 'src/mbgl/style/layers/hillshade_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/hillshade_layer.cpp | 15 |
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 |