[Qt] expose NorthOrientation

This commit is contained in:
Konstantin Käfer
2015-11-18 15:13:17 +01:00
committed by Thiago Marcos P. Santos
parent cb52a78542
commit 41dd14d208
2 changed files with 33 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);