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.cpp141
1 files changed, 71 insertions, 70 deletions
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index 4b335ead3c..157d8c745f 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -9,6 +9,7 @@
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion_impl.hpp>
+#include <mbgl/util/traits.hpp>
#include <mapbox/eternal.hpp>
@@ -1101,7 +1102,7 @@ TransitionOptions SymbolLayer::getTextTranslateAnchorTransition() const {
using namespace conversion;
optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Convertible& value) {
- enum class Property : uint8_t {
+ enum class Property {
IconColor,
IconHaloBlur,
IconHaloColor,
@@ -1133,34 +1134,34 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con
};
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
- { "icon-color", static_cast<uint8_t>(Property::IconColor) },
- { "icon-halo-blur", static_cast<uint8_t>(Property::IconHaloBlur) },
- { "icon-halo-color", static_cast<uint8_t>(Property::IconHaloColor) },
- { "icon-halo-width", static_cast<uint8_t>(Property::IconHaloWidth) },
- { "icon-opacity", static_cast<uint8_t>(Property::IconOpacity) },
- { "icon-translate", static_cast<uint8_t>(Property::IconTranslate) },
- { "icon-translate-anchor", static_cast<uint8_t>(Property::IconTranslateAnchor) },
- { "text-color", static_cast<uint8_t>(Property::TextColor) },
- { "text-halo-blur", static_cast<uint8_t>(Property::TextHaloBlur) },
- { "text-halo-color", static_cast<uint8_t>(Property::TextHaloColor) },
- { "text-halo-width", static_cast<uint8_t>(Property::TextHaloWidth) },
- { "text-opacity", static_cast<uint8_t>(Property::TextOpacity) },
- { "text-translate", static_cast<uint8_t>(Property::TextTranslate) },
- { "text-translate-anchor", static_cast<uint8_t>(Property::TextTranslateAnchor) },
- { "icon-color-transition", static_cast<uint8_t>(Property::IconColorTransition) },
- { "icon-halo-blur-transition", static_cast<uint8_t>(Property::IconHaloBlurTransition) },
- { "icon-halo-color-transition", static_cast<uint8_t>(Property::IconHaloColorTransition) },
- { "icon-halo-width-transition", static_cast<uint8_t>(Property::IconHaloWidthTransition) },
- { "icon-opacity-transition", static_cast<uint8_t>(Property::IconOpacityTransition) },
- { "icon-translate-transition", static_cast<uint8_t>(Property::IconTranslateTransition) },
- { "icon-translate-anchor-transition", static_cast<uint8_t>(Property::IconTranslateAnchorTransition) },
- { "text-color-transition", static_cast<uint8_t>(Property::TextColorTransition) },
- { "text-halo-blur-transition", static_cast<uint8_t>(Property::TextHaloBlurTransition) },
- { "text-halo-color-transition", static_cast<uint8_t>(Property::TextHaloColorTransition) },
- { "text-halo-width-transition", static_cast<uint8_t>(Property::TextHaloWidthTransition) },
- { "text-opacity-transition", static_cast<uint8_t>(Property::TextOpacityTransition) },
- { "text-translate-transition", static_cast<uint8_t>(Property::TextTranslateTransition) },
- { "text-translate-anchor-transition", static_cast<uint8_t>(Property::TextTranslateAnchorTransition) }
+ { "icon-color", mbgl::underlying_type(Property::IconColor) },
+ { "icon-halo-blur", mbgl::underlying_type(Property::IconHaloBlur) },
+ { "icon-halo-color", mbgl::underlying_type(Property::IconHaloColor) },
+ { "icon-halo-width", mbgl::underlying_type(Property::IconHaloWidth) },
+ { "icon-opacity", mbgl::underlying_type(Property::IconOpacity) },
+ { "icon-translate", mbgl::underlying_type(Property::IconTranslate) },
+ { "icon-translate-anchor", mbgl::underlying_type(Property::IconTranslateAnchor) },
+ { "text-color", mbgl::underlying_type(Property::TextColor) },
+ { "text-halo-blur", mbgl::underlying_type(Property::TextHaloBlur) },
+ { "text-halo-color", mbgl::underlying_type(Property::TextHaloColor) },
+ { "text-halo-width", mbgl::underlying_type(Property::TextHaloWidth) },
+ { "text-opacity", mbgl::underlying_type(Property::TextOpacity) },
+ { "text-translate", mbgl::underlying_type(Property::TextTranslate) },
+ { "text-translate-anchor", mbgl::underlying_type(Property::TextTranslateAnchor) },
+ { "icon-color-transition", mbgl::underlying_type(Property::IconColorTransition) },
+ { "icon-halo-blur-transition", mbgl::underlying_type(Property::IconHaloBlurTransition) },
+ { "icon-halo-color-transition", mbgl::underlying_type(Property::IconHaloColorTransition) },
+ { "icon-halo-width-transition", mbgl::underlying_type(Property::IconHaloWidthTransition) },
+ { "icon-opacity-transition", mbgl::underlying_type(Property::IconOpacityTransition) },
+ { "icon-translate-transition", mbgl::underlying_type(Property::IconTranslateTransition) },
+ { "icon-translate-anchor-transition", mbgl::underlying_type(Property::IconTranslateAnchorTransition) },
+ { "text-color-transition", mbgl::underlying_type(Property::TextColorTransition) },
+ { "text-halo-blur-transition", mbgl::underlying_type(Property::TextHaloBlurTransition) },
+ { "text-halo-color-transition", mbgl::underlying_type(Property::TextHaloColorTransition) },
+ { "text-halo-width-transition", mbgl::underlying_type(Property::TextHaloWidthTransition) },
+ { "text-opacity-transition", mbgl::underlying_type(Property::TextOpacityTransition) },
+ { "text-translate-transition", mbgl::underlying_type(Property::TextTranslateTransition) },
+ { "text-translate-anchor-transition", mbgl::underlying_type(Property::TextTranslateAnchorTransition) }
});
const auto it = properties.find(name.c_str());
@@ -1406,47 +1407,47 @@ optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Co
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) },
- { "icon-anchor", static_cast<uint8_t>(Property::IconAnchor) },
- { "icon-ignore-placement", static_cast<uint8_t>(Property::IconIgnorePlacement) },
- { "icon-image", static_cast<uint8_t>(Property::IconImage) },
- { "icon-keep-upright", static_cast<uint8_t>(Property::IconKeepUpright) },
- { "icon-offset", static_cast<uint8_t>(Property::IconOffset) },
- { "icon-optional", static_cast<uint8_t>(Property::IconOptional) },
- { "icon-padding", static_cast<uint8_t>(Property::IconPadding) },
- { "icon-pitch-alignment", static_cast<uint8_t>(Property::IconPitchAlignment) },
- { "icon-rotate", static_cast<uint8_t>(Property::IconRotate) },
- { "icon-rotation-alignment", static_cast<uint8_t>(Property::IconRotationAlignment) },
- { "icon-size", static_cast<uint8_t>(Property::IconSize) },
- { "icon-text-fit", static_cast<uint8_t>(Property::IconTextFit) },
- { "icon-text-fit-padding", static_cast<uint8_t>(Property::IconTextFitPadding) },
- { "symbol-avoid-edges", static_cast<uint8_t>(Property::SymbolAvoidEdges) },
- { "symbol-placement", static_cast<uint8_t>(Property::SymbolPlacement) },
- { "symbol-sort-key", static_cast<uint8_t>(Property::SymbolSortKey) },
- { "symbol-spacing", static_cast<uint8_t>(Property::SymbolSpacing) },
- { "symbol-z-order", static_cast<uint8_t>(Property::SymbolZOrder) },
- { "text-allow-overlap", static_cast<uint8_t>(Property::TextAllowOverlap) },
- { "text-anchor", static_cast<uint8_t>(Property::TextAnchor) },
- { "text-field", static_cast<uint8_t>(Property::TextField) },
- { "text-font", static_cast<uint8_t>(Property::TextFont) },
- { "text-ignore-placement", static_cast<uint8_t>(Property::TextIgnorePlacement) },
- { "text-justify", static_cast<uint8_t>(Property::TextJustify) },
- { "text-keep-upright", static_cast<uint8_t>(Property::TextKeepUpright) },
- { "text-letter-spacing", static_cast<uint8_t>(Property::TextLetterSpacing) },
- { "text-line-height", static_cast<uint8_t>(Property::TextLineHeight) },
- { "text-max-angle", static_cast<uint8_t>(Property::TextMaxAngle) },
- { "text-max-width", static_cast<uint8_t>(Property::TextMaxWidth) },
- { "text-offset", static_cast<uint8_t>(Property::TextOffset) },
- { "text-optional", static_cast<uint8_t>(Property::TextOptional) },
- { "text-padding", static_cast<uint8_t>(Property::TextPadding) },
- { "text-pitch-alignment", static_cast<uint8_t>(Property::TextPitchAlignment) },
- { "text-radial-offset", static_cast<uint8_t>(Property::TextRadialOffset) },
- { "text-rotate", static_cast<uint8_t>(Property::TextRotate) },
- { "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-writing-mode", static_cast<uint8_t>(Property::TextWritingMode) }
+ { "icon-allow-overlap", mbgl::underlying_type(Property::IconAllowOverlap) },
+ { "icon-anchor", mbgl::underlying_type(Property::IconAnchor) },
+ { "icon-ignore-placement", mbgl::underlying_type(Property::IconIgnorePlacement) },
+ { "icon-image", mbgl::underlying_type(Property::IconImage) },
+ { "icon-keep-upright", mbgl::underlying_type(Property::IconKeepUpright) },
+ { "icon-offset", mbgl::underlying_type(Property::IconOffset) },
+ { "icon-optional", mbgl::underlying_type(Property::IconOptional) },
+ { "icon-padding", mbgl::underlying_type(Property::IconPadding) },
+ { "icon-pitch-alignment", mbgl::underlying_type(Property::IconPitchAlignment) },
+ { "icon-rotate", mbgl::underlying_type(Property::IconRotate) },
+ { "icon-rotation-alignment", mbgl::underlying_type(Property::IconRotationAlignment) },
+ { "icon-size", mbgl::underlying_type(Property::IconSize) },
+ { "icon-text-fit", mbgl::underlying_type(Property::IconTextFit) },
+ { "icon-text-fit-padding", mbgl::underlying_type(Property::IconTextFitPadding) },
+ { "symbol-avoid-edges", mbgl::underlying_type(Property::SymbolAvoidEdges) },
+ { "symbol-placement", mbgl::underlying_type(Property::SymbolPlacement) },
+ { "symbol-sort-key", mbgl::underlying_type(Property::SymbolSortKey) },
+ { "symbol-spacing", mbgl::underlying_type(Property::SymbolSpacing) },
+ { "symbol-z-order", mbgl::underlying_type(Property::SymbolZOrder) },
+ { "text-allow-overlap", mbgl::underlying_type(Property::TextAllowOverlap) },
+ { "text-anchor", mbgl::underlying_type(Property::TextAnchor) },
+ { "text-field", mbgl::underlying_type(Property::TextField) },
+ { "text-font", mbgl::underlying_type(Property::TextFont) },
+ { "text-ignore-placement", mbgl::underlying_type(Property::TextIgnorePlacement) },
+ { "text-justify", mbgl::underlying_type(Property::TextJustify) },
+ { "text-keep-upright", mbgl::underlying_type(Property::TextKeepUpright) },
+ { "text-letter-spacing", mbgl::underlying_type(Property::TextLetterSpacing) },
+ { "text-line-height", mbgl::underlying_type(Property::TextLineHeight) },
+ { "text-max-angle", mbgl::underlying_type(Property::TextMaxAngle) },
+ { "text-max-width", mbgl::underlying_type(Property::TextMaxWidth) },
+ { "text-offset", mbgl::underlying_type(Property::TextOffset) },
+ { "text-optional", mbgl::underlying_type(Property::TextOptional) },
+ { "text-padding", mbgl::underlying_type(Property::TextPadding) },
+ { "text-pitch-alignment", mbgl::underlying_type(Property::TextPitchAlignment) },
+ { "text-radial-offset", mbgl::underlying_type(Property::TextRadialOffset) },
+ { "text-rotate", mbgl::underlying_type(Property::TextRotate) },
+ { "text-rotation-alignment", mbgl::underlying_type(Property::TextRotationAlignment) },
+ { "text-size", mbgl::underlying_type(Property::TextSize) },
+ { "text-transform", mbgl::underlying_type(Property::TextTransform) },
+ { "text-variable-anchor", mbgl::underlying_type(Property::TextVariableAnchor) },
+ { "text-writing-mode", mbgl::underlying_type(Property::TextWritingMode) }
});
const auto it = properties.find(name.c_str());