diff options
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/layout_property.hpp | 38 | ||||
-rw-r--r-- | src/mbgl/style/property_fallback.cpp | 40 | ||||
-rw-r--r-- | src/mbgl/style/property_key.hpp | 41 | ||||
-rw-r--r-- | src/mbgl/style/style_properties.cpp | 5 |
4 files changed, 38 insertions, 86 deletions
diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp new file mode 100644 index 0000000000..5f24e5b133 --- /dev/null +++ b/src/mbgl/style/layout_property.hpp @@ -0,0 +1,38 @@ +#ifndef MBGL_LAYOUT_PROPERTY +#define MBGL_LAYOUT_PROPERTY + +#include <mbgl/style/property_parsing.hpp> +#include <mbgl/style/function.hpp> + +#include <rapidjson/document.h> + +namespace mbgl { + +using JSVal = rapidjson::Value; + +template <typename T> +class LayoutProperty { +public: + LayoutProperty(T v) : value(v) {} + + void parse(const char * name, const JSVal& layout) { + if (layout.HasMember(name)) { + parsedValue = detail::parseProperty<Function<T>>(name, layout[name]); + } + } + + void calculate(const StyleCalculationParameters& parameters) { + if (parsedValue) { + value = (*parsedValue).evaluate(parameters); + } + } + + operator T() const { return value; } + + mapbox::util::optional<Function<T>> parsedValue; + T value; +}; + +} + +#endif diff --git a/src/mbgl/style/property_fallback.cpp b/src/mbgl/style/property_fallback.cpp index d606888551..31e46640be 100644 --- a/src/mbgl/style/property_fallback.cpp +++ b/src/mbgl/style/property_fallback.cpp @@ -27,7 +27,6 @@ const std::map<PropertyKey, PropertyValue> PropertyFallbackValue::properties = { { PropertyKey::CircleBlur, CirclePaintProperties().blur }, { PropertyKey::IconOpacity, SymbolPaintProperties().icon.opacity }, - { PropertyKey::IconSize, SymbolPaintProperties().icon.size }, { PropertyKey::IconColor, SymbolPaintProperties().icon.color }, { PropertyKey::IconHaloColor, SymbolPaintProperties().icon.halo_color }, { PropertyKey::IconHaloWidth, SymbolPaintProperties().icon.halo_width }, @@ -36,7 +35,6 @@ const std::map<PropertyKey, PropertyValue> PropertyFallbackValue::properties = { { PropertyKey::IconTranslateAnchor, SymbolPaintProperties().icon.translate_anchor }, { PropertyKey::TextOpacity, SymbolPaintProperties().text.opacity }, - { PropertyKey::TextSize, SymbolPaintProperties().text.size }, { PropertyKey::TextColor, SymbolPaintProperties().text.color }, { PropertyKey::TextHaloColor, SymbolPaintProperties().text.halo_color }, { PropertyKey::TextHaloWidth, SymbolPaintProperties().text.halo_width }, @@ -54,44 +52,6 @@ const std::map<PropertyKey, PropertyValue> PropertyFallbackValue::properties = { { PropertyKey::BackgroundOpacity, BackgroundPaintProperties().opacity }, { PropertyKey::BackgroundColor, BackgroundPaintProperties().color }, - - { PropertyKey::LineCap, LineLayoutProperties().cap }, - { PropertyKey::LineJoin, LineLayoutProperties().join }, - { PropertyKey::LineMiterLimit, LineLayoutProperties().miter_limit }, - { PropertyKey::LineRoundLimit, LineLayoutProperties().round_limit }, - - { PropertyKey::SymbolPlacement, SymbolLayoutProperties().placement }, - { PropertyKey::SymbolSpacing, SymbolLayoutProperties().spacing }, - { PropertyKey::SymbolAvoidEdges, SymbolLayoutProperties().avoid_edges }, - - { PropertyKey::IconAllowOverlap, SymbolLayoutProperties().icon.allow_overlap }, - { PropertyKey::IconIgnorePlacement, SymbolLayoutProperties().icon.ignore_placement }, - { PropertyKey::IconOptional, SymbolLayoutProperties().icon.optional }, - { PropertyKey::IconRotationAlignment, SymbolLayoutProperties().icon.rotation_alignment }, - { PropertyKey::IconImage, SymbolLayoutProperties().icon.image }, - { PropertyKey::IconRotate, SymbolLayoutProperties().icon.rotate }, - { PropertyKey::IconPadding, SymbolLayoutProperties().icon.padding }, - { PropertyKey::IconKeepUpright, SymbolLayoutProperties().icon.keep_upright }, - { PropertyKey::IconOffset, SymbolLayoutProperties().icon.offset }, - - { PropertyKey::TextRotationAlignment, SymbolLayoutProperties().text.rotation_alignment }, - { PropertyKey::TextField, SymbolLayoutProperties().text.field }, - { PropertyKey::TextFont, SymbolLayoutProperties().text.font }, - { PropertyKey::TextMaxWidth, SymbolLayoutProperties().text.max_width }, - { PropertyKey::TextLineHeight, SymbolLayoutProperties().text.line_height }, - { PropertyKey::TextLetterSpacing, SymbolLayoutProperties().text.letter_spacing }, - { PropertyKey::TextJustify, SymbolLayoutProperties().text.justify }, - { PropertyKey::TextAnchor, SymbolLayoutProperties().text.anchor }, - { PropertyKey::TextMaxAngle, SymbolLayoutProperties().text.max_angle }, - { PropertyKey::TextRotate, SymbolLayoutProperties().text.rotate }, - { PropertyKey::TextPadding, SymbolLayoutProperties().text.padding }, - { PropertyKey::TextKeepUpright, SymbolLayoutProperties().text.keep_upright }, - { PropertyKey::TextTransform, SymbolLayoutProperties().text.transform }, - { PropertyKey::TextOffset, SymbolLayoutProperties().text.offset }, - { PropertyKey::TextAllowOverlap, SymbolLayoutProperties().text.allow_overlap }, - { PropertyKey::TextIgnorePlacement, SymbolLayoutProperties().text.ignore_placement }, - { PropertyKey::TextOptional, SymbolLayoutProperties().text.optional }, - }; const PropertyValue PropertyFallbackValue::defaultProperty = false; diff --git a/src/mbgl/style/property_key.hpp b/src/mbgl/style/property_key.hpp index 4349035f58..f9b6b796cf 100644 --- a/src/mbgl/style/property_key.hpp +++ b/src/mbgl/style/property_key.hpp @@ -22,11 +22,6 @@ enum class PropertyKey { LineDashArray, // for transitions only LineImage, - LineCap, - LineJoin, - LineMiterLimit, - LineRoundLimit, - CircleRadius, CircleColor, CircleOpacity, @@ -34,12 +29,7 @@ enum class PropertyKey { CircleTranslateAnchor, CircleBlur, - SymbolPlacement, - SymbolSpacing, - SymbolAvoidEdges, - IconOpacity, - IconSize, IconColor, IconHaloColor, IconHaloWidth, @@ -47,16 +37,6 @@ enum class PropertyKey { IconTranslate, IconTranslateAnchor, - IconAllowOverlap, - IconIgnorePlacement, - IconOptional, - IconRotationAlignment, - IconImage, - IconOffset, - IconPadding, - IconRotate, - IconKeepUpright, - TextOpacity, TextColor, TextHaloColor, @@ -65,25 +45,6 @@ enum class PropertyKey { TextTranslate, TextTranslateAnchor, - TextRotationAlignment, - TextField, - TextFont, - TextSize, - TextMaxWidth, - TextLineHeight, - TextLetterSpacing, - TextMaxAngle, - TextRotate, - TextPadding, - TextIgnorePlacement, - TextOptional, - TextJustify, - TextAnchor, - TextKeepUpright, - TextTransform, - TextOffset, - TextAllowOverlap, - RasterOpacity, RasterHueRotate, RasterBrightness, // for transitions only @@ -96,8 +57,6 @@ enum class PropertyKey { BackgroundOpacity, BackgroundColor, BackgroundImage, - - Visibilty }; } diff --git a/src/mbgl/style/style_properties.cpp b/src/mbgl/style/style_properties.cpp deleted file mode 100644 index 69a9cede50..0000000000 --- a/src/mbgl/style/style_properties.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include <mbgl/style/style_properties.hpp> - -namespace mbgl { - -} |