diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-07 18:34:45 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-29 16:18:41 +0200 |
commit | a6d8742e637a53eea90c2d0da049e684804928d3 (patch) | |
tree | 132a089ef42b4cc4e1b93b109b0a46850ddbde7e /src/mbgl/style/layers/symbol_layer.cpp | |
parent | 4adfc5d3237bbca5c07898104267b17309f24ff3 (diff) | |
download | qtlocation-mapboxgl-a6d8742e637a53eea90c2d0da049e684804928d3.tar.gz |
[core] Enable text-variable-anchor property
Diffstat (limited to 'src/mbgl/style/layers/symbol_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index 75ed881058..2195f703d7 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -492,6 +492,22 @@ void SymbolLayer::setTextJustify(PropertyValue<TextJustifyType> value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } +PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getDefaultTextVariableAnchor() { + return TextVariableAnchor::defaultValue(); +} + +PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getTextVariableAnchor() const { + return impl().layout.get<TextVariableAnchor>(); +} + +void SymbolLayer::setTextVariableAnchor(PropertyValue<std::vector<TextVariableAnchorType>> value) { + if (value == getTextVariableAnchor()) + return; + auto impl_ = mutableImpl(); + impl_->layout.get<TextVariableAnchor>() = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} PropertyValue<SymbolAnchorType> SymbolLayer::getDefaultTextAnchor() { return TextAnchor::defaultValue(); } @@ -1325,6 +1341,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co TextLineHeight, TextLetterSpacing, TextJustify, + TextVariableAnchor, TextAnchor, TextMaxAngle, TextRotate, @@ -1364,6 +1381,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co { "text-line-height", static_cast<uint8_t>(Property::TextLineHeight) }, { "text-letter-spacing", static_cast<uint8_t>(Property::TextLetterSpacing) }, { "text-justify", static_cast<uint8_t>(Property::TextJustify) }, + { "text-variable-anchor", static_cast<uint8_t>(Property::TextVariableAnchor) }, { "text-anchor", static_cast<uint8_t>(Property::TextAnchor) }, { "text-max-angle", static_cast<uint8_t>(Property::TextMaxAngle) }, { "text-rotate", static_cast<uint8_t>(Property::TextRotate) }, @@ -1674,6 +1692,18 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } + if (property == Property::TextVariableAnchor) { + Error error; + optional<PropertyValue<std::vector<TextVariableAnchorType>>> typedValue = convert<PropertyValue<std::vector<TextVariableAnchorType>>>(value, error, false, false); + if (!typedValue) { + return error; + } + + setTextVariableAnchor(*typedValue); + return nullopt; + + } + if (property == Property::TextTransform) { Error error; optional<PropertyValue<TextTransformType>> typedValue = convert<PropertyValue<TextTransformType>>(value, error, true, false); |