summaryrefslogtreecommitdiff
path: root/platform/qt/include/qmapbox.hpp
blob: 0a6a41b3e1a48e70bb8802fdc6f18c8b4c92919f (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef QMAPBOX_H
#define QMAPBOX_H

#include <QList>
#include <QPair>
#include <QVariant>
#include <QString>

// This header follows the Qt coding style: https://wiki.qt.io/Qt_Coding_Style

namespace QMapbox {

typedef QPair<double, double> Coordinate;
typedef QList<Coordinate> LineString;

typedef QPair<Coordinate, double> CoordinateZoom;

typedef quint32 AnnotationID;
typedef QList<AnnotationID> AnnotationIDs;

typedef QPair<Coordinate, QString> PointAnnotation;

// FIXME: We need to add support for custom style properties
typedef QPair<LineString, QString> ShapeAnnotation;

// Reflects mbgl::NetworkStatus::Status.
enum NetworkMode {
    Online, // Default
    Offline,
};

// Reflects mbgl::MapChange.
enum MapChange {
    MapChangeRegionWillChange = 0,
    MapChangeRegionWillChangeAnimated,
    MapChangeRegionIsChanging,
    MapChangeRegionDidChange,
    MapChangeRegionDidChangeAnimated,
    MapChangeWillStartLoadingMap,
    MapChangeDidFinishLoadingMap,
    MapChangeDidFailLoadingMap,
    MapChangeWillStartRenderingFrame,
    MapChangeDidFinishRenderingFrame,
    MapChangeDidFinishRenderingFrameFullyRendered,
    MapChangeWillStartRenderingMap,
    MapChangeDidFinishRenderingMap,
    MapChangeDidFinishRenderingMapFullyRendered,
    MapChangeDidFinishLoadingStyle,
    MapChangeSourceAttributionDidChange
};

struct Q_DECL_EXPORT CameraOptions {
    QVariant center;  // Coordinate
    QVariant anchor;  // QPointF
    QVariant zoom;    // double
    QVariant angle;   // double
    QVariant pitch;   // double
};

Q_DECL_EXPORT QList<QPair<QString, QString> >& defaultStyles();

Q_DECL_EXPORT NetworkMode networkMode();
Q_DECL_EXPORT void setNetworkMode(NetworkMode);

// This struct is a 1:1 copy of mbgl::CustomLayerRenderParameters.
struct Q_DECL_EXPORT CustomLayerRenderParameters {
    double width;
    double height;
    double latitude;
    double longitude;
    double zoom;
    double bearing;
    double pitch;
    double altitude;
};

struct Q_DECL_EXPORT TransitionOptions {
    QVariant duration; // qint64
    QVariant delay; // qint64
};

typedef void (*CustomLayerInitializeFunction)(void* context) ;
typedef void (*CustomLayerRenderFunction)(void* context, const CustomLayerRenderParameters&);
typedef void (*CustomLayerDeinitializeFunction)(void* context);

Q_DECL_EXPORT void initializeGLExtensions();

} // namespace QMapbox

Q_DECLARE_METATYPE(QMapbox::Coordinate);
Q_DECLARE_METATYPE(QMapbox::MapChange);

#endif // QMAPBOX_H