This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Get route without visualisation

Tags: None
(comma "," separated)
rainerschlonvoigt
Registered Member
Posts
1
Karma
0

Get route without visualisation

Thu Jan 29, 2015 11:17 am
Hello dear Marble Team,

I found out that I could request a route via
Code: Select all
RoutingManager * rManager = _widget->model()->routingManager();
RouteRequest * request = rManager->routeRequest()
request->append(start);
request->append(end);
rManager->retrieveRoute();


But is there a way to retrieve the route's segments?
So basically all I want is a list of all the coordinates between which marble draws straight lines.
But without visualisation.

On a different matter:
- Are routing calculations performed locally, but with map data that is downloaded from the web?
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS

Re: Get route without visualisation

Sun Apr 05, 2015 7:17 pm
Hi,

after calling retrieveRoute you have to wait for the route to be calculated, which is indicated by the stateChanged signal (and also the RoutingManager::state() method). Afterwards RoutingManager::routingModel() has the data you want. It is a QAbstractListModel convenient for Qt's item view classes, but has a method route() method also to retrieve the data in a format that is easier to work with elsewhere. In code:
[code]
[...]
rManager->retrieveRoute();
// method above is async; somehow wait for rManager to emit stateChanged() here with value Retrieved
Route route = rManager->routingModel()->route();

The Route class has the info you are looking for, e.g. path() for all points, at() for specific segments, ...

Marble supports both online (routes fetched from web) and offline ones (routes fetched locally). Offline currently means that the routes are calculated by another program running on the same system. The best example is the monav backend, which also has a nice frontend for data download in the Marble application.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]