13#include <QtPositioning/QGeoRectangle>
23 , m_networkManager(networkManager)
32 QGeoRouteRequest::FeatureTypes featureTypes;
41 QGeoRouteRequest::FeatureWeights featureWeights;
47 QGeoRouteRequest::ManeuverDetails maneuverDetails;
51 QGeoRouteRequest::RouteOptimizations optimizations;
56 QGeoRouteRequest::TravelModes travelModes;
63 QGeoRouteRequest::SegmentDetails segmentDetails;
80 if (reqStrings.isEmpty()) {
86 QList<QNetworkReply*> replies;
87 for (
const QString &reqString : reqStrings)
93 this, &QGeoRoutingManagerEngineNokia::routeFinished);
95 this, &QGeoRoutingManagerEngineNokia::routeError);
104 if (reqStrings.isEmpty()) {
110 QList<QNetworkReply*> replies;
111 for (
const QString &reqString : reqStrings)
119 this, &QGeoRoutingManagerEngineNokia::routeFinished);
121 this, &QGeoRoutingManagerEngineNokia::routeError);
127 QGeoRouteRequest::TravelModes travelModes)
const
129 const QList<QGeoRouteRequest::FeatureType> featureTypeList =
request.featureTypes();
133 for (
const auto &featureType : featureTypeList) {
134 featureTypeFlag |= featureType;
135 featureWeightFlag |=
request.featureWeight(featureType);
172 bool supported = checkEngineSupport(
request,
request.travelModes());
187 baseRequest += m_apiKey;
190 const QList<QGeoCoordinate> waypoints =
request.waypoints();
191 int numWaypoints = waypoints.size();
192 if (numWaypoints < 2)
195 for (
int i = 0;
i < numWaypoints;++
i) {
200 baseRequest += trimDouble(
c.latitude());
202 baseRequest += trimDouble(
c.longitude());
206 QGeoRouteRequest::RouteOptimizations optimization =
request.routeOptimization();
210 types.append(
"shortest");
212 types.append(
"fastest");
215 QString requestString = baseRequest;
216 requestString += modesRequestString(
request,
request.travelModes(), optimization);
217 requestString += routeRequestString(
request);
230 QString baseRequest =
"https://";
232 baseRequest +=
"/routing/7.2/getroute.xml";
234 baseRequest +=
"?routeid=";
235 baseRequest += route.
routeId();
237 baseRequest +=
"&pos=";
246 types.append(
"shortest");
248 types.append(
"fastest");
251 QString requestString = baseRequest;
252 requestString += modesRequestString(route.
request(), route.
travelMode(), optimization);
253 requestString += routeRequestString(route.
request());
261 QGeoRouteRequest::TravelModes travelModes,
const QString &optimization)
const
269 modes.append(
"pedestrian");
271 modes.append(
"publicTransport");
274 QList<QGeoRouteRequest::FeatureType> featureTypes =
request.featureTypes();
275 for (
int i = 0;
i < featureTypes.size(); ++
i) {
297 if (weightString.isEmpty())
300 switch (featureTypes.at(
i)) {
302 featureStrings.
append(
"tollroad:" + weightString);
305 featureStrings.
append(
"motorway:" + weightString);
308 featureStrings.
append(
"boatFerry:" + weightString);
309 featureStrings.
append(
"railFerry:" + weightString);
312 featureStrings.
append(
"tunnel:" + weightString);
315 featureStrings.
append(
"dirtRoad:" + weightString);
326 requestString +=
"&mode=";
327 requestString += optimization +
';' + modes.join(
',');
328 if (featureStrings.count())
329 requestString +=
';' + featureStrings.join(
',');
330 return requestString;
339 requestString += trimDouble(
area.topLeft().latitude());
341 requestString += trimDouble(
area.topLeft().longitude());
343 requestString += trimDouble(
area.bottomRight().latitude());
345 requestString += trimDouble(
area.bottomRight().longitude());
351 requestString +=
"&linkattributes=sh,le";
352 legAttributes.append(
"links");
357 legAttributes.append(
"maneuvers");
359 requestString +=
"&maneuverattributes=all";
361 requestString +=
",li";
365 requestString +=
"&routeattributes=sm,sh,bb,lg";
366 if (legAttributes.count() > 0) {
367 requestString +=
"&legattributes=";
368 requestString += legAttributes.join(
",");
372 requestString +=
"&departure=";
375 requestString +=
"&instructionformat=text";
378 requestString +=
"&metricSystem=";
380 requestString +=
"metric";
382 requestString +=
"imperial";
388 requestString +=
"&language=";
389 requestString += loc.name();
392 requestString +=
",en_US";
395 return requestString;
398QString QGeoRoutingManagerEngineNokia::trimDouble(
double degree,
int decimalDigits)
402 int index = sDegree.indexOf(
'.');
410void QGeoRoutingManagerEngineNokia::routeFinished()
DarwinBluetooth::RequestQueue requests
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QNetworkReply * get(const QNetworkRequest &request)=0
void finished()
This signal is emitted when this reply has finished processing.
Error
Describes an error which prevented the completion of the operation.
void errorOccurred(QGeoRouteReply::Error error, const QString &errorString=QString())
This signal is emitted when an error has been detected in the processing of this reply.
FeatureWeight
Defines the weight to associate with a feature during the planning of a route.
RouteOptimizations routeOptimization() const
Returns the optimization criteria which this request specifies should be used while planning the rout...
void setTravelModes(TravelModes travelModes)
Sets the travel modes which should be considered during the planning of the route to travelModes.
QGeoRouteRequest request() const
the route request which describes the criteria used in the calculation of this route
QGeoRouteRequest::TravelMode travelMode() const
Returns the travel mode for the this route.
QML_STRUCTURED_VALUEQString routeId
the identifier of this route
QGeoRoutingManagerEngineNokia(QGeoNetworkAccessManager *networkInterface, const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString)
QGeoRouteReply * updateRoute(const QGeoRoute &route, const QGeoCoordinate &position) override
Begins the process of updating route based on the current position position.
QGeoRouteReply * calculateRoute(const QGeoRouteRequest &request) override
~QGeoRoutingManagerEngineNokia()
void setSupportedSegmentDetails(QGeoRouteRequest::SegmentDetails segmentDetails)
Sets the levels of detail for routing segments which can be requested by this engine to segmentDetail...
QGeoRouteRequest::RouteOptimizations supportedRouteOptimizations() const
Returns the route optimizations supported by this engine.
QLocale::MeasurementSystem measurementSystem() const
Returns the measurement system used by this manager.
QGeoRouteRequest::FeatureWeights supportedFeatureWeights() const
Returns the weightings which this engine can apply to different features during route planning.
QLocale locale() const
Returns the locale used to hint to this routing manager about what language to use for addresses and ...
QGeoRouteRequest::FeatureTypes supportedFeatureTypes() const
Returns the types of features that this engine can take into account during route planning.
void errorOccurred(QGeoRouteReply *reply, QGeoRouteReply::Error error, const QString &errorString=QString())
This signal is emitted when an error has been detected in the processing of reply.
QGeoRouteRequest::SegmentDetails supportedSegmentDetails() const
Returns the levels of detail for routing segments which can be requested by this engine.
void setSupportedTravelModes(QGeoRouteRequest::TravelModes travelModes)
Sets the travel modes supported by this engine to travelModes.
QGeoRouteRequest::TravelModes supportedTravelModes() const
Returns the travel modes supported by this engine.
void setSupportedFeatureWeights(QGeoRouteRequest::FeatureWeights featureWeights)
Sets the weightings which this engine can apply to different features during route planning to featur...
void finished(QGeoRouteReply *reply)
This signal is emitted when reply has finished processing.
QGeoRouteRequest::ManeuverDetails supportedManeuverDetails() const
Returns the levels of detail for navigation maneuvers which can be requested by this engine.
void setSupportedFeatureTypes(QGeoRouteRequest::FeatureTypes featureTypes)
Sets the types of features that this engine can take into account during route planning to featureTyp...
void setSupportedRouteOptimizations(QGeoRouteRequest::RouteOptimizations optimizations)
Sets the route optimizations supported by this engine to optimizations.
void setSupportedManeuverDetails(QGeoRouteRequest::ManeuverDetails maneuverDetails)
Sets the levels of detail for navigation maneuvers which can be requested by this engine to maneuverD...
Error
Describes an error related to the loading and setup of a service provider plugin.
QString getCurrentHost() const
QString errorString() const
Returns a human-readable description of the last device error that occurred.
T value(const Key &key, const T &defaultValue=T()) const
NetworkError error() const
Returns the error that was found during the processing of this request.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
void setParent(QObject *parent)
Makes the object a child of parent.
int receivers(const char *signal) const
Returns the number of receivers connected to the signal.
void deleteLater()
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & append(QChar c)
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
Combined button and popup list for selecting options.
QList< QString > QStringList
Constructs a string list that contains the given string, str.
DBusConnection const char DBusError * error
static int area(const QSize &s)
GLsizei GLenum GLenum * types
GLenum GLenum GLsizei count
GLuint GLuint GLfloat weight
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
QNetworkRequest request(url)
QT_BEGIN_NAMESPACE const QString ROUTING_HOST