1 #pragma once
2 
3 #include <mbgl/util/geometry.hpp>
4 #include <mbgl/util/variant.hpp>
5 #include <mbgl/util/color.hpp>
6 #include <mbgl/style/property_value.hpp>
7 #include <mbgl/style/data_driven_property_value.hpp>
8 
9 #include <cstdint>
10 #include <vector>
11 #include <string>
12 
13 namespace mbgl {
14 
15 using AnnotationID = uint32_t;
16 using AnnotationIDs = std::vector<AnnotationID>;
17 
18 class SymbolAnnotation {
19 public:
SymbolAnnotation(Point<double> geometry_,std::string icon_={})20     SymbolAnnotation(Point<double> geometry_, std::string icon_ = {})
21         : geometry(std::move(geometry_)),
22           icon(std::move(icon_)) {}
23 
24     Point<double> geometry;
25     std::string icon;
26 };
27 
28 using ShapeAnnotationGeometry = variant<
29     LineString<double>,
30     Polygon<double>,
31     MultiLineString<double>,
32     MultiPolygon<double>>;
33 
34 class LineAnnotation {
35 public:
LineAnnotation(ShapeAnnotationGeometry geometry_,style::DataDrivenPropertyValue<float> opacity_=1.0f,style::DataDrivenPropertyValue<float> width_=1.0f,style::DataDrivenPropertyValue<Color> color_=Color::black ())36     LineAnnotation(ShapeAnnotationGeometry geometry_,
37                    style::DataDrivenPropertyValue<float> opacity_ = 1.0f,
38                    style::DataDrivenPropertyValue<float> width_ = 1.0f,
39                    style::DataDrivenPropertyValue<Color> color_ = Color::black())
40         : geometry(std::move(geometry_)),
41           opacity(std::move(opacity_)),
42           width(std::move(width_)),
43           color(std::move(color_)) {}
44 
45     ShapeAnnotationGeometry geometry;
46     style::DataDrivenPropertyValue<float> opacity;
47     style::DataDrivenPropertyValue<float> width;
48     style::DataDrivenPropertyValue<Color> color;
49 };
50 
51 class FillAnnotation {
52 public:
FillAnnotation(ShapeAnnotationGeometry geometry_,style::DataDrivenPropertyValue<float> opacity_=1.0f,style::DataDrivenPropertyValue<Color> color_=Color::black (),style::DataDrivenPropertyValue<Color> outlineColor_={})53     FillAnnotation(ShapeAnnotationGeometry geometry_,
54                    style::DataDrivenPropertyValue<float> opacity_ = 1.0f,
55                    style::DataDrivenPropertyValue<Color> color_ = Color::black(),
56                    style::DataDrivenPropertyValue<Color> outlineColor_ = {})
57         : geometry(std::move(geometry_)),
58           opacity(std::move(opacity_)),
59           color(std::move(color_)),
60           outlineColor(std::move(outlineColor_)) {}
61 
62     ShapeAnnotationGeometry geometry;
63     style::DataDrivenPropertyValue<float> opacity;
64     style::DataDrivenPropertyValue<Color> color;
65     style::DataDrivenPropertyValue<Color> outlineColor;
66 };
67 
68 using Annotation = variant<
69     SymbolAnnotation,
70     LineAnnotation,
71     FillAnnotation>;
72 
73 } // namespace mbgl
74