diff options
Diffstat (limited to 'src/mbgl/style/layers/symbol_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/symbol_layer.cpp | 103 |
1 files changed, 63 insertions, 40 deletions
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp index c8d7816180..0284ba0d3c 100644 --- a/src/mbgl/style/layers/symbol_layer.cpp +++ b/src/mbgl/style/layers/symbol_layer.cpp @@ -108,6 +108,22 @@ void SymbolLayer::setSymbolAvoidEdges(const PropertyValue<bool>& value) { baseImpl = std::move(impl_); observer->onLayerChanged(*this); } +PropertyValue<float> SymbolLayer::getDefaultSymbolSortKey() { + return SymbolSortKey::defaultValue(); +} + +const PropertyValue<float>& SymbolLayer::getSymbolSortKey() const { + return impl().layout.get<SymbolSortKey>(); +} + +void SymbolLayer::setSymbolSortKey(const PropertyValue<float>& value) { + if (value == getSymbolSortKey()) + return; + auto impl_ = mutableImpl(); + impl_->layout.get<SymbolSortKey>() = value; + baseImpl = std::move(impl_); + observer->onLayerChanged(*this); +} PropertyValue<SymbolZOrderType> SymbolLayer::getDefaultSymbolZOrder() { return SymbolZOrder::defaultValue(); } @@ -1333,6 +1349,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co SymbolPlacement, SymbolSpacing, SymbolAvoidEdges, + SymbolSortKey, SymbolZOrder, IconAllowOverlap, IconIgnorePlacement, @@ -1374,6 +1391,7 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co { "symbol-placement", static_cast<uint8_t>(Property::SymbolPlacement) }, { "symbol-spacing", static_cast<uint8_t>(Property::SymbolSpacing) }, { "symbol-avoid-edges", static_cast<uint8_t>(Property::SymbolAvoidEdges) }, + { "symbol-sort-key", static_cast<uint8_t>(Property::SymbolSortKey) }, { "symbol-z-order", static_cast<uint8_t>(Property::SymbolZOrder) }, { "icon-allow-overlap", static_cast<uint8_t>(Property::IconAllowOverlap) }, { "icon-ignore-placement", static_cast<uint8_t>(Property::IconIgnorePlacement) }, @@ -1520,54 +1538,18 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } - if (property == Property::SymbolZOrder) { + if (property == Property::SymbolSortKey || 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<SymbolZOrderType>> typedValue = convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); - if (!typedValue) { - return error; - } - - setSymbolZOrder(*typedValue); - return nullopt; - - } - - if (property == Property::IconRotationAlignment || property == Property::IconPitchAlignment || property == Property::TextPitchAlignment || property == Property::TextRotationAlignment) { - Error error; - optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); + optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false); if (!typedValue) { return error; } - if (property == Property::IconRotationAlignment) { - setIconRotationAlignment(*typedValue); - return nullopt; - } - - if (property == Property::IconPitchAlignment) { - setIconPitchAlignment(*typedValue); - return nullopt; - } - - if (property == Property::TextPitchAlignment) { - setTextPitchAlignment(*typedValue); + if (property == Property::SymbolSortKey) { + setSymbolSortKey(*typedValue); return nullopt; } - if (property == Property::TextRotationAlignment) { - setTextRotationAlignment(*typedValue); - return nullopt; - } - - } - - 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) { - return error; - } - if (property == Property::IconSize) { setIconSize(*typedValue); return nullopt; @@ -1605,6 +1587,47 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co } + if (property == Property::SymbolZOrder) { + Error error; + optional<PropertyValue<SymbolZOrderType>> typedValue = convert<PropertyValue<SymbolZOrderType>>(value, error, false, false); + if (!typedValue) { + return error; + } + + setSymbolZOrder(*typedValue); + return nullopt; + + } + + if (property == Property::IconRotationAlignment || property == Property::IconPitchAlignment || property == Property::TextPitchAlignment || property == Property::TextRotationAlignment) { + Error error; + optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false); + if (!typedValue) { + return error; + } + + if (property == Property::IconRotationAlignment) { + setIconRotationAlignment(*typedValue); + return nullopt; + } + + if (property == Property::IconPitchAlignment) { + setIconPitchAlignment(*typedValue); + return nullopt; + } + + if (property == Property::TextPitchAlignment) { + setTextPitchAlignment(*typedValue); + return nullopt; + } + + if (property == Property::TextRotationAlignment) { + setTextRotationAlignment(*typedValue); + return nullopt; + } + + } + if (property == Property::IconTextFit) { Error error; optional<PropertyValue<IconTextFitType>> typedValue = convert<PropertyValue<IconTextFitType>>(value, error, false, false); |