summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-23 15:37:01 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-07-29 12:09:22 +0200
commit270c24a9a8c8a02e62132cd4cb7b8aac2c1e6de5 (patch)
tree8b03393949d87e08680c54d9e29cd34036eb6f39 /include/mbgl
parent6e44e03241ff5b21f24f0f0d944c33ecdbeedead (diff)
downloadqtlocation-mapboxgl-270c24a9a8c8a02e62132cd4cb7b8aac2c1e6de5.tar.gz
add symbol* properties/keys
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/style/property_key.hpp12
-rw-r--r--include/mbgl/style/style_bucket.hpp43
-rw-r--r--include/mbgl/style/style_properties.hpp33
-rw-r--r--include/mbgl/style/types.hpp39
4 files changed, 126 insertions, 1 deletions
diff --git a/include/mbgl/style/property_key.hpp b/include/mbgl/style/property_key.hpp
index d9005f2f4a..d5553ebf0d 100644
--- a/include/mbgl/style/property_key.hpp
+++ b/include/mbgl/style/property_key.hpp
@@ -30,7 +30,14 @@ enum class PropertyKey {
IconOpacity,
IconRotate,
- IconRotateAnchor,
+ IconSize,
+ IconColor,
+ IconHaloColor,
+ IconHaloWidth,
+ IconHaloBlur,
+ IconTranslateX,
+ IconTranslateY,
+ IconTranslateAnchor,
TextOpacity,
TextSize,
@@ -38,6 +45,9 @@ enum class PropertyKey {
TextHaloColor,
TextHaloWidth,
TextHaloBlur,
+ TextTranslateX,
+ TextTranslateY,
+ TextTranslateAnchor,
CompositeOpacity,
diff --git a/include/mbgl/style/style_bucket.hpp b/include/mbgl/style/style_bucket.hpp
index 26a0ca2f70..6948a96158 100644
--- a/include/mbgl/style/style_bucket.hpp
+++ b/include/mbgl/style/style_bucket.hpp
@@ -4,8 +4,10 @@
#include <mbgl/style/types.hpp>
#include <mbgl/style/filter_expression.hpp>
#include <mbgl/style/style_source.hpp>
+
#include <mbgl/util/vec.hpp>
#include <mbgl/util/variant.hpp>
+#include <mbgl/util/noncopyable.hpp>
#include <memory>
#include <forward_list>
@@ -59,6 +61,47 @@ public:
bool always_visible = false;
};
+class StyleBucketSymbol : util::noncopyable {
+public:
+ PlacementType placement = PlacementType::Default;
+ float min_distance = 250.0f;
+
+ struct {
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ float max_size = 1.0f;
+ std::string image;
+ float padding = 2.0f;
+ bool keep_upright = false;
+ vec2<float> offset = {0, 0};
+ } icon;
+
+ struct {
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ std::string field;
+ std::string font;
+ float max_size = 16.0f;
+ float max_width = 15.0f * 24 /* em */;
+ float line_height = 1.2f * 24 /* em */;
+ float letter_spacing = 0.0f * 24 /* em */;
+ TextJustifyType justify = TextJustifyType::Center;
+ TextHorizontalAlignType horizontal_align = TextHorizontalAlignType::Center;
+ TextVerticalAlignType vertical_align = TextVerticalAlignType::Center;
+ float max_angle_delta = 45.0f /* degrees */;
+ float rotate = 0.0f;
+ float slant = 0.0f;
+ float padding = 2.0f;
+ bool keep_upright = true;
+ TextTransformType transform = TextTransformType::None;
+ vec2<float> offset = {0, 0};
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ } text;
+};
+
class StyleBucketRaster {
public:
};
diff --git a/include/mbgl/style/style_properties.hpp b/include/mbgl/style/style_properties.hpp
index ccd5ce4aec..9575347be3 100644
--- a/include/mbgl/style/style_properties.hpp
+++ b/include/mbgl/style/style_properties.hpp
@@ -69,6 +69,39 @@ struct TextProperties {
}
};
+struct SymbolProperties {
+ inline SymbolProperties() {}
+
+ struct {
+ float opacity = 1.0f;
+ float rotate = 0.0f;
+ float size = 1.0f;
+ Color color = {{ 0, 0, 0, 1 }};
+ Color halo_color = {{ 0, 0, 0, 0 }};
+ float halo_width = 0.0f;
+ float halo_blur = 0.0f;
+ std::array<float, 2> translate = {{ 0, 0 }};
+ TranslateAnchorType translate_anchor = TranslateAnchorType::Map;
+ } icon;
+
+ struct {
+ float opacity = 1.0f;
+ float size = 12.0f;
+ Color color = {{ 0, 0, 0, 1 }};
+ Color halo_color = {{ 0, 0, 0, 0 }};
+ float halo_width = 0.0f;
+ float halo_blur = 0.0f;
+ std::array<float, 2> translate = {{ 0, 0 }};
+ TranslateAnchorType translate_anchor = TranslateAnchorType::Map;
+ } text;
+
+ inline bool isVisible() const {
+ return (icon.opacity > 0 && (icon.color[3] > 0 || icon.halo_color[3] > 0) && icon.size > 0) ||
+ (text.opacity > 0 && (text.color[3] > 0 || text.halo_color[3] > 0) && text.size > 0);
+ }
+};
+
+
struct CompositeProperties {
inline CompositeProperties() {}
float opacity = 1.0f;
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp
index f8e99418da..70090a7e36 100644
--- a/include/mbgl/style/types.hpp
+++ b/include/mbgl/style/types.hpp
@@ -61,6 +61,12 @@ enum class TextPathType : uint8_t {
Default = Horizontal
};
+enum class PlacementType : bool {
+ Point,
+ Line,
+ Default = Point
+};
+
enum class TextTransformType : uint8_t {
None,
Uppercase,
@@ -80,6 +86,33 @@ enum class RotateAnchorType : uint8_t {
Default = Viewport
};
+enum class RotationAlignmentType : bool {
+ Map,
+ Viewport,
+ Default = Viewport
+};
+
+enum class TextJustifyType : uint8_t {
+ Center,
+ Left,
+ Right,
+ Default = Center
+};
+
+enum class TextHorizontalAlignType : uint8_t {
+ Left,
+ Center,
+ Right,
+ Default = Center
+};
+
+enum class TextVerticalAlignType : uint8_t {
+ Top,
+ Center,
+ Bottom,
+ Default = Center
+};
+
enum class SourceType : uint8_t {
Vector,
Raster,
@@ -114,6 +147,12 @@ inline TextPathType parseTextPathType(const std::string &path) {
return TextPathType::Default;
}
+inline PlacementType parsePlacementType(const std::string &path) {
+ if (path == "point") return PlacementType::Point;
+ if (path == "line") return PlacementType::Line;
+ return PlacementType::Default;
+}
+
inline TextTransformType parseTextTransformType(const std::string& transform) {
if (transform == "uppercase") return TextTransformType::Uppercase;
if (transform == "lowercase") return TextTransformType::Lowercase;