Reply to topic

Offline routing in Marble [SOLVED]

Registered Member

Offline routing in Marble [SOLVED]

Tue Jun 30, 2015 4:09 pm
I am developing application (as project for my studies so I am still learning) to solve Traveling Salesmen Problem with Marble. Unfortunately basic routing tutorial is weak. I need Route object:
Code: Select all
route = this->model()->routingManager()->routingModel()->route();

There are 2 signals:
Code: Select all
this->model()->routingManager()->routingModel() - currentRouteChanged
this->model()->routingManager() - routeRetrieved

There is also
Code: Select all
stateChanged in this->model()->routingManager()

but as I work offline it seams it is not working as described here.
Problem is routingManager is asynchronous so i need to wait for all routes to be fund. My only idea is to set timer, and reset it after each new route for the same two spots. After timer is finished I can assume that there is no more routes. But it is waisting time, and it is unreliable. Is there any way to be sure there is no more routes?
I use RoutingManager to get all the connection between my points to run TSP algorithm. Now after getting route I am starting to look for route between other points but Marble is still finding routes for previous request.

Code is here . MapWidget::findRoute and MapWidget::routeRetrivedSlot is what I need.

And by the way, project is not professional, so after getting any route I do not need any more, so cancelling request is valid option to...

Ok, got it. You can wait for RoutingManager signal stateChanged. If state is recieved you can find routes in AlternativeRoutesModel. AlternativeRoutesModel::rowCount tells you how many routes have been retrieved. There is one catch - AlternativeRoutesModel gets routes with some delay. So you need to wait for them looping and using processEvent(). Then you can check with AlternativeRoutesModel::rowCount are routes already there. Routes can be inserted to RoutingManager::routingModel() object so you can show them on map and get distance and so on with RoutingModel ::route(). That's the easiest way I found...

Reply to topic


Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], lueck, uyenb