[Marble-bugs] [Bug 248086] Routing API

Dennis Nienhüser earthwings at gentoo.org
Mon Aug 16 21:17:55 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=248086





--- Comment #1 from Dennis Nienhüser <earthwings gentoo org>  2010-08-16 21:17:54 ---
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.

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Marble-bugs mailing list