summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-25 13:59:09 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-02 14:51:39 -0700
commitcadc617c762d453cca2c9bac41f9c1db984c5fac (patch)
tree5a15363a54ef81b0106693dd83c70bfdf7761393 /include
parentba4a8a97316d65ab595bb7edf759f463bbd10049 (diff)
downloadqtlocation-mapboxgl-cadc617c762d453cca2c9bac41f9c1db984c5fac.tar.gz
[core] Introduce PropertyValue<T>
PropertyValue<T> represents the three possible types of style property value: undefined, constant, or function.
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/layer/background_layer.hpp13
-rw-r--r--include/mbgl/layer/circle_layer.hpp25
-rw-r--r--include/mbgl/layer/fill_layer.hpp29
-rw-r--r--include/mbgl/layer/line_layer.hpp57
-rw-r--r--include/mbgl/layer/raster_layer.hpp29
-rw-r--r--include/mbgl/layer/symbol_layer.hpp181
-rw-r--r--include/mbgl/style/types.hpp3
7 files changed, 170 insertions, 167 deletions
diff --git a/include/mbgl/layer/background_layer.hpp b/include/mbgl/layer/background_layer.hpp
index 79f24990e6..211597f6ea 100644
--- a/include/mbgl/layer/background_layer.hpp
+++ b/include/mbgl/layer/background_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -13,14 +14,14 @@ public:
// Paint properties
- Function<Color> getBackgroundColor() const;
- void setBackgroundColor(Function<Color>);
+ PropertyValue<Color> getBackgroundColor() const;
+ void setBackgroundColor(PropertyValue<Color>);
- Function<std::string> getBackgroundPattern() const;
- void setBackgroundPattern(Function<std::string>);
+ PropertyValue<std::string> getBackgroundPattern() const;
+ void setBackgroundPattern(PropertyValue<std::string>);
- Function<float> getBackgroundOpacity() const;
- void setBackgroundOpacity(Function<float>);
+ PropertyValue<float> getBackgroundOpacity() const;
+ void setBackgroundOpacity(PropertyValue<float>);
// Private implementation
diff --git a/include/mbgl/layer/circle_layer.hpp b/include/mbgl/layer/circle_layer.hpp
index 14b9da895f..28e5c2fa7a 100644
--- a/include/mbgl/layer/circle_layer.hpp
+++ b/include/mbgl/layer/circle_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -19,23 +20,23 @@ public:
// Paint properties
- Function<float> getCircleRadius() const;
- void setCircleRadius(Function<float>);
+ PropertyValue<float> getCircleRadius() const;
+ void setCircleRadius(PropertyValue<float>);
- Function<Color> getCircleColor() const;
- void setCircleColor(Function<Color>);
+ PropertyValue<Color> getCircleColor() const;
+ void setCircleColor(PropertyValue<Color>);
- Function<float> getCircleBlur() const;
- void setCircleBlur(Function<float>);
+ PropertyValue<float> getCircleBlur() const;
+ void setCircleBlur(PropertyValue<float>);
- Function<float> getCircleOpacity() const;
- void setCircleOpacity(Function<float>);
+ PropertyValue<float> getCircleOpacity() const;
+ void setCircleOpacity(PropertyValue<float>);
- Function<std::array<float, 2>> getCircleTranslate() const;
- void setCircleTranslate(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getCircleTranslate() const;
+ void setCircleTranslate(PropertyValue<std::array<float, 2>>);
- Function<TranslateAnchorType> getCircleTranslateAnchor() const;
- void setCircleTranslateAnchor(Function<TranslateAnchorType>);
+ PropertyValue<TranslateAnchorType> getCircleTranslateAnchor() const;
+ void setCircleTranslateAnchor(PropertyValue<TranslateAnchorType>);
// Private implementation
diff --git a/include/mbgl/layer/fill_layer.hpp b/include/mbgl/layer/fill_layer.hpp
index dc0752f9e2..76c043957d 100644
--- a/include/mbgl/layer/fill_layer.hpp
+++ b/include/mbgl/layer/fill_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -19,26 +20,26 @@ public:
// Paint properties
- Function<bool> getFillAntialias() const;
- void setFillAntialias(Function<bool>);
+ PropertyValue<bool> getFillAntialias() const;
+ void setFillAntialias(PropertyValue<bool>);
- Function<float> getFillOpacity() const;
- void setFillOpacity(Function<float>);
+ PropertyValue<float> getFillOpacity() const;
+ void setFillOpacity(PropertyValue<float>);
- Function<Color> getFillColor() const;
- void setFillColor(Function<Color>);
+ PropertyValue<Color> getFillColor() const;
+ void setFillColor(PropertyValue<Color>);
- Function<Color> getFillOutlineColor() const;
- void setFillOutlineColor(Function<Color>);
+ PropertyValue<Color> getFillOutlineColor() const;
+ void setFillOutlineColor(PropertyValue<Color>);
- Function<std::array<float, 2>> getFillTranslate() const;
- void setFillTranslate(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getFillTranslate() const;
+ void setFillTranslate(PropertyValue<std::array<float, 2>>);
- Function<TranslateAnchorType> getFillTranslateAnchor() const;
- void setFillTranslateAnchor(Function<TranslateAnchorType>);
+ PropertyValue<TranslateAnchorType> getFillTranslateAnchor() const;
+ void setFillTranslateAnchor(PropertyValue<TranslateAnchorType>);
- Function<std::string> getFillPattern() const;
- void setFillPattern(Function<std::string>);
+ PropertyValue<std::string> getFillPattern() const;
+ void setFillPattern(PropertyValue<std::string>);
// Private implementation
diff --git a/include/mbgl/layer/line_layer.hpp b/include/mbgl/layer/line_layer.hpp
index 0f898d3c69..b438799116 100644
--- a/include/mbgl/layer/line_layer.hpp
+++ b/include/mbgl/layer/line_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
#include <vector>
@@ -21,49 +22,49 @@ public:
// Layout properties
- Function<LineCapType> getLineCap() const;
- void setLineCap(Function<LineCapType>);
+ PropertyValue<LineCapType> getLineCap() const;
+ void setLineCap(PropertyValue<LineCapType>);
- Function<LineJoinType> getLineJoin() const;
- void setLineJoin(Function<LineJoinType>);
+ PropertyValue<LineJoinType> getLineJoin() const;
+ void setLineJoin(PropertyValue<LineJoinType>);
- Function<float> getLineMiterLimit() const;
- void setLineMiterLimit(Function<float>);
+ PropertyValue<float> getLineMiterLimit() const;
+ void setLineMiterLimit(PropertyValue<float>);
- Function<float> getLineRoundLimit() const;
- void setLineRoundLimit(Function<float>);
+ PropertyValue<float> getLineRoundLimit() const;
+ void setLineRoundLimit(PropertyValue<float>);
// Paint properties
- Function<float> getLineOpacity() const;
- void setLineOpacity(Function<float>);
+ PropertyValue<float> getLineOpacity() const;
+ void setLineOpacity(PropertyValue<float>);
- Function<Color> getLineColor() const;
- void setLineColor(Function<Color>);
+ PropertyValue<Color> getLineColor() const;
+ void setLineColor(PropertyValue<Color>);
- Function<std::array<float, 2>> getLineTranslate() const;
- void setLineTranslate(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getLineTranslate() const;
+ void setLineTranslate(PropertyValue<std::array<float, 2>>);
- Function<TranslateAnchorType> getLineTranslateAnchor() const;
- void setLineTranslateAnchor(Function<TranslateAnchorType>);
+ PropertyValue<TranslateAnchorType> getLineTranslateAnchor() const;
+ void setLineTranslateAnchor(PropertyValue<TranslateAnchorType>);
- Function<float> getLineWidth() const;
- void setLineWidth(Function<float>);
+ PropertyValue<float> getLineWidth() const;
+ void setLineWidth(PropertyValue<float>);
- Function<float> getLineGapWidth() const;
- void setLineGapWidth(Function<float>);
+ PropertyValue<float> getLineGapWidth() const;
+ void setLineGapWidth(PropertyValue<float>);
- Function<float> getLineOffset() const;
- void setLineOffset(Function<float>);
+ PropertyValue<float> getLineOffset() const;
+ void setLineOffset(PropertyValue<float>);
- Function<float> getLineBlur() const;
- void setLineBlur(Function<float>);
+ PropertyValue<float> getLineBlur() const;
+ void setLineBlur(PropertyValue<float>);
- Function<std::vector<float>> getLineDasharray() const;
- void setLineDasharray(Function<std::vector<float>>);
+ PropertyValue<std::vector<float>> getLineDasharray() const;
+ void setLineDasharray(PropertyValue<std::vector<float>>);
- Function<std::string> getLinePattern() const;
- void setLinePattern(Function<std::string>);
+ PropertyValue<std::string> getLinePattern() const;
+ void setLinePattern(PropertyValue<std::string>);
// Private implementation
diff --git a/include/mbgl/layer/raster_layer.hpp b/include/mbgl/layer/raster_layer.hpp
index 9dc27a274a..5d747737c0 100644
--- a/include/mbgl/layer/raster_layer.hpp
+++ b/include/mbgl/layer/raster_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
namespace mbgl {
@@ -18,26 +19,26 @@ public:
// Paint properties
- Function<float> getRasterOpacity() const;
- void setRasterOpacity(Function<float>);
+ PropertyValue<float> getRasterOpacity() const;
+ void setRasterOpacity(PropertyValue<float>);
- Function<float> getRasterHueRotate() const;
- void setRasterHueRotate(Function<float>);
+ PropertyValue<float> getRasterHueRotate() const;
+ void setRasterHueRotate(PropertyValue<float>);
- Function<float> getRasterBrightnessMin() const;
- void setRasterBrightnessMin(Function<float>);
+ PropertyValue<float> getRasterBrightnessMin() const;
+ void setRasterBrightnessMin(PropertyValue<float>);
- Function<float> getRasterBrightnessMax() const;
- void setRasterBrightnessMax(Function<float>);
+ PropertyValue<float> getRasterBrightnessMax() const;
+ void setRasterBrightnessMax(PropertyValue<float>);
- Function<float> getRasterSaturation() const;
- void setRasterSaturation(Function<float>);
+ PropertyValue<float> getRasterSaturation() const;
+ void setRasterSaturation(PropertyValue<float>);
- Function<float> getRasterContrast() const;
- void setRasterContrast(Function<float>);
+ PropertyValue<float> getRasterContrast() const;
+ void setRasterContrast(PropertyValue<float>);
- Function<float> getRasterFadeDuration() const;
- void setRasterFadeDuration(Function<float>);
+ PropertyValue<float> getRasterFadeDuration() const;
+ void setRasterFadeDuration(PropertyValue<float>);
// Private implementation
diff --git a/include/mbgl/layer/symbol_layer.hpp b/include/mbgl/layer/symbol_layer.hpp
index f9b2956390..2339515201 100644
--- a/include/mbgl/layer/symbol_layer.hpp
+++ b/include/mbgl/layer/symbol_layer.hpp
@@ -3,6 +3,7 @@
#pragma once
#include <mbgl/style/layer.hpp>
+#include <mbgl/style/property_value.hpp>
#include <vector>
@@ -21,142 +22,142 @@ public:
// Layout properties
- Function<SymbolPlacementType> getSymbolPlacement() const;
- void setSymbolPlacement(Function<SymbolPlacementType>);
+ PropertyValue<SymbolPlacementType> getSymbolPlacement() const;
+ void setSymbolPlacement(PropertyValue<SymbolPlacementType>);
- Function<float> getSymbolSpacing() const;
- void setSymbolSpacing(Function<float>);
+ PropertyValue<float> getSymbolSpacing() const;
+ void setSymbolSpacing(PropertyValue<float>);
- Function<bool> getSymbolAvoidEdges() const;
- void setSymbolAvoidEdges(Function<bool>);
+ PropertyValue<bool> getSymbolAvoidEdges() const;
+ void setSymbolAvoidEdges(PropertyValue<bool>);
- Function<bool> getIconAllowOverlap() const;
- void setIconAllowOverlap(Function<bool>);
+ PropertyValue<bool> getIconAllowOverlap() const;
+ void setIconAllowOverlap(PropertyValue<bool>);
- Function<bool> getIconIgnorePlacement() const;
- void setIconIgnorePlacement(Function<bool>);
+ PropertyValue<bool> getIconIgnorePlacement() const;
+ void setIconIgnorePlacement(PropertyValue<bool>);
- Function<bool> getIconOptional() const;
- void setIconOptional(Function<bool>);
+ PropertyValue<bool> getIconOptional() const;
+ void setIconOptional(PropertyValue<bool>);
- Function<RotationAlignmentType> getIconRotationAlignment() const;
- void setIconRotationAlignment(Function<RotationAlignmentType>);
+ PropertyValue<RotationAlignmentType> getIconRotationAlignment() const;
+ void setIconRotationAlignment(PropertyValue<RotationAlignmentType>);
- Function<float> getIconSize() const;
- void setIconSize(Function<float>);
+ PropertyValue<float> getIconSize() const;
+ void setIconSize(PropertyValue<float>);
- Function<std::string> getIconImage() const;
- void setIconImage(Function<std::string>);
+ PropertyValue<std::string> getIconImage() const;
+ void setIconImage(PropertyValue<std::string>);
- Function<float> getIconRotate() const;
- void setIconRotate(Function<float>);
+ PropertyValue<float> getIconRotate() const;
+ void setIconRotate(PropertyValue<float>);
- Function<float> getIconPadding() const;
- void setIconPadding(Function<float>);
+ PropertyValue<float> getIconPadding() const;
+ void setIconPadding(PropertyValue<float>);
- Function<bool> getIconKeepUpright() const;
- void setIconKeepUpright(Function<bool>);
+ PropertyValue<bool> getIconKeepUpright() const;
+ void setIconKeepUpright(PropertyValue<bool>);
- Function<std::array<float, 2>> getIconOffset() const;
- void setIconOffset(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getIconOffset() const;
+ void setIconOffset(PropertyValue<std::array<float, 2>>);
- Function<RotationAlignmentType> getTextRotationAlignment() const;
- void setTextRotationAlignment(Function<RotationAlignmentType>);
+ PropertyValue<RotationAlignmentType> getTextRotationAlignment() const;
+ void setTextRotationAlignment(PropertyValue<RotationAlignmentType>);
- Function<std::string> getTextField() const;
- void setTextField(Function<std::string>);
+ PropertyValue<std::string> getTextField() const;
+ void setTextField(PropertyValue<std::string>);
- Function<std::vector<std::string>> getTextFont() const;
- void setTextFont(Function<std::vector<std::string>>);
+ PropertyValue<std::vector<std::string>> getTextFont() const;
+ void setTextFont(PropertyValue<std::vector<std::string>>);
- Function<float> getTextSize() const;
- void setTextSize(Function<float>);
+ PropertyValue<float> getTextSize() const;
+ void setTextSize(PropertyValue<float>);
- Function<float> getTextMaxWidth() const;
- void setTextMaxWidth(Function<float>);
+ PropertyValue<float> getTextMaxWidth() const;
+ void setTextMaxWidth(PropertyValue<float>);
- Function<float> getTextLineHeight() const;
- void setTextLineHeight(Function<float>);
+ PropertyValue<float> getTextLineHeight() const;
+ void setTextLineHeight(PropertyValue<float>);
- Function<float> getTextLetterSpacing() const;
- void setTextLetterSpacing(Function<float>);
+ PropertyValue<float> getTextLetterSpacing() const;
+ void setTextLetterSpacing(PropertyValue<float>);
- Function<TextJustifyType> getTextJustify() const;
- void setTextJustify(Function<TextJustifyType>);
+ PropertyValue<TextJustifyType> getTextJustify() const;
+ void setTextJustify(PropertyValue<TextJustifyType>);
- Function<TextAnchorType> getTextAnchor() const;
- void setTextAnchor(Function<TextAnchorType>);
+ PropertyValue<TextAnchorType> getTextAnchor() const;
+ void setTextAnchor(PropertyValue<TextAnchorType>);
- Function<float> getTextMaxAngle() const;
- void setTextMaxAngle(Function<float>);
+ PropertyValue<float> getTextMaxAngle() const;
+ void setTextMaxAngle(PropertyValue<float>);
- Function<float> getTextRotate() const;
- void setTextRotate(Function<float>);
+ PropertyValue<float> getTextRotate() const;
+ void setTextRotate(PropertyValue<float>);
- Function<float> getTextPadding() const;
- void setTextPadding(Function<float>);
+ PropertyValue<float> getTextPadding() const;
+ void setTextPadding(PropertyValue<float>);
- Function<bool> getTextKeepUpright() const;
- void setTextKeepUpright(Function<bool>);
+ PropertyValue<bool> getTextKeepUpright() const;
+ void setTextKeepUpright(PropertyValue<bool>);
- Function<TextTransformType> getTextTransform() const;
- void setTextTransform(Function<TextTransformType>);
+ PropertyValue<TextTransformType> getTextTransform() const;
+ void setTextTransform(PropertyValue<TextTransformType>);
- Function<std::array<float, 2>> getTextOffset() const;
- void setTextOffset(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getTextOffset() const;
+ void setTextOffset(PropertyValue<std::array<float, 2>>);
- Function<bool> getTextAllowOverlap() const;
- void setTextAllowOverlap(Function<bool>);
+ PropertyValue<bool> getTextAllowOverlap() const;
+ void setTextAllowOverlap(PropertyValue<bool>);
- Function<bool> getTextIgnorePlacement() const;
- void setTextIgnorePlacement(Function<bool>);
+ PropertyValue<bool> getTextIgnorePlacement() const;
+ void setTextIgnorePlacement(PropertyValue<bool>);
- Function<bool> getTextOptional() const;
- void setTextOptional(Function<bool>);
+ PropertyValue<bool> getTextOptional() const;
+ void setTextOptional(PropertyValue<bool>);
// Paint properties
- Function<float> getIconOpacity() const;
- void setIconOpacity(Function<float>);
+ PropertyValue<float> getIconOpacity() const;
+ void setIconOpacity(PropertyValue<float>);
- Function<Color> getIconColor() const;
- void setIconColor(Function<Color>);
+ PropertyValue<Color> getIconColor() const;
+ void setIconColor(PropertyValue<Color>);
- Function<Color> getIconHaloColor() const;
- void setIconHaloColor(Function<Color>);
+ PropertyValue<Color> getIconHaloColor() const;
+ void setIconHaloColor(PropertyValue<Color>);
- Function<float> getIconHaloWidth() const;
- void setIconHaloWidth(Function<float>);
+ PropertyValue<float> getIconHaloWidth() const;
+ void setIconHaloWidth(PropertyValue<float>);
- Function<float> getIconHaloBlur() const;
- void setIconHaloBlur(Function<float>);
+ PropertyValue<float> getIconHaloBlur() const;
+ void setIconHaloBlur(PropertyValue<float>);
- Function<std::array<float, 2>> getIconTranslate() const;
- void setIconTranslate(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getIconTranslate() const;
+ void setIconTranslate(PropertyValue<std::array<float, 2>>);
- Function<TranslateAnchorType> getIconTranslateAnchor() const;
- void setIconTranslateAnchor(Function<TranslateAnchorType>);
+ PropertyValue<TranslateAnchorType> getIconTranslateAnchor() const;
+ void setIconTranslateAnchor(PropertyValue<TranslateAnchorType>);
- Function<float> getTextOpacity() const;
- void setTextOpacity(Function<float>);
+ PropertyValue<float> getTextOpacity() const;
+ void setTextOpacity(PropertyValue<float>);
- Function<Color> getTextColor() const;
- void setTextColor(Function<Color>);
+ PropertyValue<Color> getTextColor() const;
+ void setTextColor(PropertyValue<Color>);
- Function<Color> getTextHaloColor() const;
- void setTextHaloColor(Function<Color>);
+ PropertyValue<Color> getTextHaloColor() const;
+ void setTextHaloColor(PropertyValue<Color>);
- Function<float> getTextHaloWidth() const;
- void setTextHaloWidth(Function<float>);
+ PropertyValue<float> getTextHaloWidth() const;
+ void setTextHaloWidth(PropertyValue<float>);
- Function<float> getTextHaloBlur() const;
- void setTextHaloBlur(Function<float>);
+ PropertyValue<float> getTextHaloBlur() const;
+ void setTextHaloBlur(PropertyValue<float>);
- Function<std::array<float, 2>> getTextTranslate() const;
- void setTextTranslate(Function<std::array<float, 2>>);
+ PropertyValue<std::array<float, 2>> getTextTranslate() const;
+ void setTextTranslate(PropertyValue<std::array<float, 2>>);
- Function<TranslateAnchorType> getTextTranslateAnchor() const;
- void setTextTranslateAnchor(Function<TranslateAnchorType>);
+ PropertyValue<TranslateAnchorType> getTextTranslateAnchor() const;
+ void setTextTranslateAnchor(PropertyValue<TranslateAnchorType>);
// Private implementation
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp
index ea09ccfb0c..56f3570357 100644
--- a/include/mbgl/style/types.hpp
+++ b/include/mbgl/style/types.hpp
@@ -27,9 +27,6 @@ public:
using Stop = std::pair<float, T>;
using Stops = std::vector<Stop>;
- Function(const T& constant)
- : stops({{ 0, constant }}) {}
-
explicit Function(const Stops& stops_, float base_)
: base(base_), stops(stops_) {}