summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers')
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp32
-rw-r--r--src/mbgl/style/layers/symbol_layer_properties.hpp8
2 files changed, 38 insertions, 2 deletions
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index 6748fbd4aa..4b335ead3c 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -701,6 +701,22 @@ void SymbolLayer::setTextVariableAnchor(const PropertyValue<std::vector<TextVari
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
+PropertyValue<std::vector<TextWritingModeType>> SymbolLayer::getDefaultTextWritingMode() {
+ return TextWritingMode::defaultValue();
+}
+
+const PropertyValue<std::vector<TextWritingModeType>>& SymbolLayer::getTextWritingMode() const {
+ return impl().layout.get<TextWritingMode>();
+}
+
+void SymbolLayer::setTextWritingMode(const PropertyValue<std::vector<TextWritingModeType>>& value) {
+ if (value == getTextWritingMode())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->layout.get<TextWritingMode>() = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
// Paint properties
@@ -1387,6 +1403,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co
TextSize,
TextTransform,
TextVariableAnchor,
+ TextWritingMode,
};
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
{ "icon-allow-overlap", static_cast<uint8_t>(Property::IconAllowOverlap) },
@@ -1428,7 +1445,8 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co
{ "text-rotation-alignment", static_cast<uint8_t>(Property::TextRotationAlignment) },
{ "text-size", static_cast<uint8_t>(Property::TextSize) },
{ "text-transform", static_cast<uint8_t>(Property::TextTransform) },
- { "text-variable-anchor", static_cast<uint8_t>(Property::TextVariableAnchor) }
+ { "text-variable-anchor", static_cast<uint8_t>(Property::TextVariableAnchor) },
+ { "text-writing-mode", static_cast<uint8_t>(Property::TextWritingMode) }
});
const auto it = properties.find(name.c_str());
@@ -1763,6 +1781,18 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co
}
+ if (property == Property::TextWritingMode) {
+ Error error;
+ optional<PropertyValue<std::vector<TextWritingModeType>>> typedValue = convert<PropertyValue<std::vector<TextWritingModeType>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextWritingMode(*typedValue);
+ return nullopt;
+
+ }
+
return Error { "layer doesn't support this property" };
}
diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp
index 0c2bcd2661..59d65b3c86 100644
--- a/src/mbgl/style/layers/symbol_layer_properties.hpp
+++ b/src/mbgl/style/layers/symbol_layer_properties.hpp
@@ -214,6 +214,11 @@ struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>>
static std::vector<TextVariableAnchorType> defaultValue() { return { }; }
};
+struct TextWritingMode : LayoutProperty<std::vector<TextWritingModeType>> {
+ static constexpr const char *name() { return "text-writing-mode"; }
+ static std::vector<TextWritingModeType> defaultValue() { return { }; }
+};
+
struct IconColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color> {
static Color defaultValue() { return Color::black(); }
};
@@ -313,7 +318,8 @@ class SymbolLayoutProperties : public Properties<
TextRotationAlignment,
TextSize,
TextTransform,
- TextVariableAnchor
+ TextVariableAnchor,
+ TextWritingMode
> {};
class SymbolPaintProperties : public Properties<