summaryrefslogtreecommitdiff
path: root/include/mbgl/style/types.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-29 18:27:59 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-07-29 18:27:59 +0200
commitfa3a41136ca6345f34b53a1f211926cc1bd8649c (patch)
tree457f0d528b02356e310f9d3a3f1f1859cc63dd8d /include/mbgl/style/types.hpp
parent270c24a9a8c8a02e62132cd4cb7b8aac2c1e6de5 (diff)
downloadqtlocation-mapboxgl-fa3a41136ca6345f34b53a1f211926cc1bd8649c.tar.gz
merge text and icon buckets/styles
(we're not yet placing together!)
Diffstat (limited to 'include/mbgl/style/types.hpp')
-rw-r--r--include/mbgl/style/types.hpp219
1 files changed, 111 insertions, 108 deletions
diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp
index 70090a7e36..55b7685fd3 100644
--- a/include/mbgl/style/types.hpp
+++ b/include/mbgl/style/types.hpp
@@ -11,12 +11,13 @@ namespace mbgl {
// Stores a premultiplied color, with all four channels ranging from 0..1
typedef std::array<float, 4> Color;
+// -------------------------------------------------------------------------------------------------
+
enum class StyleLayerType : uint8_t {
Unknown,
Fill,
Line,
- Icon,
- Text,
+ Symbol,
Raster,
Composite,
Background
@@ -26,170 +27,172 @@ MBGL_DEFINE_ENUM_CLASS(StyleLayerTypeClass, StyleLayerType, {
{ StyleLayerType::Unknown, "unknown" },
{ StyleLayerType::Fill, "fill" },
{ StyleLayerType::Line, "line" },
- { StyleLayerType::Icon, "icon" },
- { StyleLayerType::Text, "text" },
+ { StyleLayerType::Symbol, "symbol" },
{ StyleLayerType::Raster, "raster" },
{ StyleLayerType::Composite, "composite" },
{ StyleLayerType::Background, "background" },
{ StyleLayerType(-1), "unknown" },
});
+// -------------------------------------------------------------------------------------------------
-enum class WindingType : uint8_t {
+enum class SourceType : uint8_t {
+ Vector,
+ Raster,
+ GeoJSON,
+ Video
+};
+
+MBGL_DEFINE_ENUM_CLASS(SourceTypeClass, SourceType, {
+ { SourceType::Vector, "vector" },
+ { SourceType::Raster, "raster" },
+ { SourceType::GeoJSON, "geojson" },
+ { SourceType::Video, "video" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
+enum class WindingType : bool {
EvenOdd,
NonZero,
- Default = NonZero
};
+MBGL_DEFINE_ENUM_CLASS(WindingTypeClass, WindingType, {
+ { WindingType::EvenOdd, "even-odd" },
+ { WindingType::NonZero, "non-zero" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class CapType : uint8_t {
Round,
Butt,
Square,
- Default = Butt
};
+MBGL_DEFINE_ENUM_CLASS(CapTypeClass, CapType, {
+ { CapType::Round, "round" },
+ { CapType::Butt, "butt" },
+ { CapType::Square, "square" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class JoinType : uint8_t {
Miter,
Bevel,
- Round,
- Default = Miter
+ Round
};
-enum class TextPathType : uint8_t {
- Horizontal,
- Curve,
- Default = Horizontal
-};
+MBGL_DEFINE_ENUM_CLASS(JoinTypeClass, JoinType, {
+ { JoinType::Miter, "miter" },
+ { JoinType::Bevel, "bevel" },
+ { JoinType::Round, "round" },
+});
-enum class PlacementType : bool {
- Point,
- Line,
- Default = Point
-};
+// -------------------------------------------------------------------------------------------------
-enum class TextTransformType : uint8_t {
- None,
- Uppercase,
- Lowercase,
- Default = None
+enum class TranslateAnchorType : bool {
+ Map,
+ Viewport
};
-enum class TranslateAnchorType : uint8_t {
+MBGL_DEFINE_ENUM_CLASS(TranslateAnchorTypeClass, TranslateAnchorType, {
+ { TranslateAnchorType::Map, "map" },
+ { TranslateAnchorType::Viewport, "viewport" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
+enum class RotateAnchorType : bool {
Map,
Viewport,
- Default = Map
};
-enum class RotateAnchorType : uint8_t {
- Map,
- Viewport,
- Default = Viewport
+MBGL_DEFINE_ENUM_CLASS(RotateAnchorTypeClass, RotateAnchorType, {
+ { RotateAnchorType::Map, "map" },
+ { RotateAnchorType::Viewport, "viewport" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
+enum class PlacementType : bool {
+ Point,
+ Line,
};
+MBGL_DEFINE_ENUM_CLASS(PlacementTypeClass, PlacementType, {
+ { PlacementType::Point, "point" },
+ { PlacementType::Line, "line" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class RotationAlignmentType : bool {
Map,
Viewport,
- Default = Viewport
};
+MBGL_DEFINE_ENUM_CLASS(RotationAlignmentTypeClass, RotationAlignmentType, {
+ { RotationAlignmentType::Map, "map" },
+ { RotationAlignmentType::Viewport, "viewport" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class TextJustifyType : uint8_t {
Center,
Left,
- Right,
- Default = Center
+ Right
};
+MBGL_DEFINE_ENUM_CLASS(TextJustifyTypeClass, TextJustifyType, {
+ { TextJustifyType::Center, "center" },
+ { TextJustifyType::Left, "left" },
+ { TextJustifyType::Right, "right" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class TextHorizontalAlignType : uint8_t {
Left,
Center,
Right,
- Default = Center
};
+MBGL_DEFINE_ENUM_CLASS(TextHorizontalAlignTypeClass, TextHorizontalAlignType, {
+ { TextHorizontalAlignType::Left, "left" },
+ { TextHorizontalAlignType::Center, "center" },
+ { TextHorizontalAlignType::Right, "right" },
+});
+
+// -------------------------------------------------------------------------------------------------
+
enum class TextVerticalAlignType : uint8_t {
Top,
Center,
Bottom,
- Default = Center
-};
-
-enum class SourceType : uint8_t {
- Vector,
- Raster,
- GeoJSON,
- Video,
- Default = Vector
};
-inline WindingType parseWindingType(const std::string &type) {
- if (type == "even-odd") return WindingType::EvenOdd;
- if (type == "non-zero") return WindingType::NonZero;
- return WindingType::Default;
-}
-
-inline CapType parseCapType(const std::string &cap) {
- if (cap == "round") return CapType::Round;
- if (cap == "butt") return CapType::Butt;
- if (cap == "square") return CapType::Square;
- return CapType::Default;
-}
-
-inline JoinType parseJoinType(const std::string &join) {
- if (join == "miter") return JoinType::Miter;
- if (join == "bevel") return JoinType::Bevel;
- if (join == "round") return JoinType::Round;
- return JoinType::Default;
-}
-
-inline TextPathType parseTextPathType(const std::string &path) {
- if (path == "horizontal") return TextPathType::Horizontal;
- if (path == "curve") return TextPathType::Curve;
- return TextPathType::Default;
-}
+MBGL_DEFINE_ENUM_CLASS(TextVerticalAlignTypeClass, TextVerticalAlignType, {
+ { TextVerticalAlignType::Top, "top" },
+ { TextVerticalAlignType::Center, "center" },
+ { TextVerticalAlignType::Bottom, "bottom" },
+});
-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;
- return TextTransformType::Default;
+enum class TextTransformType : uint8_t {
+ None,
+ Uppercase,
+ Lowercase,
};
-inline TranslateAnchorType parseTranslateAnchorType(const std::string &anchor) {
- if (anchor == "map") return TranslateAnchorType::Map;
- if (anchor == "viewport") return TranslateAnchorType::Viewport;
- return TranslateAnchorType::Default;
-}
-
-inline RotateAnchorType parseRotateAnchorType(const std::string &anchor) {
- if (anchor == "map") return RotateAnchorType::Map;
- if (anchor == "viewport") return RotateAnchorType::Viewport;
- return RotateAnchorType::Default;
-}
-
-inline float parseAlignmentType(const std::string &alignment) {
- if (alignment == "right") return 1.0f;
- if (alignment == "left") return 0.0f;
- return 0.5f;
-}
-
-inline float parseVerticalAlignmentType(const std::string &alignment) {
- if (alignment == "bottom") return 1.0f;
- if (alignment == "top") return 0.0f;
- return 0.5f;
-}
-
-inline SourceType parseSourceType(const std::string &source) {
- if (source == "vector") return SourceType::Vector;
- if (source == "raster") return SourceType::Raster;
- if (source == "geojson") return SourceType::GeoJSON;
- if (source == "video") return SourceType::Video;
- return SourceType::Default;
-}
+MBGL_DEFINE_ENUM_CLASS(TextTransformTypeClass, TextTransformType, {
+ { TextTransformType::None, "none" },
+ { TextTransformType::Uppercase, "uppercase" },
+ { TextTransformType::Lowercase, "lowercase" },
+});
}