summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/osm
diff options
context:
space:
mode:
authorWolfgang Bremer <wolfgang@w-bremer.de>2015-05-05 01:34:24 +0200
committerWolfgang Bremer <wolfgang.bremer@pelagicore.com>2015-05-08 16:21:48 +0000
commit8275c4c933d0de20f1e784d5d5aeb78a8d20d80c (patch)
tree1ff52d121eba5279f903efeb4f52662e6cc2978d /src/plugins/geoservices/osm
parent3f697f6d73f0a7f10be90f48662f139a33d1781e (diff)
downloadqtlocation-8275c4c933d0de20f1e784d5d5aeb78a8d20d80c.tar.gz
Allow custom URLs for OSRM routing
This enables the usage of another routing server than the default osrm project. The api still needs to be the same, but it is possible to drive your own server using the OSRM project sources. Change-Id: Ib335fdf97eb1e208caafb17783c22d9b423a40e2 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/osm')
-rw-r--r--src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp7
-rw-r--r--src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp
index 36913146..ab582434 100644
--- a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp
@@ -48,6 +48,11 @@ QGeoRoutingManagerEngineOsm::QGeoRoutingManagerEngineOsm(const QVariantMap &para
else
m_userAgent = "Qt Location based application";
+ if (parameters.contains(QStringLiteral("routing.host")))
+ m_urlPrefix = parameters.value(QStringLiteral("routing.host")).toString().toLatin1();
+ else
+ m_urlPrefix = QStringLiteral("http://router.project-osrm.org/viaroute");
+
*error = QGeoServiceProvider::NoError;
errorString->clear();
}
@@ -61,7 +66,7 @@ QGeoRouteReply* QGeoRoutingManagerEngineOsm::calculateRoute(const QGeoRouteReque
QNetworkRequest networkRequest;
networkRequest.setRawHeader("User-Agent", m_userAgent);
- QUrl url(QStringLiteral("http://router.project-osrm.org/viaroute"));
+ QUrl url(m_urlPrefix);
QUrlQuery query;
query.addQueryItem(QStringLiteral("instructions"), QStringLiteral("true"));
diff --git a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.h b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.h
index 793c8ace..618ef900 100644
--- a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.h
+++ b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.h
@@ -60,6 +60,7 @@ private Q_SLOTS:
private:
QNetworkAccessManager *m_networkManager;
QByteArray m_userAgent;
+ QString m_urlPrefix;
};
QT_END_NAMESPACE