summaryrefslogtreecommitdiffstats
path: root/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qbc.io>2018-12-11 15:21:35 +0900
committerTasuku Suzuki <tasuku.suzuki@qbc.io>2018-12-26 16:51:09 +0000
commit1e24cec7e3ebf5f62f5440d848caf6cd9db1e456 (patch)
tree936c0824a2495a23e780d142f0de289cbe43bd6e /src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp
parent100e0416e7faff954221df9ef97920ba512712c0 (diff)
Introduce a map plugin parameter to decide U-Turn direction
When "uturn" comes from OSRM, Qt returns UTurnLeft since Right Hand Traffic is in use in most countries. This commit allows qml to set traffic side to return correct u-turn direction. Task-number: QTBUG-72462 Change-Id: Ifaa002b063159b4e4ee563d007721ba7a4a587a4 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp')
-rw-r--r--src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp
index e8db635f..29cf0167 100644
--- a/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qgeoroutingmanagerenginemapbox.cpp
@@ -238,7 +238,13 @@ QGeoRoutingManagerEngineMapbox::QGeoRoutingManagerEngineMapbox(const QVariantMap
QGeoRouteParserOsrmV5 *parser = new QGeoRouteParserOsrmV5(this);
parser->setExtension(new QGeoRouteParserOsrmV5ExtensionMapbox(m_accessToken, use_mapbox_text_instructions));
-
+ if (parameters.contains(QStringLiteral("mapbox.routing.traffic_side"))) {
+ QString trafficSide = parameters.value(QStringLiteral("mapbox.routing.traffic_side")).toString();
+ if (trafficSide == QStringLiteral("right"))
+ parser->setTrafficSide(QGeoRouteParser::RightHandTraffic);
+ else if (trafficSide == QStringLiteral("left"))
+ parser->setTrafficSide(QGeoRouteParser::LeftHandTraffic);
+ }
m_routeParser = parser;
*error = QGeoServiceProvider::NoError;