summaryrefslogtreecommitdiff
path: root/include/mbgl/annotation/shape_annotation.hpp
blob: 7dca1ec134d6ab4e2320e5b679181309300f2330 (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
#pragma once

#include <mbgl/annotation/annotation.hpp>
#include <mbgl/style/types.hpp>

#include <mbgl/util/geometry.hpp>
#include <mbgl/util/variant.hpp>

namespace mbgl {

struct FillAnnotationProperties {
    float opacity = 1;
    Color color = {{ 0, 0, 0, 1 }};
    Color outlineColor = {{ 0, 0, 0, -1 }};
};

struct LineAnnotationProperties {
    float opacity = 1;
    float width = 1;
    Color color = {{ 0, 0, 0, 1 }};
};

class ShapeAnnotation {
public:
    using Properties = variant<
        FillAnnotationProperties, // creates a fill annotation
        LineAnnotationProperties, // creates a line annotation
        std::string>; // creates an annotation whose type and properties are sourced from a style layer

    ShapeAnnotation(const Geometry<double>& geometry_, const Properties& properties_)
        : geometry(geometry_), properties(properties_) {}

    const Geometry<double> geometry;
    const Properties properties;
};

} // namespace mbgl