9#include <QMapLibre/Export>
10#include <QMapLibre/Settings>
11#include <QMapLibre/Types>
13#include <QtCore/QMargins>
14#include <QtCore/QObject>
15#include <QtCore/QPointF>
16#include <QtCore/QSize>
17#include <QtCore/QString>
18#include <QtCore/QStringList>
19#include <QtGui/QImage>
28class Q_MAPLIBRE_CORE_EXPORT
Map :
public QObject {
30 Q_PROPERTY(
double latitude READ latitude WRITE setLatitude)
31 Q_PROPERTY(
double longitude READ longitude WRITE setLongitude)
32 Q_PROPERTY(
double zoom READ zoom WRITE setZoom)
33 Q_PROPERTY(
double bearing READ bearing WRITE setBearing)
34 Q_PROPERTY(
double pitch READ pitch WRITE setPitch)
35 Q_PROPERTY(QString styleJson READ styleJson WRITE setStyleJson)
36 Q_PROPERTY(QString styleUrl READ styleUrl WRITE setStyleUrl)
37 Q_PROPERTY(
double scale READ scale WRITE setScale)
39 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
43 MapChangeRegionWillChange = 0,
58 MapChangeSourceDidChange
76 explicit Map(QObject *parent =
nullptr,
78 const QSize &size = QSize(),
79 qreal pixelRatio = 1);
82 [[nodiscard]] QString styleJson()
const;
83 [[nodiscard]] QString styleUrl()
const;
85 void setStyleJson(
const QString &);
86 void setStyleUrl(
const QString &);
88 [[nodiscard]]
double latitude()
const;
89 void setLatitude(
double latitude);
91 [[nodiscard]]
double longitude()
const;
92 void setLongitude(
double longitude);
94 [[nodiscard]]
double scale()
const;
95 void setScale(
double scale,
const QPointF ¢er = QPointF());
97 [[nodiscard]]
double zoom()
const;
98 void setZoom(
double zoom);
100 [[nodiscard]]
double minimumZoom()
const;
101 [[nodiscard]]
double maximumZoom()
const;
103 [[nodiscard]]
double bearing()
const;
104 void setBearing(
double degrees);
105 void setBearing(
double degrees,
const QPointF ¢er);
107 [[nodiscard]]
double pitch()
const;
108 void setPitch(
double pitch);
109 void pitchBy(
double pitch);
111 [[nodiscard]] NorthOrientation northOrientation()
const;
112 void setNorthOrientation(NorthOrientation);
115 void setCoordinate(
const Coordinate &coordinate);
116 void setCoordinateZoom(
const Coordinate &coordinate,
double zoom);
120 void setGestureInProgress(
bool inProgress);
122 void setTransitionOptions(qint64 duration, qint64 delay = 0);
124 void addAnnotationIcon(
const QString &name,
const QImage &sprite);
130 bool setLayoutProperty(
const QString &layerId,
const QString &propertyName,
const QVariant &value);
131 bool setPaintProperty(
const QString &layerId,
const QString &propertyName,
const QVariant &value);
133 [[nodiscard]]
bool isFullyLoaded()
const;
135 void moveBy(
const QPointF &offset);
136 void scaleBy(
double scale,
const QPointF ¢er = QPointF());
137 void rotateBy(
const QPointF &first,
const QPointF &second);
139 void resize(
const QSize &size);
141 [[nodiscard]] QPointF pixelForCoordinate(
const Coordinate &coordinate)
const;
142 [[nodiscard]]
Coordinate coordinateForPixel(
const QPointF &pixel)
const;
150 void setMargins(
const QMargins &margins);
151 [[nodiscard]] QMargins margins()
const;
153 void addSource(
const QString &
id,
const QVariantMap ¶ms);
154 bool sourceExists(
const QString &
id);
155 void updateSource(
const QString &
id,
const QVariantMap ¶ms);
156 void removeSource(
const QString &
id);
158 void addImage(
const QString &
id,
const QImage &sprite);
159 void removeImage(
const QString &
id);
161 void addCustomLayer(
const QString &
id,
162 std::unique_ptr<CustomLayerHostInterface> host,
163 const QString &before = QString());
164 void addLayer(
const QString &
id,
const QVariantMap ¶ms,
const QString &before = QString());
165 bool layerExists(
const QString &
id);
166 void removeLayer(
const QString &
id);
168 [[nodiscard]] QVector<QString> layerIds()
const;
170 void setFilter(
const QString &layerId,
const QVariant &filter);
171 [[nodiscard]] QVariant getFilter(
const QString &layerId)
const;
174 void createRenderer();
175 void destroyRenderer();
176 void setOpenGLFramebufferObject(quint32 fbo,
const QSize &size);
180 void setConnectionEstablished();
184 void startStaticRender();
197 std::unique_ptr<MapPrivate> d_ptr;
The Map class is a Qt wrapper for the MapLibre Native engine.
Definition map.hpp:28
void staticRenderFinished(const QString &error)
Signal emitted when a static map is fully drawn.
void copyrightsChanged(const QString ©rightsHtml)
Signal emitted when the copyrights have changed.
NorthOrientation
Definition map.hpp:69
@ NorthRightwards
Definition map.hpp:71
@ NorthLeftwards
Definition map.hpp:73
@ NorthUpwards
Definition map.hpp:70
@ NorthDownwards
Definition map.hpp:72
MapChange
Definition map.hpp:42
@ MapChangeRegionIsChanging
Definition map.hpp:45
@ MapChangeDidFinishRenderingFrameFullyRendered
Definition map.hpp:53
@ MapChangeDidFailLoadingMap
Definition map.hpp:50
@ MapChangeDidFinishRenderingFrame
Definition map.hpp:52
@ MapChangeDidFinishRenderingMap
Definition map.hpp:55
@ MapChangeWillStartRenderingFrame
Definition map.hpp:51
@ MapChangeRegionDidChangeAnimated
Definition map.hpp:47
@ MapChangeWillStartLoadingMap
Definition map.hpp:48
@ MapChangeDidFinishRenderingMapFullyRendered
Definition map.hpp:56
@ MapChangeWillStartRenderingMap
Definition map.hpp:54
@ MapChangeRegionWillChangeAnimated
Definition map.hpp:44
@ MapChangeRegionDidChange
Definition map.hpp:46
@ MapChangeDidFinishLoadingMap
Definition map.hpp:49
@ MapChangeDidFinishLoadingStyle
Definition map.hpp:57
void mapChanged(Map::MapChange)
Signal emitted when the map has changed.
MapLoadingFailure
Definition map.hpp:61
@ StyleParseFailure
Definition map.hpp:62
@ StyleLoadFailure
Definition map.hpp:63
@ NotFoundFailure
Definition map.hpp:64
void mapLoadingFailed(Map::MapLoadingFailure, const QString &reason)
Signal emitted when a map loading failure happens.
void needsRendering()
Signal emitted when the rendering is needed.
The Settings class stores the initial configuration for Map.
Definition settings.hpp:27
Definition geojson.cpp:10
QPair< Coordinate, double > CoordinateZoom
Coordinate-zoom pair helper type.
Definition types.hpp:21
QPair< double, double > Coordinate
Coordinate helper type.
Definition types.hpp:20
quint32 AnnotationID
Annotation identifier helper type.
Definition types.hpp:162
QVariant Annotation
Annotation helper type.
Definition types.hpp:161
Camera options helper type.
Definition types.hpp:165