1#ifndef QMAPBOX_H
2#define QMAPBOX_H
3
4#include <QColor>
5#include <QList>
6#include <QPair>
7#include <QVariant>
8#include <QString>
9
10// This header follows the Qt coding style: https://wiki.qt.io/Qt_Coding_Style
11
12#if !defined(QT_MAPBOXGL_STATIC)
13# if defined(QT_BUILD_MAPBOXGL_LIB)
14# define Q_MAPBOXGL_EXPORT Q_DECL_EXPORT
15# else
16# define Q_MAPBOXGL_EXPORT Q_DECL_IMPORT
17# endif
18#else
19# define Q_MAPBOXGL_EXPORT
20#endif
21
22namespace QMapbox {
23
24typedef QPair<double, double> Coordinate;
25typedef QPair<Coordinate, double> CoordinateZoom;
26typedef QPair<double, double> ProjectedMeters;
27
28typedef QList<Coordinate> Coordinates;
29typedef QList<Coordinates> CoordinatesCollection;
30
31typedef QList<CoordinatesCollection> CoordinatesCollections;
32
33struct Q_MAPBOXGL_EXPORT Feature {
34 enum Type {
35 PointType = 1,
36 LineStringType,
37 PolygonType
38 };
39
40 /*! Class constructor. */
41 Feature(Type type_ = PointType, const CoordinatesCollections& geometry_ = CoordinatesCollections(),
42 const QVariantMap& properties_ = QVariantMap(), const QVariant& id_ = QVariant())
43 : type(type_), geometry(geometry_), properties(properties_), id(id_) {}
44
45 Type type;
46 CoordinatesCollections geometry;
47 QVariantMap properties;
48 QVariant id;
49};
50
51struct Q_MAPBOXGL_EXPORT ShapeAnnotationGeometry {
52 enum Type {
53 LineStringType = 1,
54 PolygonType,
55 MultiLineStringType,
56 MultiPolygonType
57 };
58
59 /*! Class constructor. */
60 ShapeAnnotationGeometry(Type type_ = LineStringType, const CoordinatesCollections& geometry_ = CoordinatesCollections())
61 : type(type_), geometry(geometry_) {}
62
63 Type type;
64 CoordinatesCollections geometry;
65};
66
67struct Q_MAPBOXGL_EXPORT SymbolAnnotation {
68 Coordinate geometry;
69 QString icon;
70};
71
72struct Q_MAPBOXGL_EXPORT LineAnnotation {
73 /*! Class constructor. */
74 LineAnnotation(const ShapeAnnotationGeometry& geometry_ = ShapeAnnotationGeometry(), float opacity_ = 1.0f,
75 float width_ = 1.0f, const QColor& color_ = Qt::black)
76 : geometry(geometry_), opacity(opacity_), width(width_), color(color_) {}
77
78 ShapeAnnotationGeometry geometry;
79 float opacity;
80 float width;
81 QColor color;
82};
83
84struct Q_MAPBOXGL_EXPORT FillAnnotation {
85 /*! Class constructor. */
86 FillAnnotation(const ShapeAnnotationGeometry& geometry_ = ShapeAnnotationGeometry(), float opacity_ = 1.0f,
87 const QColor& color_ = Qt::black, const QVariant& outlineColor_ = QVariant())
88 : geometry(geometry_), opacity(opacity_), color(color_), outlineColor(outlineColor_) {}
89
90 ShapeAnnotationGeometry geometry;
91 float opacity;
92 QColor color;
93 QVariant outlineColor;
94};
95
96typedef QVariant Annotation;
97typedef quint32 AnnotationID;
98typedef QList<AnnotationID> AnnotationIDs;
99
100enum NetworkMode {
101 Online, // Default
102 Offline,
103};
104
105Q_MAPBOXGL_EXPORT QList<QPair<QString, QString> >& defaultStyles();
106
107Q_MAPBOXGL_EXPORT NetworkMode networkMode();
108Q_MAPBOXGL_EXPORT void setNetworkMode(NetworkMode);
109
110// This struct is a 1:1 copy of mbgl::CustomLayerRenderParameters.
111struct Q_MAPBOXGL_EXPORT CustomLayerRenderParameters {
112 double width;
113 double height;
114 double latitude;
115 double longitude;
116 double zoom;
117 double bearing;
118 double pitch;
119 double fieldOfView;
120};
121
122class Q_MAPBOXGL_EXPORT CustomLayerHostInterface {
123public:
124 virtual ~CustomLayerHostInterface() = default;
125 virtual void initialize() = 0;
126 virtual void render(const CustomLayerRenderParameters&) = 0;
127 virtual void deinitialize() = 0;
128};
129
130} // namespace QMapbox
131
132Q_DECLARE_METATYPE(QMapbox::Coordinate);
133Q_DECLARE_METATYPE(QMapbox::Coordinates);
134Q_DECLARE_METATYPE(QMapbox::CoordinatesCollection);
135Q_DECLARE_METATYPE(QMapbox::CoordinatesCollections);
136Q_DECLARE_METATYPE(QMapbox::Feature);
137
138Q_DECLARE_METATYPE(QMapbox::SymbolAnnotation);
139Q_DECLARE_METATYPE(QMapbox::ShapeAnnotationGeometry);
140Q_DECLARE_METATYPE(QMapbox::LineAnnotation);
141Q_DECLARE_METATYPE(QMapbox::FillAnnotation);
142
143#endif // QMAPBOX_H
144

source code of qtlocation/src/3rdparty/mapbox-gl-native/platform/qt/include/qmapbox.hpp