summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/symbol_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/symbol_layer.cpp')
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp30
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);