[Qt] Implement pan() method

This commit is contained in:
Thiago Marcos P. Santos
2016-05-02 17:51:05 +03:00
parent d3f08f1442
commit 91cdcbebf4
3 changed files with 31 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#include <QGeoCoordinate>
#include <QGeoServiceProvider>
#include <QGeoShape>
#include <QPointF>
#include <QQuickFramebufferObject>
class QDeclarativeGeoServiceProvider;
@@ -36,6 +37,7 @@ public:
// QQuickFramebufferObject implementation.
virtual Renderer *createRenderer() const Q_DECL_FINAL;
// Map QML Type interface implementation.
void setPlugin(QDeclarativeGeoServiceProvider *plugin);
QDeclarativeGeoServiceProvider *plugin() const;
@@ -63,14 +65,20 @@ public:
void setColor(const QColor &color);
QColor color() const;
Q_INVOKABLE void pan(int dx, int dy);
// MapboxGL QML Type interface.
void setStyle(const QString &style);
QString style() const;
QPointF swapPan();
enum SyncState {
NothingNeedsSync = 0x00,
ZoomNeedsSync = 0x01,
CenterNeedsSync = 0x02,
StyleNeedsSync = 0x04,
PanNeedsSync = 0x08,
};
int swapSyncState();
@@ -95,6 +103,8 @@ private:
qreal m_maximumZoomLevel = 20;
qreal m_zoomLevel = 20;
QPointF m_pan = QPointF(0, 0);
QGeoCoordinate m_center;
QGeoShape m_visibleRegion;