summaryrefslogtreecommitdiff
path: root/include/llmr/style/style_bucket.hpp
blob: 5d8c9d6bb9207a96760ac90c0ec6a524b207fc0c (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
#ifndef LLMR_STYLE_STYLE_BUCKET
#define LLMR_STYLE_STYLE_BUCKET

#include <llmr/style/types.hpp>
#include <llmr/style/filter_expression.hpp>
#include <llmr/style/style_source.hpp>
#include <llmr/util/vec.hpp>
#include <llmr/util/variant.hpp>

#include <memory>
#include <forward_list>

namespace llmr {

class Source;

class StyleBucketFill {
public:
    WindingType winding = WindingType::Default;
};

class StyleBucketLine {
public:
    CapType cap = CapType::Default;
    JoinType join = JoinType::Default;
    float miter_limit = 2.0f;
    float round_limit = 1.0f;
};

class StyleBucketIcon {
public:
    uint16_t size = 16;
    vec2<float> translate {0, 0};
    TranslateAnchorType translate_anchor = TranslateAnchorType::Default;
    std::string icon;
    float spacing = 0.0f;
    float padding = 2.0f;
};

class StyleBucketText {
public:
    std::string field;
    TextPathType path = TextPathType::Default;
    TextTransformType transform = TextTransformType::Default;
    std::string font;
    float max_size = 16.0f;
    float max_width = 15.0f * 24;
    float line_height = 1.2f * 24;
    float letter_spacing = 0.0f;
    float alignment = 0.5f;
    float vertical_alignment = 0.5;
    vec2<float> translate {0, 0};
    TranslateAnchorType translate_anchor = TranslateAnchorType::Default;
    float max_angle_delta = M_PI;
    float min_distance = 250.0f;
    float rotate = 0.0f; // what is this?
    float padding = 2.0f;
    float slant = 0.0f;
    bool always_visible = false;
};

class StyleBucketRaster {
public:
};

typedef util::variant<StyleBucketFill, StyleBucketLine, StyleBucketIcon,
                      StyleBucketText, StyleBucketRaster,
                      std::false_type> StyleBucketRender;


class StyleBucket {
public:
    typedef std::shared_ptr<StyleBucket> Ptr;

    StyleBucket(StyleLayerType type);

    std::string name;
    std::shared_ptr<StyleSource> style_source;
    std::string source_layer;
    FilterExpression filter;
    StyleBucketRender render = std::false_type();
};



};

#endif