diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-04-27 19:52:38 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-04-27 21:53:21 +0300 |
commit | 30fb7f473845116d6c68ad31c2c7ce016e1121ad (patch) | |
tree | 36fc7f6d2834f314e6fb7dcdeb0f099cdc84bcbb /platform/qt/include | |
parent | 2656b5c733a7c7a18f81c80518e4bfef75b03582 (diff) | |
download | qtlocation-mapboxgl-30fb7f473845116d6c68ad31c2c7ce016e1121ad.tar.gz |
[Qt] Expose center and zoom properties
Diffstat (limited to 'platform/qt/include')
-rw-r--r-- | platform/qt/include/qquickmapboxgl.hpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/platform/qt/include/qquickmapboxgl.hpp b/platform/qt/include/qquickmapboxgl.hpp index 8dfec6b369..6d24ca6732 100644 --- a/platform/qt/include/qquickmapboxgl.hpp +++ b/platform/qt/include/qquickmapboxgl.hpp @@ -1,6 +1,8 @@ #ifndef QQUICKMAPBOXGL_H #define QQUICKMAPBOXGL_H +#include <QGeoCoordinate> +#include <QGeoShape> #include <QQuickFramebufferObject> class QQuickItem; @@ -9,12 +11,57 @@ class Q_DECL_EXPORT QQuickMapboxGL : public QQuickFramebufferObject { Q_OBJECT + Q_PROPERTY(qreal minimumZoomLevel READ minimumZoomLevel WRITE setMinimumZoomLevel NOTIFY minimumZoomLevelChanged) + Q_PROPERTY(qreal maximumZoomLevel READ maximumZoomLevel WRITE setMaximumZoomLevel NOTIFY maximumZoomLevelChanged) + Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged) + Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) + Q_PROPERTY(QGeoShape visibleRegion READ visibleRegion WRITE setVisibleRegion) + public: QQuickMapboxGL(QQuickItem *parent = 0); virtual ~QQuickMapboxGL(); - // Called from render thread. + // QQuickFramebufferObject implementation. virtual Renderer *createRenderer() const Q_DECL_FINAL; + + void setMinimumZoomLevel(qreal minimumZoomLevel); + qreal minimumZoomLevel() const; + + void setMaximumZoomLevel(qreal maximumZoomLevel); + qreal maximumZoomLevel() const; + + void setZoomLevel(qreal zoomLevel); + qreal zoomLevel() const; + + void setCenter(const QGeoCoordinate ¢er); + QGeoCoordinate center() const; + + void setVisibleRegion(const QGeoShape &shape); + QGeoShape visibleRegion() const; + + enum SyncState { + NothingNeedsSync = 0x00, + ZoomNeedsSync = 0x01, + CenterNeedsSync = 0x02, + }; + + int swapSyncState(); + +signals: + void minimumZoomLevelChanged(); + void maximumZoomLevelChanged(); + void zoomLevelChanged(qreal zoomLevel); + void centerChanged(const QGeoCoordinate &coordinate); + +private: + qreal m_minimumZoomLevel = 0; + qreal m_maximumZoomLevel = 20; + qreal m_zoomLevel = 20; + + QGeoCoordinate m_center; + QGeoShape m_visibleRegion; + + int m_syncState = NothingNeedsSync; }; #endif // QQUICKMAPBOXGL_H |