summaryrefslogtreecommitdiff
path: root/src/mbgl/layer/circle_layer.hpp
blob: 03169ca0653b6158757b71b0429afd13ab3e6124 (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
#ifndef MBGL_CIRCLE_LAYER
#define MBGL_CIRCLE_LAYER

#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/paint_property.hpp>

namespace mbgl {

class CirclePaintProperties {
public:
    PaintProperty<float> radius { 5.0f };
    PaintProperty<Color> color { {{ 0, 0, 0, 1 }} };
    PaintProperty<float> opacity { 1.0f };
    PaintProperty<std::array<float, 2>> translate { {{ 0, 0 }} };
    PaintProperty<TranslateAnchorType> translateAnchor { TranslateAnchorType::Map };
    PaintProperty<float> blur { 0 };

    bool isVisible() const {
        return radius > 0 && color.value[3] > 0 && opacity > 0;
    }
};

class CircleLayer : public StyleLayer {
public:
    std::unique_ptr<StyleLayer> clone() const override;

    void parseLayout(const JSValue&) override {};
    void parsePaints(const JSValue&) override;

    void cascade(const StyleCascadeParameters&) override;
    bool recalculate(const StyleCalculationParameters&) override;

    std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;

    CirclePaintProperties paint;
};

} // namespace mbgl

#endif