Registered Member
|
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:
There are 2 signals:
There is also
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... |
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]