[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Fri Apr 30 21:42:02 CEST 2010
SVN commit 1121199 by nienhueser:
Code style: Curly braces also for if / for one-liners
M +2 -1 OrsRoutingProvider.cpp
M +4 -2 RouteSkeleton.cpp
M +4 -2 RoutingInputWidget.cpp
M +8 -7 RoutingLayer.cpp
M +2 -1 RoutingModel.cpp
M +3 -1 RoutingProxyModel.cpp
M +10 -5 RoutingWidget.cpp
M +2 -1 YoursRoutingProvider.cpp
--- trunk/KDE/kdeedu/marble/src/lib/routing/OrsRoutingProvider.cpp #1121198:1121199
@@ -30,8 +30,9 @@
void OrsRoutingProvider::retrieveDirections( RouteSkeleton *route )
{
- if ( route->size() < 2 )
+ if ( route->size() < 2 ) {
return;
+ }
GeoDataCoordinates source = route->source();
GeoDataCoordinates destination = route->destination();
--- trunk/KDE/kdeedu/marble/src/lib/routing/RouteSkeleton.cpp #1121198:1121199
@@ -119,16 +119,18 @@
GeoDataCoordinates RouteSkeleton::source() const
{
GeoDataCoordinates result;
- if ( d->m_route.size() )
+ if ( d->m_route.size() ) {
result = d->m_route.first();
+ }
return result;
}
GeoDataCoordinates RouteSkeleton::destination() const
{
GeoDataCoordinates result;
- if ( d->m_route.size() )
+ if ( d->m_route.size() ) {
result = d->m_route.last();
+ }
return result;
}
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1121198:1121199
@@ -155,8 +155,9 @@
void RoutingInputWidget::startHttpRequest()
{
- if ( !hasTargetPosition() )
+ if ( !hasTargetPosition() ) {
return;
+ }
GeoDataCoordinates position = targetPosition();
QString base = "http://nominatim.openstreetmap.org/reverse?format=xml&addressdetails=0";
@@ -300,8 +301,9 @@
void RoutingInputWidget::handleHttpReply( QNetworkReply *reply )
{
- if ( !reply->bytesAvailable() )
+ if ( !reply->bytesAvailable() ) {
return;
+ }
QDomDocument xml;
if ( !xml.setContent( reply->readAll() ) ) {
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingLayer.cpp #1121198:1121199
@@ -186,8 +186,7 @@
m_instructionRegions.clear();
GeoDataLineString waypoints;
- 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 ) );
@@ -415,8 +414,7 @@
bool RoutingLayerPrivate::handleKeyEvent( QKeyEvent *e )
{
- if ( m_pointSelection && e->key() == Qt::Key_Escape )
- {
+ if ( m_pointSelection && e->key() == Qt::Key_Escape ) {
m_pointSelection = false;
emit q->pointSelectionAborted();
return true;
@@ -485,14 +483,17 @@
painter->save();
painter->setRenderHint( QPainter::Antialiasing, true );
- if ( d->m_placemarkModel)
+ if ( d->m_placemarkModel) {
d->renderPlacemarks( painter );
+ }
- if ( d->m_routingModel)
+ if ( d->m_routingModel) {
d->renderRoute( painter );
+ }
- if ( d->m_routeSkeleton)
+ if ( d->m_routeSkeleton) {
d->renderSkeleton( painter );
+ }
painter->restore();
return true;
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1121198:1121199
@@ -96,8 +96,9 @@
QVariant RoutingModel::data ( const QModelIndex & index, int role ) const
{
- if ( !index.isValid() )
+ if ( !index.isValid() ) {
return QVariant();
+ }
if ( index.row() < d->m_route.size() && index.column() == 0 )
{
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingProxyModel.cpp #1121198:1121199
@@ -25,8 +25,10 @@
bool RoutingProxyModel::filterAcceptsRow ( int source_row, const QModelIndex &source_parent ) const
{
Q_UNUSED( source_parent )
- if ( !sourceModel() )
+
+ if ( !sourceModel() ) {
return false;
+ }
QModelIndex index = sourceModel()->index( source_row, 0 );
RoutingModel::RoutingItemType type = qVariantValue<RoutingModel::RoutingItemType>( index.data( RoutingModel::TypeRole ) );
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1121198:1121199
@@ -198,17 +198,22 @@
int index = d->m_ui.routePreferenceComboBox->currentIndex();
RouteSkeleton::RoutePreference pref = RouteSkeleton::CarFastest;
- if ( index == 1 )
+ if ( index == 1 ) {
pref = RouteSkeleton::CarShortest;
- if ( index == 2 )
+ }
+ if ( index == 2 ) {
pref = RouteSkeleton::Bicycle;
- if ( index == 3 )
+ }
+ if ( index == 3 ) {
pref = RouteSkeleton::Pedestrian;
+ }
RouteSkeleton::AvoidFeatures avoid = RouteSkeleton::AvoidNone;
- if ( d->m_ui.highwaysCheckBox->isChecked() )
+ if ( d->m_ui.highwaysCheckBox->isChecked() ) {
avoid |= RouteSkeleton::AvoidHighway;
- if ( d->m_ui.tollWaysCheckBox->isChecked() )
+ }
+ if ( d->m_ui.tollWaysCheckBox->isChecked() ) {
avoid |= RouteSkeleton::AvoidTollWay;
+ }
d->m_routeSkeleton->setRoutePreference( pref );
d->m_routeSkeleton->setAvoidFeatures( avoid );
--- trunk/KDE/kdeedu/marble/src/lib/routing/YoursRoutingProvider.cpp #1121198:1121199
@@ -29,8 +29,9 @@
void YoursRoutingProvider::retrieveDirections( RouteSkeleton *route )
{
- if ( route->size() < 2 )
+ if ( route->size() < 2 ) {
return;
+ }
GeoDataCoordinates source = route->source();
GeoDataCoordinates destination = route->destination();
More information about the Marble-commits
mailing list