From 6c6fabbbda4f67a24e60f1e78dc06e42897c2323 Mon Sep 17 00:00:00 2001 From: Niels Date: Fri, 5 Nov 2010 09:58:00 +0100 Subject: [PATCH] move route marker only if routing information is available for that point --- monavlayer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/monavlayer.cpp b/monavlayer.cpp index 9ec026b..dd41867 100644 --- a/monavlayer.cpp +++ b/monavlayer.cpp @@ -143,14 +143,24 @@ void MonavLayer::keyPressed(QKeyEvent *event) case Qt::Key_S: { if (event->modifiers() == Qt::NoModifier) { - m_routeStart = map()->geoPos(); + QPointF p = map()->geoPos(); + UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); + IGPSLookup::Result pos; + if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { + m_routeStart = p; + } } break; } case Qt::Key_E: { if (event->modifiers() == Qt::NoModifier) { - m_routeEnd = map()->geoPos(); + QPointF p = map()->geoPos(); + UnsignedCoordinate coord(GPSCoordinate(p.y(), p.x())); + IGPSLookup::Result pos; + if (m_gpsLookup->GetNearestEdge(&pos, coord, 1000.0)) { + m_routeEnd = p; + } } break; }