summaryrefslogtreecommitdiffstats
path: root/app/qcheapruler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/qcheapruler.cpp')
-rw-r--r--app/qcheapruler.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/app/qcheapruler.cpp b/app/qcheapruler.cpp
index 890fd63..6e2f59c 100644
--- a/app/qcheapruler.cpp
+++ b/app/qcheapruler.cpp
@@ -1,13 +1,12 @@
#include "qcheapruler.hpp"
-#include "naviapi_adaptor.h"
#include <QString>
QCheapRuler::QCheapRuler()
{
//set the default current position
- // m_currentPosition = QGeoCoordinate(36.136261, -115.151254);
- m_currentPosition = QGeoCoordinate(35.692396, 139.691102);
+ m_currentPosition = QGeoCoordinate(36.136261, -115.151254);
+ //m_currentPosition = QGeoCoordinate(35.692396, 139.691102);
}
QCheapRuler::~QCheapRuler()
@@ -26,6 +25,14 @@ double QCheapRuler::currentDistance() const
return m_currentDistance;
}
+//get the current Coordinate
+void QCheapRuler::setCurrentCoordinate(QString m_latitude,QString m_longitude)
+{
+ double latitude = m_latitude.toDouble();
+ double longitude = m_longitude.toDouble();
+ setCurrentPosition(latitude,longitude);
+}
+
//set current position below the coordinate info from navigation service
void QCheapRuler::setCurrentPosition(double latitude, double longitude)
{
@@ -39,10 +46,12 @@ void QCheapRuler::setCurrentPosition(double latitude, double longitude)
}
}
-void QCheapRuler::setCurrentDistance(double distance)
+void QCheapRuler::setCurrentDistance(QString strdistance)
{
+ double distance = strdistance.toDouble();
//set current distance info and notify the changes when the info has changed
//but it will not send notify when it start or stop demo
+
if((m_currentDistance != distance)
&&(distance != 0.0))
{
@@ -59,7 +68,7 @@ QGeoCoordinate QCheapRuler::currentPosition() const
QJSValue QCheapRuler::path() const
{
- // Should neveer be called.
+ // Should never be called.
return QJSValue();
}
@@ -95,17 +104,6 @@ void QCheapRuler::setPath(const QJSValue &value)
emit pathChanged();
}
-//init the route and postion info when start in the first time.(can be called by qml)
-void QCheapRuler::initRouteInfo()
-{
- //send "getRouteInfo" message to the navigation service
- QDBusMessage message = QDBusMessage::createSignal("/", "org.agl.naviapi", "getRouteInfo");
- if(!QDBusConnection::sessionBus().send(message))
- {
- qDebug() << "initRouteInfo" << "sessionBus.send(): getRouteInfo failed";
- }
-}
-
//init the CheapRuler class
cr::CheapRuler QCheapRuler::ruler() const
{