diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-11-18 15:13:17 +0100 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-04-20 20:55:51 +0300 |
commit | 41dd14d208e0f485e38a7e32f3eb8df4ef2d8f95 (patch) | |
tree | 2e192de7cdfdede232ac8340fb64e5ce84021458 | |
parent | cb52a785425ca69930f0f224c3029e6f7fb2a63a (diff) | |
download | qtlocation-mapboxgl-41dd14d208e0f485e38a7e32f3eb8df4ef2d8f95.tar.gz |
[Qt] expose NorthOrientation
-rw-r--r-- | platform/qt/include/qmapboxgl.hpp | 11 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 22 |
2 files changed, 33 insertions, 0 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index 3f5e3724fc..83e5bb1830 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -61,6 +61,14 @@ public: typedef QPair<CoordinateSegments, QString> ShapeAnnotation; typedef QList<ShapeAnnotation> ShapeAnnotations; + // Determines the orientation of the map. + enum NorthOrientation { + NorthUpwards, // Default + NorthRightwards, + NorthDownwards, + NorthLeftwards, + }; + QMapboxGL(QObject *parent = 0, const QMapboxGLSettings& = QMapboxGLSettings()); virtual ~QMapboxGL(); @@ -94,6 +102,9 @@ public: double pitch() const; void setPitch(double pitch, int milliseconds = 0); + NorthOrientation northOrientation() const; + void setNorthOrientation(NorthOrientation); + Coordinate coordinate() const; void setCoordinate(const Coordinate &, int milliseconds = 0); void setCoordinateZoom(const Coordinate &, double zoom, int milliseconds = 0); diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index b66e2407d5..ae00eadbf2 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -198,6 +198,28 @@ void QMapboxGL::setPitch(double pitch_, int milliseconds) d_ptr->mapObj->setPitch(pitch_, std::chrono::milliseconds(milliseconds)); } +QMapboxGL::NorthOrientation QMapboxGL::northOrientation() const +{ + using NO = mbgl::NorthOrientation; + switch (d_ptr->mapObj->getNorthOrientation()) { + case NO::Rightwards: return NorthRightwards; + case NO::Downwards: return NorthDownwards; + case NO::Leftwards: return NorthLeftwards; + default: return NorthUpwards; + } +} + +void QMapboxGL::setNorthOrientation(NorthOrientation orientation) +{ + using NO = mbgl::NorthOrientation; + switch (orientation) { + case NorthRightwards: d_ptr->mapObj->setNorthOrientation(NO::Rightwards); break; + case NorthDownwards: d_ptr->mapObj->setNorthOrientation(NO::Downwards); break; + case NorthLeftwards: d_ptr->mapObj->setNorthOrientation(NO::Leftwards); break; + default: d_ptr->mapObj->setNorthOrientation(NO::Upwards); break; + } +} + void QMapboxGL::setGestureInProgress(bool inProgress) { d_ptr->mapObj->setGestureInProgress(inProgress); |