summaryrefslogtreecommitdiff
path: root/src/mbgl/style/style_layout.hpp
blob: 90bc71fd6ebe58bad92894112c9286bd6cd8f80c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef MBGL_STYLE_STYLE_LAYOUT
#define MBGL_STYLE_STYLE_LAYOUT

#include <mbgl/style/types.hpp>

namespace mbgl {

class Source;

class StyleLayoutFill {
public:
    // Make movable only.
    StyleLayoutFill() = default;
    StyleLayoutFill(StyleLayoutFill &&) = default;
    StyleLayoutFill& operator=(StyleLayoutFill &&) = default;
    StyleLayoutFill(const StyleLayoutFill &) = delete;
    StyleLayoutFill& operator=(const StyleLayoutFill &) = delete;
};

class StyleLayoutLine {
public:
    // Make movable only.
    StyleLayoutLine() = default;
    StyleLayoutLine(StyleLayoutLine &&) = default;
    StyleLayoutLine& operator=(StyleLayoutLine &&) = default;
    StyleLayoutLine(const StyleLayoutLine &) = delete;
    StyleLayoutLine& operator=(const StyleLayoutLine &) = delete;

    CapType cap = CapType::Butt;
    JoinType join = JoinType::Miter;
    float miter_limit = 2.0f;
    float round_limit = 1.0f;
};

class StyleLayoutSymbol {
public:
    // Make movable only.
    StyleLayoutSymbol() = default;
    StyleLayoutSymbol(StyleLayoutSymbol &&) = default;
    StyleLayoutSymbol& operator=(StyleLayoutSymbol &&) = default;
    StyleLayoutSymbol(const StyleLayoutSymbol &) = delete;
    StyleLayoutSymbol& operator=(const StyleLayoutSymbol &) = delete;

    PlacementType placement = PlacementType::Point;
    float min_distance = 250.0f;
    bool avoid_edges = false;

    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 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 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 StyleLayoutRaster {
public:
    // Make movable only.
    StyleLayoutRaster() = default;
    StyleLayoutRaster(StyleLayoutRaster &&) = default;
    StyleLayoutRaster& operator=(StyleLayoutRaster &&) = default;
    StyleLayoutRaster(const StyleLayoutRaster &) = delete;
    StyleLayoutRaster& operator=(const StyleLayoutRaster &) = delete;
};

class StyleLayoutBackground {
public:
    // Make movable only.
    StyleLayoutBackground() = default;
    StyleLayoutBackground(StyleLayoutBackground &&) = default;
    StyleLayoutBackground& operator=(StyleLayoutBackground &&) = default;
    StyleLayoutBackground(const StyleLayoutBackground &) = delete;
    StyleLayoutBackground& operator=(const StyleLayoutBackground &) = delete;
};

template <typename T>
const T &defaultStyleLayout();

};

#endif