blob: 91206a4cccb0498bcda4903d9b75c9351c9d8eca (
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
|
#ifndef MBGL_LINE_LAYER
#define MBGL_LINE_LAYER
#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/layout_property.hpp>
#include <mbgl/style/paint_property.hpp>
namespace mbgl {
class LineLayoutProperties {
public:
LayoutProperty<CapType> cap = CapType::Butt;
LayoutProperty<JoinType> join = JoinType::Miter;
LayoutProperty<float> miterLimit = 2.0f;
LayoutProperty<float> roundLimit = 1.0f;
};
class LinePaintProperties {
public:
PaintProperty<float> opacity = 1.0f;
PaintProperty<Color> color = { {{ 0, 0, 0, 1 }} };
PaintProperty<std::array<float, 2>> translate = { {{ 0, 0 }} };
PaintProperty<TranslateAnchorType> translateAnchor = TranslateAnchorType::Map;
PaintProperty<float> width = 1;
PaintProperty<float> gapWidth = 0;
PaintProperty<float> blur = 0;
PaintProperty<std::vector<float>, Faded<std::vector<float>>> dasharray = { {} };
PaintProperty<std::string, Faded<std::string>> pattern = { "" };
// Special case
float dashLineWidth = 1;
bool isVisible() const {
return opacity > 0 && color.value[3] > 0 && width > 0;
}
};
class LineLayer : public StyleLayer {
public:
std::unique_ptr<StyleLayer> clone() const override;
void parseLayout(const JSVal&) override;
void parsePaints(const JSVal&) override;
void cascade(const StyleCascadeParameters&) override;
bool recalculate(const StyleCalculationParameters&) override;
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
LineLayoutProperties layout;
LinePaintProperties paint;
};
} // namespace mbgl
#endif
|