[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Sun Sep 5 12:23:17 CEST 2010
SVN commit 1171823 by nienhueser:
RoutingManager creates and owns the route request, public access for others.
CCBUG: 248086
M +1 -0 RoutingInputWidget.cpp
M +16 -11 RoutingManager.cpp
M +2 -0 RoutingManager.h
M +1 -2 RoutingWidget.cpp
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1171822:1171823
@@ -284,6 +284,7 @@
d->m_lineEdit->setText( position.toString() );
d->m_stateButton->setVisible( hasTargetPosition() );
d->m_stateButton->setIcon( d->m_route->pixmap( d->m_index ) );
+ d->m_pickButton->setVisible( !hasTargetPosition() );
d->m_pickButton->setIcon( d->m_route->pixmap( d->m_index ) );
emit targetValidityChanged( hasTargetPosition() );
d->adjustText();
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.cpp #1171822:1171823
@@ -34,7 +34,7 @@
AlternativeRoutesModel* m_alternativeRoutesModel;
- RouteRequest *m_route;
+ RouteRequest *m_routeRequest;
bool m_workOffline;
@@ -52,7 +52,7 @@
m_routingModel( new RoutingModel( model ) ),
m_marbleModel( model ),
m_alternativeRoutesModel(new AlternativeRoutesModel( model, parent ) ),
- m_route( 0 ),
+ m_routeRequest( new RouteRequest( manager ) ),
m_workOffline( false ),
m_runnerManager( new MarbleRunnerManager( model->pluginManager(), q ) ),
m_haveRoute( false ), m_adjustNavigation( 0 )
@@ -79,34 +79,34 @@
void RoutingManager::retrieveRoute( RouteRequest *route )
{
- d->m_route = route;
+ d->m_routeRequest = route;
updateRoute();
}
void RoutingManager::updateRoute()
{
- if ( !d->m_route ) {
+ if ( !d->m_routeRequest ) {
return;
}
d->m_haveRoute = false;
int realSize = 0;
- for ( int i = 0; i < d->m_route->size(); ++i ) {
+ for ( int i = 0; i < d->m_routeRequest->size(); ++i ) {
// Sort out dummy targets
- if ( d->m_route->at( i ).longitude() != 0.0 && d->m_route->at( i ).latitude() != 0.0 ) {
+ if ( d->m_routeRequest->at( i ).longitude() != 0.0 && d->m_routeRequest->at( i ).latitude() != 0.0 ) {
++realSize;
}
}
- d->m_alternativeRoutesModel->newRequest( d->m_route );
+ d->m_alternativeRoutesModel->newRequest( d->m_routeRequest );
if ( realSize > 1 ) {
- emit stateChanged( RoutingManager::Downloading, d->m_route );
+ emit stateChanged( RoutingManager::Downloading, d->m_routeRequest );
d->m_runnerManager->setWorkOffline( d->m_workOffline );
- d->m_runnerManager->retrieveRoute( d->m_route );
+ d->m_runnerManager->retrieveRoute( d->m_routeRequest );
} else {
d->m_routingModel->clear();
- emit stateChanged( RoutingManager::Retrieved, d->m_route );
+ emit stateChanged( RoutingManager::Retrieved, d->m_routeRequest );
}
}
@@ -121,7 +121,7 @@
if ( !d->m_haveRoute ) {
d->m_haveRoute = true;
- emit stateChanged( Retrieved, d->m_route );
+ emit stateChanged( Retrieved, d->m_routeRequest );
}
emit routeRetrieved( route );
@@ -142,6 +142,11 @@
return d->m_adjustNavigation;
}
+RouteRequest* RoutingManager::routeRequest()
+{
+ return d->m_routeRequest;
+}
+
} // namespace Marble
#include "RoutingManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.h #1171822:1171823
@@ -86,6 +86,8 @@
*/
AdjustNavigation* adjustNavigation();
+ RouteRequest* routeRequest();
+
public Q_SLOTS:
/** Update the route */
void updateRoute();
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1171822:1171823
@@ -184,10 +184,9 @@
d->m_ui.routeComboBox->setVisible( false );
d->m_widget = marbleWidget;
- d->m_routeRequest = new RouteRequest( this );
-
//d->m_routingManager = new RoutingManager( d->m_widget, this );
d->m_routingManager = d->m_widget->model()->routingManager();
+ d->m_routeRequest = d->m_widget->model()->routingManager()->routeRequest();
d->m_ui.routeComboBox->setModel( d->m_routingManager->alternativeRoutesModel() );
d->m_routingLayer = new RoutingLayer( d->m_widget, this );
More information about the Marble-commits
mailing list