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
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.
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
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
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
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
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
I'm working on tutorials starting at http://techbase.kde.org/Projects/Marble/Routing/BasicRouting