diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-07 18:52:00 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-29 16:18:41 +0200 |
commit | 2b9a52f5e4cfd1a90c96b307ea218c720df10436 (patch) | |
tree | e38d567a8e6738673af617673a4465e59eba2c09 /src | |
parent | a6d8742e637a53eea90c2d0da049e684804928d3 (diff) | |
download | qtlocation-mapboxgl-2b9a52f5e4cfd1a90c96b307ea218c720df10436.tar.gz |
[core] Enable 'text-radial-offset' property
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 25 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_properties.hpp | 6 |
2 files changed, 30 insertions, 1 deletions
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index 2195f703d7..1c56888f73 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<float> SymbolLayer::getDefaultTextRadialOffset() { + return TextRadialOffset::defaultValue(); +} + +PropertyValue<float> SymbolLayer::getTextRadialOffset() const { + return impl().layout.get<TextRadialOffset>(); +} + +void SymbolLayer::setTextRadialOffset(PropertyValue<float> value) { + if (value == getTextRadialOffset()) + return; + auto impl_ = mutableImpl(); + impl_->layout.get<TextRadialOffset>() = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} PropertyValue<std::vector<TextVariableAnchorType>> SymbolLayer::getDefaultTextVariableAnchor() { return TextVariableAnchor::defaultValue(); } @@ -1341,6 +1357,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co TextLineHeight, TextLetterSpacing, TextJustify, + TextRadialOffset, TextVariableAnchor, TextAnchor, TextMaxAngle, @@ -1381,6 +1398,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-radial-offset", static_cast<uint8_t>(Property::TextRadialOffset) }, { "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) }, @@ -1543,7 +1561,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } - if (property == Property::IconSize || property == Property::IconRotate || property == Property::TextSize || property == Property::TextMaxWidth || property == Property::TextLetterSpacing || property == Property::TextRotate) { + if (property == Property::IconSize || property == Property::IconRotate || property == Property::TextSize || property == Property::TextMaxWidth || property == Property::TextLetterSpacing || property == Property::TextRadialOffset || property == Property::TextRotate) { Error error; optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { @@ -1575,6 +1593,11 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co return nullopt; } + if (property == Property::TextRadialOffset) { + setTextRadialOffset(*typedValue); + return nullopt; + } + if (property == Property::TextRotate) { setTextRotate(*typedValue); return nullopt; diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index 8ccad4efec..cf8a9ab0d0 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -147,6 +147,11 @@ struct TextJustify : DataDrivenLayoutProperty<TextJustifyType> { static TextJustifyType defaultValue() { return TextJustifyType::Center; } }; +struct TextRadialOffset : DataDrivenLayoutProperty<float> { + static constexpr const char *name() { return "text-radial-offset"; } + static float defaultValue() { return 0; } +}; + struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> { static constexpr const char *name() { return "text-variable-anchor"; } static std::vector<TextVariableAnchorType> defaultValue() { return { }; } @@ -289,6 +294,7 @@ class SymbolLayoutProperties : public Properties< TextLineHeight, TextLetterSpacing, TextJustify, + TextRadialOffset, TextVariableAnchor, TextAnchor, TextMaxAngle, |