diff options
Diffstat (limited to 'platform/qt/include/qmapbox.hpp')
-rw-r--r-- | platform/qt/include/qmapbox.hpp | 70 |
1 files changed, 63 insertions, 7 deletions
diff --git a/platform/qt/include/qmapbox.hpp b/platform/qt/include/qmapbox.hpp index 3aaacb84ea..1388c0f513 100644 --- a/platform/qt/include/qmapbox.hpp +++ b/platform/qt/include/qmapbox.hpp @@ -1,6 +1,7 @@ #ifndef QMAPBOX_H #define QMAPBOX_H +#include <QColor> #include <QList> #include <QPair> #include <QVariant> @@ -10,18 +11,64 @@ namespace QMapbox { +// Reflects mapbox::geometry::point<double>. typedef QPair<double, double> Coordinate; -typedef QList<Coordinate> LineString; - typedef QPair<Coordinate, double> CoordinateZoom; -typedef quint32 AnnotationID; -typedef QList<AnnotationID> AnnotationIDs; +// Reflects mapbox::geometry::line_string<double> and mapbox::geometry::linear_ring<double>. +typedef QList<Coordinate> Coordinates; + +// Reflects mapbox::geometry::multi_line_string<double> and mapbox::geometry::polygon<double>. +typedef QList<Coordinates> CoordinatesCollection; + +// Reflects mapbox::geometry::multi_polygon<double>. +typedef QList<CoordinatesCollection> CoordinatesCollections; + +// Reflects mbgl::ShapeAnnotationGeometry. +struct Q_DECL_EXPORT ShapeAnnotationGeometry { + enum Type { + LineStringType, + PolygonType, + MultiLineStringType, + MultiPolygonType + }; + Type type; + CoordinatesCollections geometry; +}; + +// Reflects mbgl::SymbolAnnotation. +struct Q_DECL_EXPORT SymbolAnnotation { + Coordinate geometry; + QString icon; +}; + +// Reflects mbgl::LineAnnotation. +struct Q_DECL_EXPORT LineAnnotation { + ShapeAnnotationGeometry geometry; + float opacity = 1.0f; + float width = 1.0f; + QColor color = Qt::black; +}; + +// Reflects mbgl::FillAnnotation. +struct Q_DECL_EXPORT FillAnnotation { + ShapeAnnotationGeometry geometry; + float opacity = 1.0f; + QColor color = Qt::black; + QVariant outlineColor; +}; -typedef QPair<Coordinate, QString> PointAnnotation; +// Reflects mbgl::StyleSourcedAnnotation. +struct Q_DECL_EXPORT StyleSourcedAnnotation { + ShapeAnnotationGeometry geometry; + QString layerID; +}; -// FIXME: We need to add support for custom style properties -typedef QPair<LineString, QString> ShapeAnnotation; +// SymbolAnnotation, LineAnnotation, FillAnnotation, StyleSourcedAnnotation. +typedef QVariant Annotation; + +typedef quint32 AnnotationID; +typedef QList<AnnotationID> AnnotationIDs; // Reflects mbgl::NetworkStatus::Status. enum NetworkMode { @@ -55,5 +102,14 @@ Q_DECL_EXPORT void initializeGLExtensions(); } // namespace QMapbox Q_DECLARE_METATYPE(QMapbox::Coordinate); +Q_DECLARE_METATYPE(QMapbox::Coordinates); +Q_DECLARE_METATYPE(QMapbox::CoordinatesCollection); +Q_DECLARE_METATYPE(QMapbox::CoordinatesCollections); + +Q_DECLARE_METATYPE(QMapbox::SymbolAnnotation); +Q_DECLARE_METATYPE(QMapbox::ShapeAnnotationGeometry); +Q_DECLARE_METATYPE(QMapbox::LineAnnotation); +Q_DECLARE_METATYPE(QMapbox::FillAnnotation); +Q_DECLARE_METATYPE(QMapbox::StyleSourcedAnnotation); #endif // QMAPBOX_H |