Bug 248086 - Routing API
Summary: Routing API
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: 1.0 (KDE 4.6)
Assignee: marble-bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-16 21:05 UTC by Dennis Nienhüser
Modified: 2011-12-19 17:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: KDE-4.7.95/Marblelib-0.13
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nienhüser 2010-08-16 21:05:25 UTC
Version:           unspecified (using KDE 4.5.0) 
OS:                Linux

Calculating routes should be possible from the library version of Marble. That means to export some additional headers, review the API and simplify some class connections.


Reproducible: Didn't try
Comment 1 Dennis Nienhüser 2010-08-16 21:17:54 UTC
Something like this should be possible:

#include <marble/MarbleWidget.h>
#include <marble/MarbleModel.h>
#include <marble/RouteSkeleton.h>
#include <marble/RoutingManager.h>
#include <QtGui/QApplication>

using namespace Marble;
 
int main(int argc, char** argv)
{
    QApplication app(argc,argv);

    // Create a Marble QWidget without a parent
    MarbleWidget *mapWidget = new MarbleWidget();
 
    // Load the OpenStreetMap map
    mapWidget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
    mapWidget->show();

    // We want to calcuate a route for pedestrians
    RouteSkeleton request; // possibly renamed to RouteRequest in the future
    request.setRoutePreference(RouteSkeleton::Pedestrian);
    
    // The route start point 
    GeoDataCoordinates source( 8.409117, 48.999768, 0.0, GeoDataCoordinates::Degree );
    request.append(source);

    // The route destination
    GeoDataCoordinates destination( 8.412421, 49.000053, 0.0, GeoDataCoordinates::Degree );
    request.append(destination);
    
    // Calculate the route
    mapWidget->model()->routingManager()->retrieveRoute( &request );
    
    return app.exec();
}


That compiles and runs already, but since RoutingWidget creates RoutingLayer, the route is not shown.
Comment 2 Dennis Nienhüser 2010-09-05 12:17:39 UTC
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  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1171823
Comment 3 Dennis Nienhüser 2010-09-08 22:15:55 UTC
SVN commit 1173158 by nienhueser:

AlternativeRoutesModel now handles the active route instead of RoutingWidget.
CCBUG: 248086
Add saveSettings() and restoreSettings() methods to RoutingManager. They work, but lack saving of route preferences and are not yet called in the code.

 M  +22 -1     AlternativeRoutesModel.cpp  
 M  +6 -1      AlternativeRoutesModel.h  
 M  +1 -0      RouteRequest.cpp  
 M  +125 -2    RoutingManager.cpp  
 M  +14 -0     RoutingManager.h  
 M  +1 -1      RoutingModel.cpp  
 M  +6 -5      RoutingModel.h  
 M  +10 -8     RoutingWidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1173158
Comment 4 Dennis Nienhüser 2010-10-06 21:05:34 UTC
SVN commit 1183269 by nienhueser:

Have MarbleWidget create and own the RoutingLayer. Fixes routes not visible in applications embedding a MarbleWidget.
CCBUG: 248086

 M  +19 -1     MarbleWidget.cpp  
 M  +3 -0      MarbleWidget.h  
 M  +1 -6      routing/RoutingWidget.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1183269
Comment 5 Dennis Nienhüser 2010-10-21 22:18:51 UTC
SVN commit 1188261 by nienhueser:

Move route export method from RoutingWidget to RoutingLayer.
CCBUG: 248086

 M  +18 -2     RoutingLayer.cpp  
 M  +3 -5      RoutingLayer.h  
 M  +0 -16     RoutingWidget.cpp  
 M  +0 -3      RoutingWidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1188261
Comment 6 Dennis Nienhüser 2011-12-19 17:32:28 UTC
Git commit 60145eb222334e0978cc30e28ba0a9abca408f16 by Dennis Nienhüser.
Committed on 19/12/2011 at 18:27.
Pushed by nienhueser into branch 'master'.

Export routing headers.
BUG: 248086
FIXED-IN: KDE-4.7.95/Marblelib-0.13

M  +9    -0    src/lib/CMakeLists.txt

http://commits.kde.org/marble/60145eb222334e0978cc30e28ba0a9abca408f16
Comment 7 Dennis Nienhüser 2011-12-19 17:54:11 UTC
I'm working on tutorials starting at http://techbase.kde.org/Projects/Marble/Routing/BasicRouting