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

Jens-Michael Hoffmann jensmh at gmx.de
Fri Apr 30 23:00:53 CEST 2010


Am Freitag, 30. April 2010 21:42:05 schrieb Dennis Nienhüser:
> SVN commit 1121201 by nienhueser:
> 
> Code style: More white spaces fixes (astyle)
> 
>  M  +2 -1      AbstractRoutingProvider.cpp  
>  M  +2 -1      AbstractRoutingProvider.h  
>  M  +3 -3      OrsRoutingProvider.cpp  
>  M  +2 -1      OrsRoutingProvider.h  
>  M  +2 -1      RouteSkeleton.cpp  
>  M  +2 -1      RouteSkeleton.h  
>  M  +3 -3      RoutingInputWidget.cpp  
>  M  +2 -1      RoutingInputWidget.h  
>  M  +13 -23    RoutingLayer.cpp  
>  M  +2 -1      RoutingLayer.h  
>  M  +2 -1      RoutingManager.cpp  
>  M  +2 -1      RoutingManager.h  
>  M  +9 -15     RoutingModel.cpp  
>  M  +2 -1      RoutingModel.h  
>  M  +2 -1      RoutingProxyModel.cpp  
>  M  +2 -1      RoutingProxyModel.h  
>  M  +5 -4      RoutingWidget.cpp  
>  U             RoutingWidget.h  
>  M  +2 -1      YoursRoutingProvider.cpp  
>  M  +2 -1      YoursRoutingProvider.h  
> 
> 
> --- trunk/KDE/kdeedu/marble/src/lib/routing/AbstractRoutingProvider.cpp #1121200:1121201
> @@ -10,7 +10,8 @@
>  
>  #include "AbstractRoutingProvider.h"
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  AbstractRoutingProvider::AbstractRoutingProvider( QObject *parent ) :
>          QObject( parent )
> --- trunk/KDE/kdeedu/marble/src/lib/routing/AbstractRoutingProvider.h #1121200:1121201
> @@ -16,7 +16,8 @@
>  #include <QtCore/QByteArray>
>  #include <QtCore/QObject>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RouteSkeleton;
>  
> --- trunk/KDE/kdeedu/marble/src/lib/routing/OrsRoutingProvider.cpp #1121200:1121201
> @@ -18,7 +18,8 @@
>  #include <QtNetwork/QNetworkAccessManager>
>  #include <QtNetwork/QNetworkReply>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  OrsRoutingProvider::OrsRoutingProvider( QObject *parent ) :
>          AbstractRoutingProvider( parent ),
> @@ -138,8 +139,7 @@
>  {
>      QString result = "</xls:WayPointList>\n";
>  
> -    if ( avoidFeatures != RouteSkeleton::AvoidNone )
> -    {
> +    if ( avoidFeatures != RouteSkeleton::AvoidNone ) {
>        result += "<xls:AvoidList>\n"; {
>        if ( avoidFeatures & RouteSkeleton::AvoidTollWay )
>          result += "<xls:AvoidFeature>Tollway</xls:AvoidFeature>";
> --- trunk/KDE/kdeedu/marble/src/lib/routing/OrsRoutingProvider.h #1121200:1121201
> @@ -18,7 +18,8 @@
>  
>  class QNetworkAccessManager;
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  /**
>    * @brief A AbstractRoutingProvider that retrieves routing
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RouteSkeleton.cpp #1121200:1121201
> @@ -16,7 +16,8 @@
>  #include <QtCore/QMap>
>  #include <QtGui/QPainter>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RouteSkeletonPrivate
>  {
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RouteSkeleton.h #1121200:1121201
> @@ -16,7 +16,8 @@
>  
>  #include <QtCore/QFlags>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RouteSkeletonPrivate;
>  
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1121200:1121201
> @@ -28,7 +28,8 @@
>  #include <QtNetwork/QNetworkReply>
>  #include <QtXml/QDomDocument>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingInputWidgetPrivate
>  {
> @@ -211,8 +212,7 @@
>      QString text = d->m_lineEdit->text();
>      if ( text.isEmpty() ) {
>          setInvalid();
> -    }
> -    else {
> +    } else {
>          d->m_pickButton->setVisible( false );
>          d->m_stateButton->setVisible( true );
>          d->m_progressTimer.start();
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.h #1121200:1121201
> @@ -17,7 +17,8 @@
>  
>  class QNetworkReply;
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingInputWidgetPrivate;
>  class MarblePlacemarkModel;
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1121200:1121201
> @@ -28,7 +28,8 @@
>  #include <QtGui/QMouseEvent>
>  #include <QtGui/QPixmap>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingLayerPrivate
>  {
> @@ -38,8 +39,7 @@
>          QRegion region;
>  
>          PaintRegion( const T &index_, const QRegion &region_ ) :
> -                index( index_ ), region( region_ )
> -        {
> +                index( index_ ), region( region_ ) {

this change does not look correct to me, opening braces of methods
should be on their own line.

>              // nothing to do
>          }
>      };    
> @@ -190,8 +190,7 @@
>          GeoDataCoordinates pos = qVariantValue<GeoDataCoordinates>( index.data( RoutingModel::CoordinateRole ) );
>          RoutingModel::RoutingItemType type = qVariantValue<RoutingModel::RoutingItemType>( index.data( RoutingModel::TypeRole ) );
>  
> -        if ( type == RoutingModel::WayPoint )
> -        {
> +        if ( type == RoutingModel::WayPoint ) {
>              waypoints << pos;
>          }
>      }
> @@ -217,8 +216,7 @@
>          painter->drawPixmap( center, m_targetPixmap );
>      }
>  
> -    for ( int i=0; i<m_routingModel->rowCount(); ++i )
> -    {
> +    for ( int i = 0; i < m_routingModel->rowCount(); ++i ) {
>          QModelIndex index = m_routingModel->index( i,0 );
>          GeoDataCoordinates pos = qVariantValue<GeoDataCoordinates>( index.data( RoutingModel::CoordinateRole ) );
>          RoutingModel::RoutingItemType type = qVariantValue<RoutingModel::RoutingItemType>( index.data( RoutingModel::TypeRole ) );
> @@ -227,8 +225,7 @@
>  
>              painter->setBrush( QBrush( QColor::fromRgb( 136,138,133,200 ) ) ); // gray, oxygen palette
>              QModelIndex proxyIndex = m_proxyModel->mapFromSource( index );
> -            if ( m_selectionModel->selection().contains( proxyIndex ) )
> -            {
> +            if ( m_selectionModel->selection().contains( proxyIndex ) ) {
>                  painter->setPen( QColor( Qt::black ) );
>                  painter->setBrush( QBrush( QColor::fromRgb( 227,173,0,200 ) ) ); // yellow, oxygen palette
>                  painter->drawAnnotation( pos, index.data().toString(), QSize( 120,60 ), 10, 30, 15, 15 );
> @@ -271,14 +268,12 @@
>                  m_insertStopOver = QPoint();
>                  m_dragStopOver = false;
>                  return true;
> -            }
> -            else if ( e->button() == Qt::RightButton ) {
> +            } else if ( e->button() == Qt::RightButton ) {
>                  m_removeViaPointAction->setEnabled( true );
>                  m_activeMenuIndex = region.index;
>                  showContextMenu( e->pos() );
>                  return true;
> -            }
> -            else
> +            } else
>                  return false;
>          }
>      }
> @@ -291,13 +286,11 @@
>                  m_insertStopOver = QPoint();
>                  m_dragStopOver = false;
>                  return true;
> -            }
> -            else if ( e->button() == Qt::RightButton ) {
> +            } else if ( e->button() == Qt::RightButton ) {
>                  m_removeViaPointAction->setEnabled( false );
>                  showContextMenu( e->pos() );
>                  return true;
> -            }
> -            else
> +            } else
>                  return false;
>          }
>      }
> @@ -308,13 +301,11 @@
>              m_insertStopOver = e->pos();
>              m_dragStopOver = true;
>              return true;
> -        }
> -        else if ( e->button() == Qt::RightButton ) {
> +        } else if ( e->button() == Qt::RightButton ) {
>              m_removeViaPointAction->setEnabled( false );
>              showContextMenu( e->pos() );
>              return true;
> -        }
> -        else
> +        } else
>              return false;
>      }
>  
> @@ -387,8 +378,7 @@
>              GeoDataCoordinates moved( lon,lat );
>              m_routeSkeleton->setPosition( m_movingIndex, moved );
>              m_marbleWidget->setCursor( Qt::ArrowCursor );
> -        }
> -        else if ( m_dragStopOver ) {
> +        } else if ( m_dragStopOver ) {
>              m_insertStopOver = e->pos();
>              m_marbleWidget->setCursor( Qt::ArrowCursor );
>          } else if ( isInfoPoint( e->pos() ) ) {
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.h #1121200:1121201
> @@ -19,7 +19,8 @@
>  class QAbstractProxyModel;
>  class QItemSelectionModel;
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class MarbleWidget;
>  class RoutingModel;
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.cpp #1121200:1121201
> @@ -15,7 +15,8 @@
>  #include "RouteSkeleton.h"
>  #include "RoutingModel.h"
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingManagerPrivate
>  {
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.h #1121200:1121201
> @@ -16,7 +16,8 @@
>  
>  #include <QtCore/QAbstractItemModel>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingManagerPrivate;
>  class MarbleWidget;
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1121200:1121201
> @@ -24,10 +24,10 @@
>  #include <QtGui/QPixmap>
>  #include <QtXml/QDomDocument>
>  
> -namespace Marble {
> -
> -    struct RouteElement
> +namespace Marble
>      {
> +
> +struct RouteElement {
>          GeoDataCoordinates position;
>          RoutingModel::RoutingItemType type;
>          QString description;
> @@ -86,8 +86,7 @@
>  
>      QVariant RoutingModel::headerData ( int section, Qt::Orientation orientation, int role ) const
>      {
> -        if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section == 0 )
> -        {
> +    if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section == 0 ) {
>              return QString( "Instruction" );
>          }
>  
> @@ -100,8 +99,7 @@
>              return QVariant();
>          }
>  
> -        if ( index.row() < d->m_route.size() && index.column() == 0 )
> -        {
> +    if ( index.row() < d->m_route.size() && index.column() == 0 ) {
>              RouteElement element = d->m_route.at( index.row() );
>              switch ( role ) {
>              case Qt::DisplayRole:
> @@ -168,8 +166,7 @@
>                  QString unit = distance.item( 0 ).attributes().namedItem( "uom" ).nodeValue();
>                  if ( unit == "M" ) {
>                    d->m_totalDistance *= METER2KM;
> -                }
> -                else if ( unit != "KM" ) {
> +                } else if ( unit != "KM" ) {
>                    mDebug() << "Cannot parse distance unit " << unit << ", treated as km.";
>                  }
>                }
> @@ -179,8 +176,7 @@
>          QDomNodeList geometry = root.elementsByTagName( "xls:RouteGeometry" );
>          if ( geometry.size() > 0 ) {
>              QDomNodeList waypoints = geometry.item( 0 ).toElement().elementsByTagName( "gml:pos" );
> -            for ( unsigned int i = 0; i < waypoints.length(); ++i )
> -            {
> +        for ( unsigned int i = 0; i < waypoints.length(); ++i ) {
>                  QDomNode node = waypoints.item( i );
>                  QStringList content = node.toElement().text().split( ' ' );
>                  if ( content.length() == 2 ) {
> @@ -194,8 +190,7 @@
>          QDomNodeList instructionList = root.elementsByTagName( "xls:RouteInstructionsList" );
>          if ( instructionList.size() > 0 ) {
>              QDomNodeList instructions = instructionList.item( 0 ).toElement().elementsByTagName( "xls:RouteInstruction" );
> -            for ( unsigned int i = 0; i < instructions.length(); ++i )
> -            {               
> +        for ( unsigned int i = 0; i < instructions.length(); ++i ) {
>                  QDomElement node = instructions.item( i ).toElement();
>  
>                  QDomNodeList textNodes = node.elementsByTagName( "xls:Instruction" );
> @@ -241,8 +236,7 @@
>              qreal lon = element.position.longitude( GeoDataCoordinates::Degree );
>              qreal lat = element.position.latitude( GeoDataCoordinates::Degree );
>              content += QString( "<trkpt lat=\"%1\" lon=\"%2\"></trkpt>\n" ).arg( lat,0,'f',7 ).arg( lon,0,'f',7 );
> -        }
> -        else {
> +        } else {
>            instructions << element;
>          }
>      }
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.h #1121200:1121201
> @@ -22,7 +22,8 @@
>    * destination. Steps near the source come first, steps near the target
>    * last.
>    */
> -namespace Marble {
> +namespace Marble
> +{
>  
>  class RoutingModelPrivate;
>  class GeoDataDocument;
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProxyModel.cpp #1121200:1121201
> @@ -12,7 +12,8 @@
>  
>  #include "RoutingModel.h"
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  RoutingProxyModel::RoutingProxyModel( QObject *parent ) :
>          QSortFilterProxyModel( parent )
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProxyModel.h #1121200:1121201
> @@ -13,7 +13,8 @@
>  
>  #include <QtGui/QSortFilterProxyModel>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  /**
>    * @brief A QAbstractItemModel that contains a list of routing instructions.
> --- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1121200:1121201
> @@ -29,9 +29,11 @@
>  
>  #include "ui_RoutingWidget.h"
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
> -class RoutingWidgetPrivate {
> +class RoutingWidgetPrivate
> +{
>  public:
>      Ui::RoutingWidget m_ui;
>  
> @@ -394,8 +396,7 @@
>          d->m_inputRequest = widget;
>          d->m_routingLayer->setPointSelectionEnabled( true );
>          d->m_widget->setFocus( Qt::OtherFocusReason );
> -    }
> -    else {
> +    } else {
>          d->m_routingLayer->setPointSelectionEnabled( false );
>      }
>  }
> --- trunk/KDE/kdeedu/marble/src/lib/routing/YoursRoutingProvider.cpp #1121200:1121201
> @@ -17,7 +17,8 @@
>  #include <QtNetwork/QNetworkAccessManager>
>  #include <QtNetwork/QNetworkReply>
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  YoursRoutingProvider::YoursRoutingProvider( QObject *parent ) :
>          AbstractRoutingProvider( parent ),
> --- trunk/KDE/kdeedu/marble/src/lib/routing/YoursRoutingProvider.h #1121200:1121201
> @@ -17,7 +17,8 @@
>  
>  class QNetworkAccessManager;
>  
> -namespace Marble {
> +namespace Marble
> +{
>  
>  /**
>    * @brief A AbstractRoutingProvider that retrieves routing
> _______________________________________________
> Marble-commits mailing list
> Marble-commits at kde.org
> https://mail.kde.org/mailman/listinfo/marble-commits
> 



More information about the Marble-commits mailing list