13#include <QtPositioning/QGeoRectangle>
23 , m_networkManager(networkManager)
33 QGeoRouteRequest::FeatureTypes featureTypes;
42 QGeoRouteRequest::FeatureWeights featureWeights;
48 QGeoRouteRequest::ManeuverDetails maneuverDetails;
52 QGeoRouteRequest::RouteOptimizations optimizations;
57 QGeoRouteRequest::TravelModes travelModes;
64 QGeoRouteRequest::SegmentDetails segmentDetails;
81 if (reqStrings.isEmpty()) {
88 for (
const QString &reqString : reqStrings)
94 this, &QGeoRoutingManagerEngineNokia::routeFinished);
96 this, &QGeoRoutingManagerEngineNokia::routeError);
105 if (reqStrings.isEmpty()) {
112 for (
const QString &reqString : reqStrings)
120 this, &QGeoRoutingManagerEngineNokia::routeFinished);
122 this, &QGeoRoutingManagerEngineNokia::routeError);
128 QGeoRouteRequest::TravelModes travelModes)
const
134 for (
const auto &featureType : featureTypeList) {
135 featureTypeFlag |= featureType;
136 featureWeightFlag |=
request.featureWeight(featureType);
173 bool supported = checkEngineSupport(
request,
request.travelModes());
188 baseRequest += m_appId;
190 baseRequest += m_token;
194 int numWaypoints = waypoints.
size();
195 if (numWaypoints < 2)
198 for (
int i = 0;
i < numWaypoints;++
i) {
203 baseRequest += trimDouble(
c.latitude());
205 baseRequest += trimDouble(
c.longitude());
209 QGeoRouteRequest::RouteOptimizations optimization =
request.routeOptimization();
213 types.append(
"shortest");
215 types.append(
"fastest");
218 QString requestString = baseRequest;
219 requestString += modesRequestString(
request,
request.travelModes(), optimization);
220 requestString += routeRequestString(
request);
233 QString baseRequest =
"http://";
235 baseRequest +=
"/routing/7.2/getroute.xml";
237 baseRequest +=
"?routeid=";
238 baseRequest += route.
routeId();
240 baseRequest +=
"&pos=";
249 types.append(
"shortest");
251 types.append(
"fastest");
254 QString requestString = baseRequest;
255 requestString += modesRequestString(route.
request(), route.
travelMode(), optimization);
256 requestString += routeRequestString(route.
request());
264 QGeoRouteRequest::TravelModes travelModes,
const QString &optimization)
const
272 modes.append(
"pedestrian");
274 modes.append(
"publicTransport");
278 for (
int i = 0;
i < featureTypes.
size(); ++
i) {
303 switch (featureTypes.
at(
i)) {
305 featureStrings.append(
"tollroad:" + weightString);
308 featureStrings.append(
"motorway:" + weightString);
311 featureStrings.append(
"boatFerry:" + weightString);
312 featureStrings.append(
"railFerry:" + weightString);
315 featureStrings.append(
"tunnel:" + weightString);
318 featureStrings.append(
"dirtRoad:" + weightString);
329 requestString +=
"&mode=";
330 requestString += optimization +
';' + modes.join(
',');
331 if (featureStrings.count())
332 requestString +=
';' + featureStrings.join(
',');
333 return requestString;
342 requestString += trimDouble(
area.topLeft().latitude());
344 requestString += trimDouble(
area.topLeft().longitude());
346 requestString += trimDouble(
area.bottomRight().latitude());
348 requestString += trimDouble(
area.bottomRight().longitude());
354 requestString +=
"&linkattributes=sh,le";
355 legAttributes.append(
"links");
360 legAttributes.append(
"maneuvers");
362 requestString +=
"&maneuverattributes=all";
364 requestString +=
",li";
368 requestString +=
"&routeattributes=sm,sh,bb,lg";
369 if (legAttributes.count() > 0) {
370 requestString +=
"&legattributes=";
371 requestString += legAttributes.join(
",");
375 requestString +=
"&departure=";
378 requestString +=
"&instructionformat=text";
381 requestString +=
"&metricSystem=";
383 requestString +=
"metric";
385 requestString +=
"imperial";
391 requestString +=
"&language=";
392 requestString += loc.name();
395 requestString +=
",en_US";
398 return requestString;
401QString QGeoRoutingManagerEngineNokia::trimDouble(
double degree,
int decimalDigits)
413void QGeoRoutingManagerEngineNokia::routeFinished()
DarwinBluetooth::RequestQueue requests
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime toUTC() const
Returns a copy of this datetime converted to UTC.
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.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
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
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...
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
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.
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