diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-10-12 14:46:41 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-10-12 14:34:51 +0000 |
commit | a63ee3d4b8d6760c344fa8b61e0cd48f9077c4b9 (patch) | |
tree | 88882b6108fda82d115068b80b42fb3178837fe7 /src/plugins | |
parent | d20de9aa73e2c86bd2fe87d045b2532c481eef13 (diff) | |
download | qtlocation-a63ee3d4b8d6760c344fa8b61e0cd48f9077c4b9.tar.gz |
Request alternate routes to mapbox routing API
This patch adds support for requesting alternate routes in the mapbox
plugin
Change-Id: I26b2b3ab8594d6de429f31d8e1e68c98f2d82a17
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp index d6ef8f0a..f5776852 100644 --- a/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp @@ -89,10 +89,19 @@ QGeoRouteReply* QGeoRoutingManagerEngineMapbox::calculateRoute(const QGeoRouteRe foreach (const QGeoCoordinate &c, request.waypoints()) { url += QString("%1,%2;").arg(c.longitude()).arg(c.latitude()); } - if (url.right(1) == ";") url.chop(1); - url += QString("?steps=true&overview=full&geometries=geojson&access_token=%1").arg(m_accessToken); - - networkRequest.setUrl(QUrl(url)); + if (url.right(1) == ";") + url.chop(1); + + QUrlQuery query; + query.addQueryItem(QStringLiteral("steps"), QStringLiteral("true")); + query.addQueryItem(QStringLiteral("alternatives"), QStringLiteral("true")); + query.addQueryItem(QStringLiteral("overview"), QStringLiteral("full")); + query.addQueryItem(QStringLiteral("geometries"), QStringLiteral("geojson")); + query.addQueryItem(QStringLiteral("access_token"), m_accessToken); + + QUrl u(url); + u.setQuery(query); + networkRequest.setUrl(u); QNetworkReply *reply = m_networkManager->get(networkRequest); QGeoRouteReplyMapbox *routeReply = new QGeoRouteReplyMapbox(reply, request, this); |