// // This file is part of the Marble Desktop Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007 Andrew Manson // #include "Route.h" #include "ClipPainter.h" #include using namespace Marble; Route::Route() : AbstractLayerContainer(), GpsElement(), AbstractLayerData(0,0) { } void Route::draw( ClipPainter *painter, const QSize &canvasSize, ViewParams *viewParams ) { //temporary item to keep track of previous point AbstractLayerData *first=0; //record the positions of the points QPoint firstPos; QPoint secondPos; const_iterator it; // Initialise first to the beginning of the vector. first = *(begin()); for ( it = constBegin(); it < constEnd(); ++it){ first->getPixelPos( canvasSize, viewParams, &firstPos ); (*it)->getPixelPos( canvasSize, viewParams , &secondPos ); if ( distance( firstPos, secondPos ) > 25 ) { first->draw( painter, firstPos ); (*it)->draw( painter, secondPos ); painter->drawLine( firstPos, secondPos ); } } } void Route::draw( ClipPainter*, const QPoint& ) { } void Route::printToStream( QTextStream &out ) const { out << ""; AbstractLayerContainer::printToStream( out ); out << ""; }