[Qt] Implement bearing on the QML Mapbox Map type

This commit is contained in:
Thiago Marcos P. Santos
2016-05-02 19:14:54 +03:00
parent 91cdcbebf4
commit 41f63db98b
3 changed files with 34 additions and 0 deletions

View File

@@ -6,6 +6,8 @@
#include <QString>
#include <QtGlobal>
#include <cmath>
QQuickMapboxGL::QQuickMapboxGL(QQuickItem *parent_)
: QQuickFramebufferObject(parent_)
{
@@ -186,6 +188,27 @@ QString QQuickMapboxGL::style() const
return m_style;
}
void QQuickMapboxGL::setBearing(qreal angle)
{
angle = std::fmod(angle, 360.);
if (m_bearing == angle) {
return;
}
m_bearing = angle;
m_syncState |= BearingNeedsSync;
update();
emit bearingChanged(m_bearing);
}
qreal QQuickMapboxGL::bearing() const
{
return m_bearing;
}
QPointF QQuickMapboxGL::swapPan()
{
QPointF oldPan = m_pan;