Commit c6c2ad73 authored by Sanjiban Bairagya's avatar Sanjiban Bairagya Committed by Sanjiban Bairagya

Fix for Route Simulation position provider plugin

not working for route-navigation
parent 7c490323
......@@ -107,7 +107,7 @@ RouteSimulationPositionProviderPlugin::RouteSimulationPositionProviderPlugin( Ma
m_direction( 0.0 ),
m_directionWithNoise(0.0)
{
// nothing to do
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(update()));
}
RouteSimulationPositionProviderPlugin::~RouteSimulationPositionProviderPlugin()
......@@ -116,13 +116,8 @@ RouteSimulationPositionProviderPlugin::~RouteSimulationPositionProviderPlugin()
void RouteSimulationPositionProviderPlugin::initialize()
{
m_currentIndex = -1;
m_lineString = m_lineStringInterpolated = m_marbleModel->routingManager()->routingModel()->route().path();
m_speed = 0; //initialize speed to be around 25 m/s;
m_status = m_lineString.isEmpty() ? PositionProviderStatusUnavailable : PositionProviderStatusAcquiring;
if ( !m_lineString.isEmpty() ) {
QTimer::singleShot( 1000.0 / c_frequency, this, SLOT(update()) );
}
updateRoute();
connect(m_marbleModel->routingManager()->routingModel(), SIGNAL(currentRouteChanged()), this, SLOT(updateRoute()));
}
bool RouteSimulationPositionProviderPlugin::isInitialized() const
......@@ -145,6 +140,18 @@ QDateTime RouteSimulationPositionProviderPlugin::timestamp() const
return m_currentDateTime;
}
void RouteSimulationPositionProviderPlugin::updateRoute(){
m_currentIndex = -1;
m_lineString = m_lineStringInterpolated = m_marbleModel->routingManager()->routingModel()->route().path();
m_speed = 0; //initialize speed to be around 25 m/s;
m_status = m_lineString.isEmpty() ? PositionProviderStatusUnavailable : PositionProviderStatusAcquiring;
if ( !m_lineString.isEmpty() ) {
m_updateTimer.start(1000.0 / c_frequency);
} else {
m_updateTimer.stop();
}
}
void RouteSimulationPositionProviderPlugin::update()
{
if ( m_currentIndex >= 0 && m_currentIndex < m_lineStringInterpolated.size() ) {
......@@ -251,8 +258,6 @@ void RouteSimulationPositionProviderPlugin::update()
emit statusChanged( PositionProviderStatusUnavailable );
}
}
QTimer::singleShot( 1000.0 / c_frequency, this, SLOT(update()) );
}
GeoDataCoordinates RouteSimulationPositionProviderPlugin::addNoise(const Marble::GeoDataCoordinates &position, const Marble::GeoDataAccuracy &accuracy ) const
......
......@@ -18,6 +18,7 @@
#include "GeoDataLineString.h"
#include <QDateTime>
#include <QTimer>
namespace Marble
{
......@@ -59,6 +60,7 @@ public:
private Q_SLOTS:
/** Regular (each second) position and status update */
void update();
void updateRoute();
private:
GeoDataCoordinates addNoise(const Marble::GeoDataCoordinates &,const Marble::GeoDataAccuracy &) const;
......@@ -75,6 +77,7 @@ private:
qreal m_speed;
qreal m_direction;
qreal m_directionWithNoise;
QTimer m_updateTimer;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment