[Marble-commits] KDE/kdeedu/marble/src/lib/gps

Dennis Nienhüser earthwings at gentoo.org
Sun Jan 31 13:20:12 CET 2010


SVN commit 1082865 by nienhueser:

Fix gps route drawing: Update previous point to avoid drawing each line to the route start, do not paint at invalid positions.


 M  +7 -5      Route.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/gps/Route.cpp #1082864:1082865
@@ -30,23 +30,25 @@
     //record the positions of the points
     QPoint firstPos;
     QPoint secondPos;
-    const_iterator it;
+    iterator it;
 
     // Initialise first to the beginning of the vector.
     first = *(begin());
 
-    for ( it = constBegin(); it < constEnd(); ++it){
-        first->getPixelPos( canvasSize, viewParams,
+    for ( it = begin(); it < end(); ++it){
+        bool valid = first->getPixelPos( canvasSize, viewParams,
                             &firstPos );
 
-        (*it)->getPixelPos( canvasSize, viewParams , 
+        valid = valid && (*it)->getPixelPos( canvasSize, viewParams ,
                             &secondPos );
 
-        if ( distance( firstPos, secondPos ) > 25 ) {
+        if ( valid && distance( firstPos, secondPos ) > 25 ) {
             first->draw( painter, firstPos );
             (*it)->draw( painter, secondPos );
             painter->drawLine( firstPos, secondPos );
         }
+
+        first = *it;
     }
 }
 


More information about the Marble-commits mailing list