diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-10-26 15:12:43 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-10 11:33:17 -0800 |
commit | 54e08b1f83504e12cbc19b08295d9f9ed5177ab5 (patch) | |
tree | 40513395d4d0ed2d9003ef30a708f21b2e83e5ab /src/mbgl/layer/symbol_layer.hpp | |
parent | a5625675890213f94de7632d4ef152ade627c9a5 (diff) | |
download | qtlocation-mapboxgl-54e08b1f83504e12cbc19b08295d9f9ed5177ab5.tar.gz |
[core] Eliminate use of ClassProperties for paint
Diffstat (limited to 'src/mbgl/layer/symbol_layer.hpp')
-rw-r--r-- | src/mbgl/layer/symbol_layer.hpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/src/mbgl/layer/symbol_layer.hpp b/src/mbgl/layer/symbol_layer.hpp index 3871d7a2d4..9e4555350a 100644 --- a/src/mbgl/layer/symbol_layer.hpp +++ b/src/mbgl/layer/symbol_layer.hpp @@ -2,9 +2,8 @@ #define MBGL_SYMBOL_LAYER #include <mbgl/style/style_layer.hpp> -#include <mbgl/style/style_properties.hpp> -#include <mbgl/style/paint_properties_map.hpp> #include <mbgl/style/layout_property.hpp> +#include <mbgl/style/paint_property.hpp> namespace mbgl { @@ -55,6 +54,32 @@ public: float textMaxSize = 16.0f; }; +class SymbolPaintProperties { +public: + class PaintProperties { + public: + PaintProperties(float size_) : size(size_) {} + + PaintProperty<float> opacity = 1.0f; + PaintProperty<Color> color = { {{ 0, 0, 0, 1 }} }; + PaintProperty<Color> haloColor = { {{ 0, 0, 0, 0 }} }; + PaintProperty<float> haloWidth = 0.0f; + PaintProperty<float> haloBlur = 0.0f; + PaintProperty<std::array<float, 2>> translate = { {{ 0, 0 }} }; + PaintProperty<TranslateAnchorType> translateAnchor = TranslateAnchorType::Map; + + // Special case + float size; + + bool isVisible() const { + return opacity > 0 && (color.value[3] > 0 || haloColor.value[3] > 0) && size > 0; + } + }; + + PaintProperties icon { 1.0f }; + PaintProperties text { 16.0f }; +}; + class SymbolLayer : public StyleLayer { public: std::unique_ptr<StyleLayer> clone() const override; @@ -63,16 +88,12 @@ public: void parsePaints(const JSVal&) override; void cascade(const StyleCascadeParameters&) override; - void recalculate(const StyleCalculationParameters&) override; + bool recalculate(const StyleCalculationParameters&) override; std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override; - bool hasTransitions() const override; - SymbolLayoutProperties layout; - PaintPropertiesMap paints; - - SymbolPaintProperties properties; + SymbolPaintProperties paint; }; } |