summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-19 13:19:52 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-22 09:21:30 -0700
commitdf89de5cc5bf043ca2fe57ef4dd9a7b5d25464cb (patch)
treeecac13b203cd45451aeff565cb11b179a5ef84d6 /include
parent83d39364f9de987d7840900db2e01673bc1ed6ef (diff)
downloadqtlocation-mapboxgl-df89de5cc5bf043ca2fe57ef4dd9a7b5d25464cb.tar.gz
[core] Rationalize style property classes: <type>{Paint,Layout}Properties
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/style_properties.hpp124
1 files changed, 92 insertions, 32 deletions
diff --git a/include/mbgl/style/style_properties.hpp b/include/mbgl/style/style_properties.hpp
index c0ecc35201..aacac3387b 100644
--- a/include/mbgl/style/style_properties.hpp
+++ b/include/mbgl/style/style_properties.hpp
@@ -13,8 +13,8 @@
namespace mbgl {
-struct FillProperties {
- FillProperties() {}
+class FillPaintProperties {
+public:
bool antialias = true;
float opacity = 1.0f;
Color fill_color = {{ 0, 0, 0, 1 }};
@@ -28,8 +28,12 @@ struct FillProperties {
}
};
-struct LineProperties {
- inline LineProperties() {}
+class FillLayoutProperties {
+public:
+};
+
+class LinePaintProperties {
+public:
float opacity = 1.0f;
Color color = {{ 0, 0, 0, 1 }};
std::array<float, 2> translate = {{ 0, 0 }};
@@ -46,23 +50,16 @@ struct LineProperties {
}
};
-struct CircleProperties {
- inline CircleProperties() {}
- float radius = 5.0f;
- Color color = {{ 0, 0, 0, 1 }};
- float opacity = 1.0f;
- std::array<float, 2> translate = {{ 0, 0 }};
- TranslateAnchorType translateAnchor = TranslateAnchorType::Map;
- float blur = 0;
-
- inline bool isVisible() const {
- return radius > 0 && color[3] > 0 && opacity > 0;
- }
+class LineLayoutProperties {
+public:
+ CapType cap = CapType::Butt;
+ JoinType join = JoinType::Miter;
+ float miter_limit = 2.0f;
+ float round_limit = 1.0f;
};
-struct SymbolProperties {
- inline SymbolProperties() {}
-
+class SymbolPaintProperties {
+public:
struct {
float opacity = 1.0f;
float size = 1.0f;
@@ -91,8 +88,66 @@ struct SymbolProperties {
}
};
-struct RasterProperties {
- inline RasterProperties() {}
+class SymbolLayoutProperties {
+public:
+ PlacementType placement = PlacementType::Point;
+ float spacing = 250.0f;
+ bool avoid_edges = false;
+
+ struct {
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ float size = 1.0f;
+ float max_size = 1.0f;
+ std::string image;
+ float rotate = 0.0f;
+ float padding = 2.0f;
+ bool keep_upright = false;
+ std::array<float, 2> offset = {{ 0, 0 }};
+ } icon;
+
+ struct {
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ std::string field;
+ std::string font = "Open Sans Regular, Arial Unicode MS Regular";
+ float size = 16.0f;
+ float max_size = 16.0f;
+ float max_width = 15.0f /* em */;
+ float line_height = 1.2f /* em */;
+ float letter_spacing = 0.0f /* em */;
+ TextJustifyType justify = TextJustifyType::Center;
+ TextAnchorType anchor = TextAnchorType::Center;
+ float max_angle = 45.0f /* degrees */;
+ float rotate = 0.0f;
+ float padding = 2.0f;
+ bool keep_upright = true;
+ TextTransformType transform = TextTransformType::None;
+ std::array<float, 2> offset = {{ 0, 0 }};
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ } text;
+};
+
+
+class CirclePaintProperties {
+public:
+ float radius = 5.0f;
+ Color color = {{ 0, 0, 0, 1 }};
+ float opacity = 1.0f;
+ std::array<float, 2> translate = {{ 0, 0 }};
+ TranslateAnchorType translateAnchor = TranslateAnchorType::Map;
+ float blur = 0;
+
+ inline bool isVisible() const {
+ return radius > 0 && color[3] > 0 && opacity > 0;
+ }
+};
+
+class RasterPaintProperties {
+public:
float opacity = 1.0f;
float hue_rotate = 0.0f;
std::array<float, 2> brightness = {{ 0, 1 }};
@@ -105,26 +160,31 @@ struct RasterProperties {
}
};
-struct BackgroundProperties {
- inline BackgroundProperties() {}
+class RasterLayoutProperties {
+public:
+};
+
+class BackgroundPaintProperties {
+public:
float opacity = 1.0f;
Color color = {{ 0, 0, 0, 1 }};
Faded<std::string> image;
};
+class BackgroundLayoutProperties {
+public:
+};
+
typedef mapbox::util::variant<
- FillProperties,
- LineProperties,
- CircleProperties,
- SymbolProperties,
- RasterProperties,
- BackgroundProperties,
+ FillPaintProperties,
+ LinePaintProperties,
+ CirclePaintProperties,
+ SymbolPaintProperties,
+ RasterPaintProperties,
+ BackgroundPaintProperties,
std::false_type
> StyleProperties;
-template <typename T>
-const T &defaultStyleProperties();
-
}
#endif