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/fill_layer.cpp | |
parent | f3146e43cd19bdf85957d6d62132ac7c31eacc50 (diff) | |
download | qtlocation-mapboxgl-5304bbc438afd60853c97d74cd38f04a50effa06.tar.gz |
[core] Layer::getProperty supports layout properties
Diffstat (limited to 'src/mbgl/style/layers/fill_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/fill_layer.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp index 6b4b15f83f..e3d6c6c708 100644 --- a/src/mbgl/style/layers/fill_layer.cpp +++ b/src/mbgl/style/layers/fill_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/fill_layer.hpp> @@ -280,7 +278,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>( {{"fill-antialias", toUint8(Property::FillAntialias)}, {"fill-color", toUint8(Property::FillColor)}, {"fill-opacity", toUint8(Property::FillOpacity)}, @@ -296,11 +294,12 @@ MAPBOX_ETERNAL_CONSTEXPR const auto paintProperties = mapbox::eternal::hash_map< {"fill-translate-transition", toUint8(Property::FillTranslateTransition)}, {"fill-translate-anchor-transition", toUint8(Property::FillTranslateAnchorTransition)}}); +constexpr uint8_t lastPaintPropertyIndex = toUint8(Property::FillTranslateAnchorTransition); } // namespace optional<Error> FillLayer::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"}; } @@ -432,8 +431,8 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve } StyleProperty FillLayer::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 {}; } @@ -484,5 +483,3 @@ Mutable<Layer::Impl> FillLayer::mutableBaseImpl() const { } // namespace style } // namespace mbgl - -// clang-format on |