Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QGeoRouteRequest Class Reference

\inmodule QtLocation More...

#include <qgeorouterequest.h>

+ Collaboration diagram for QGeoRouteRequest:

Public Types

enum  TravelMode {
  CarTravel = 0x0001 , PedestrianTravel = 0x0002 , BicycleTravel = 0x0004 , PublicTransitTravel = 0x0008 ,
  TruckTravel = 0x0010
}
 Defines modes of travel to be used for a route. More...
 
enum  FeatureType {
  NoFeature = 0x00000000 , TollFeature = 0x00000001 , HighwayFeature = 0x00000002 , PublicTransitFeature = 0x00000004 ,
  FerryFeature = 0x00000008 , TunnelFeature = 0x00000010 , DirtRoadFeature = 0x00000020 , ParksFeature = 0x00000040 ,
  MotorPoolLaneFeature = 0x00000080 , TrafficFeature = 0x00000100
}
 Defines a feature which is important to the planning of a route. More...
 
enum  FeatureWeight {
  NeutralFeatureWeight = 0x00000000 , PreferFeatureWeight = 0x00000001 , RequireFeatureWeight = 0x00000002 , AvoidFeatureWeight = 0x00000004 ,
  DisallowFeatureWeight = 0x00000008
}
 Defines the weight to associate with a feature during the planning of a route. More...
 
enum  RouteOptimization { ShortestRoute = 0x0001 , FastestRoute = 0x0002 , MostEconomicRoute = 0x0004 , MostScenicRoute = 0x0008 }
 Defines the type of optimization which is applied to the planning of the route. More...
 
enum  SegmentDetail { NoSegmentData = 0x0000 , BasicSegmentData = 0x0001 }
 Defines the amount of route segment information that should be included with the route. More...
 
enum  ManeuverDetail { NoManeuvers = 0x0000 , BasicManeuvers = 0x0001 }
 Defines the amount of maneuver information that should be included with the route. More...
 

Public Member Functions

 QGeoRouteRequest (const QList< QGeoCoordinate > &waypoints=QList< QGeoCoordinate >())
 Constructs a request to calculate a route through the coordinates waypoints.
 
 QGeoRouteRequest (const QGeoCoordinate &origin, const QGeoCoordinate &destination)
 Constructs a request to calculate a route between origin and destination.
 
 QGeoRouteRequest (const QGeoRouteRequest &other) noexcept
 Constructs a route request object from the contents of other.
 
 QGeoRouteRequest (QGeoRouteRequest &&other) noexcept=default
 
 ~QGeoRouteRequest ()
 Destroys the request.
 
QGeoRouteRequestoperator= (const QGeoRouteRequest &other) noexcept
 Assigns other to this route request object and then returns a reference to this route request object.
 
void swap (QGeoRouteRequest &other) noexcept
 
void setWaypoints (const QList< QGeoCoordinate > &waypoints)
 Sets waypoints as the waypoints that the route should pass through.
 
QList< QGeoCoordinatewaypoints () const
 Returns the waypoints that the route will pass through.
 
void setExcludeAreas (const QList< QGeoRectangle > &areas)
 Sets areas as excluded areas that the route must not cross.
 
QList< QGeoRectangleexcludeAreas () const
 Returns areas the route must not cross.
 
void setNumberAlternativeRoutes (int alternatives)
 Sets the number of alternative routes to request to alternatives.
 
int numberAlternativeRoutes () const
 Returns the number of alternative routes which will be requested.
 
void setTravelModes (TravelModes travelModes)
 Sets the travel modes which should be considered during the planning of the route to travelModes.
 
TravelModes travelModes () const
 Returns the travel modes which this request specifies should be considered during the planning of the route.
 
void setFeatureWeight (FeatureType featureType, FeatureWeight featureWeight)
 Assigns the weight featureWeight to the feature featureType during the planning of the route.
 
FeatureWeight featureWeight (FeatureType featureType) const
 Returns the weight assigned to featureType in the planning of the route.
 
QList< FeatureTypefeatureTypes () const
 Returns the list of features that will be considered when planning the route.
 
void setRouteOptimization (RouteOptimizations optimization)
 Sets the optimization criteria to use while planning the route to optimization.
 
RouteOptimizations routeOptimization () const
 Returns the optimization criteria which this request specifies should be used while planning the route.
 
void setSegmentDetail (SegmentDetail segmentDetail)
 Sets the level of detail to use when representing routing segments to segmentDetail.
 
SegmentDetail segmentDetail () const
 Returns the level of detail which will be used in the representation of routing segments.
 
void setManeuverDetail (ManeuverDetail maneuverDetail)
 Sets the level of detail to use when representing routing maneuvers to maneuverDetail.
 
ManeuverDetail maneuverDetail () const
 Returns the level of detail which will be used in the representation of routing maneuvers.
 
void setDepartureTime (const QDateTime &departureTime)
 Sets the departure time departureTime for the route calculation.
 
QDateTime departureTime () const
 Returns the departure time in the request.
 

Friends

bool operator== (const QGeoRouteRequest &lhs, const QGeoRouteRequest &rhs) noexcept
 Returns whether the route requests lhs and rhs are equal.
 
bool operator!= (const QGeoRouteRequest &lhs, const QGeoRouteRequest &rhs) noexcept
 Returns whether the route requests lhs and rhs are not equal.
 

Detailed Description

\inmodule QtLocation

Since
5.6

The QGeoRouteRequest class represents the parameters and restrictions which define a request for routing information.

The default state of a QGeoRouteRequest instance will result in a request for basic route segment and navigation maneuvers describing the fastest route by car which covers the given waypoints.

There may be significant variation in the features supported by different providers of routing information, or even in the features supported by the same provider if different levels of authorization are used.

There are several functions in QGeoRoutingManager which can be used to check which features are supported with the current provider and authorization level.

See also
QGeoRoutingManager

Definition at line 20 of file qgeorouterequest.h.

Member Enumeration Documentation

◆ FeatureType

Defines a feature which is important to the planning of a route.

These values will be used in combination with QGeoRouteRequest::FeatureWeight to determine if they should or should not be part of the route.

\value NoFeature Used by QGeoRoutingManager::supportedFeatureTypes() to indicate that no features will be taken into account when planning the route. \value TollFeature Consdier tollways when planning the route. \value HighwayFeature Consider highways when planning the route. \value PublicTransitFeature Consider public transit when planning the route. \value FerryFeature Consider ferries when planning the route. \value TunnelFeature Consider tunnels when planning the route. \value DirtRoadFeature Consider dirt roads when planning the route. \value ParksFeature Consider parks when planning the route. \value MotorPoolLaneFeature Consider motor pool lanes when planning the route. \value TrafficFeature Consider the current traffic situation when planning the route. Since QtLocation 5.10

Enumerator
NoFeature 
TollFeature 
HighwayFeature 
PublicTransitFeature 
FerryFeature 
TunnelFeature 
DirtRoadFeature 
ParksFeature 
MotorPoolLaneFeature 
TrafficFeature 

Definition at line 32 of file qgeorouterequest.h.

◆ FeatureWeight

Defines the weight to associate with a feature during the planning of a route.

These values will be used in combination with QGeoRouteRequest::Feature to determine if they should or should not be part of the route.

\value NeutralFeatureWeight The presence or absence of the feature will not affect the planning of the route. \value PreferFeatureWeight Routes which contain the feature will be preferred over those that do not. \value RequireFeatureWeight Only routes which contain the feature will be considered, otherwise no route will be returned. \value AvoidFeatureWeight Routes which do not contain the feature will be preferred over those that do. \value DisallowFeatureWeight Only routes which do not contain the feature will be considered, otherwise no route will be returned.

Enumerator
NeutralFeatureWeight 
PreferFeatureWeight 
RequireFeatureWeight 
AvoidFeatureWeight 
DisallowFeatureWeight 

Definition at line 46 of file qgeorouterequest.h.

◆ ManeuverDetail

Defines the amount of maneuver information that should be included with the route.

\value NoManeuvers No maneuvers should be included with the route.

\value BasicManeuvers Basic manevuers will be included with the route. This will include QGeoManeuver::instructionText().

Enumerator
NoManeuvers 
BasicManeuvers 

Definition at line 69 of file qgeorouterequest.h.

◆ RouteOptimization

Defines the type of optimization which is applied to the planning of the route.

\value ShortestRoute Minimize the length of the journey. \value FastestRoute Minimize the traveling time for the journey. \value MostEconomicRoute Minimize the cost of the journey. \value MostScenicRoute Maximize the scenic potential of the journey.

Enumerator
ShortestRoute 
FastestRoute 
MostEconomicRoute 
MostScenicRoute 

Definition at line 55 of file qgeorouterequest.h.

◆ SegmentDetail

Defines the amount of route segment information that should be included with the route.

\value NoSegmentData No segment data should be included with the route. A route requested with this level of segment detail will initialize QGeoRouteSegment::path() as a straight line between the positions of the previous and next QGeoManeuver instances.

\value BasicSegmentData Basic segment data will be included with the route. This will include QGeoRouteSegment::path().

Enumerator
NoSegmentData 
BasicSegmentData 

Definition at line 63 of file qgeorouterequest.h.

◆ TravelMode

Defines modes of travel to be used for a route.

\value CarTravel The route will be optimized for someone who is driving a car. \value PedestrianTravel The route will be optimized for someone who is walking. \value BicycleTravel The route will be optimized for someone who is riding a bicycle. \value PublicTransitTravel The route will be optimized for someone who is making use of public transit. \value TruckTravel The route will be optimized for someone who is driving a truck.

Enumerator
CarTravel 
PedestrianTravel 
BicycleTravel 
PublicTransitTravel 
TruckTravel 

Definition at line 23 of file qgeorouterequest.h.

Constructor & Destructor Documentation

◆ QGeoRouteRequest() [1/4]

QGeoRouteRequest::QGeoRouteRequest ( const QList< QGeoCoordinate > & waypoints = QList<QGeoCoordinate>())
explicit

Constructs a request to calculate a route through the coordinates waypoints.

The route will traverse the objects of waypoints in order.

Definition at line 192 of file qgeorouterequest.cpp.

References waypoints().

+ Here is the call graph for this function:

◆ QGeoRouteRequest() [2/4]

QGeoRouteRequest::QGeoRouteRequest ( const QGeoCoordinate & origin,
const QGeoCoordinate & destination )

Constructs a request to calculate a route between origin and destination.

Definition at line 202 of file qgeorouterequest.cpp.

References QList< T >::append(), destination, and QGeoRouteRequestPrivate::waypoints.

+ Here is the call graph for this function:

◆ QGeoRouteRequest() [3/4]

QGeoRouteRequest::QGeoRouteRequest ( const QGeoRouteRequest & other)
defaultnoexcept

Constructs a route request object from the contents of other.

◆ QGeoRouteRequest() [4/4]

QGeoRouteRequest::QGeoRouteRequest ( QGeoRouteRequest && other)
defaultnoexcept

◆ ~QGeoRouteRequest()

QGeoRouteRequest::~QGeoRouteRequest ( )
default

Destroys the request.

Member Function Documentation

◆ departureTime()

QDateTime QGeoRouteRequest::departureTime ( ) const

Returns the departure time in the request.

Since
5.13

Definition at line 441 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::departureTime.

Referenced by QDeclarativeGeoRouteQuery::departureTime(), QDeclarativeGeoRouteQuery::setDepartureTime(), and setDepartureTime().

+ Here is the caller graph for this function:

◆ excludeAreas()

QList< QGeoRectangle > QGeoRouteRequest::excludeAreas ( ) const

Returns areas the route must not cross.

Definition at line 282 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::excludeAreas.

Referenced by QDeclarativeGeoRouteQuery::addExcludedArea(), QDeclarativeGeoRouteQuery::clearExcludedAreas(), QDeclarativeGeoRouteQuery::excludedAreas(), QDeclarativeGeoRouteQuery::removeExcludedArea(), and QDeclarativeGeoRouteQuery::setExcludedAreas().

+ Here is the caller graph for this function:

◆ featureTypes()

QList< QGeoRouteRequest::FeatureType > QGeoRouteRequest::featureTypes ( ) const

Returns the list of features that will be considered when planning the route.

Features with a weight of NeutralFeatureWeight will not be returned.

Definition at line 359 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::featureWeights, and QMap< Key, T >::keys().

Referenced by QDeclarativeGeoRouteQuery::featureTypes(), QDeclarativeGeoRouteQuery::resetFeatureWeights(), and QDeclarativeGeoRouteQuery::setFeatureWeight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ featureWeight()

QGeoRouteRequest::FeatureWeight QGeoRouteRequest::featureWeight ( QGeoRouteRequest::FeatureType featureType) const

Returns the weight assigned to featureType in the planning of the route.

If no feature weight has been specified for featureType then NeutralFeatureWeight will be returned.

Definition at line 350 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::featureWeights, NeutralFeatureWeight, and QMap< Key, T >::value().

Referenced by QDeclarativeGeoRouteQuery::featureWeight(), QDeclarativeGeoRouteQuery::setFeatureWeight(), and setFeatureWeight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maneuverDetail()

QGeoRouteRequest::ManeuverDetail QGeoRouteRequest::maneuverDetail ( ) const

Returns the level of detail which will be used in the representation of routing maneuvers.

Definition at line 417 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::maneuverDetail.

Referenced by QDeclarativeGeoRouteQuery::maneuverDetail(), QDeclarativeGeoRouteQuery::setManeuverDetail(), and setManeuverDetail().

+ Here is the caller graph for this function:

◆ numberAlternativeRoutes()

int QGeoRouteRequest::numberAlternativeRoutes ( ) const

Returns the number of alternative routes which will be requested.

Definition at line 301 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::numberAlternativeRoutes.

Referenced by QDeclarativeGeoRouteQuery::numberAlternativeRoutes(), and QDeclarativeGeoRouteQuery::setNumberAlternativeRoutes().

+ Here is the caller graph for this function:

◆ operator=()

QGeoRouteRequest & QGeoRouteRequest::operator= ( const QGeoRouteRequest & other)
noexcept

Assigns other to this route request object and then returns a reference to this route request object.

Definition at line 223 of file qgeorouterequest.cpp.

References other().

+ Here is the call graph for this function:

◆ routeOptimization()

QGeoRouteRequest::RouteOptimizations QGeoRouteRequest::routeOptimization ( ) const

Returns the optimization criteria which this request specifies should be used while planning the route.

Definition at line 379 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::routeOptimization.

Referenced by QDeclarativeGeoRouteQuery::routeOptimizations(), and QDeclarativeGeoRouteQuery::setRouteOptimizations().

+ Here is the caller graph for this function:

◆ segmentDetail()

QGeoRouteRequest::SegmentDetail QGeoRouteRequest::segmentDetail ( ) const

Returns the level of detail which will be used in the representation of routing segments.

Definition at line 397 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::segmentDetail.

Referenced by QDeclarativeGeoRouteQuery::segmentDetail(), QDeclarativeGeoRouteQuery::setSegmentDetail(), and setSegmentDetail().

+ Here is the caller graph for this function:

◆ setDepartureTime()

void QGeoRouteRequest::setDepartureTime ( const QDateTime & departureTime)

Sets the departure time departureTime for the route calculation.

This information can be used by the backend to calculate a faster route, for example, by avoiding traffic congestion during rush hour.

The default value is an invalid QDateTime.

Since
5.13

Definition at line 431 of file qgeorouterequest.cpp.

References departureTime(), and QGeoRouteRequestPrivate::departureTime.

Referenced by QDeclarativeGeoRouteQuery::setDepartureTime().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setExcludeAreas()

void QGeoRouteRequest::setExcludeAreas ( const QList< QGeoRectangle > & areas)

Sets areas as excluded areas that the route must not cross.

Definition at line 274 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::excludeAreas.

Referenced by QDeclarativeGeoRouteQuery::addExcludedArea(), QDeclarativeGeoRouteQuery::clearExcludedAreas(), QDeclarativeGeoRouteQuery::removeExcludedArea(), and QDeclarativeGeoRouteQuery::setExcludedAreas().

+ Here is the caller graph for this function:

◆ setFeatureWeight()

void QGeoRouteRequest::setFeatureWeight ( QGeoRouteRequest::FeatureType featureType,
QGeoRouteRequest::FeatureWeight featureWeight )

Assigns the weight featureWeight to the feature featureType during the planning of the route.

By default all features are assigned a weight of NeutralFeatureWeight.

It is impossible to assign a weight to QGeoRouteRequest::NoFeature.

Definition at line 334 of file qgeorouterequest.cpp.

References featureWeight(), QGeoRouteRequestPrivate::featureWeights, NeutralFeatureWeight, NoFeature, and QMap< Key, T >::remove().

Referenced by QDeclarativeGeoRouteQuery::resetFeatureWeights(), and QDeclarativeGeoRouteQuery::setFeatureWeight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setManeuverDetail()

void QGeoRouteRequest::setManeuverDetail ( QGeoRouteRequest::ManeuverDetail maneuverDetail)

Sets the level of detail to use when representing routing maneuvers to maneuverDetail.

The default value is QGeoRouteRequest::BasicManeuvers.

Definition at line 408 of file qgeorouterequest.cpp.

References maneuverDetail(), and QGeoRouteRequestPrivate::maneuverDetail.

Referenced by QDeclarativeGeoRouteQuery::setManeuverDetail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNumberAlternativeRoutes()

void QGeoRouteRequest::setNumberAlternativeRoutes ( int alternatives)

Sets the number of alternative routes to request to alternatives.

If alternatives is negative the number of alternative routes is set to 0.

The default value is 0.

Definition at line 293 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::numberAlternativeRoutes, and qMax().

Referenced by QDeclarativeGeoRouteQuery::setNumberAlternativeRoutes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRouteOptimization()

void QGeoRouteRequest::setRouteOptimization ( RouteOptimizations optimization)

Sets the optimization criteria to use while planning the route to optimization.

The default value is QGeoRouteRequest::FastestRoute.

Definition at line 370 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::routeOptimization.

Referenced by QDeclarativeGeoRouteQuery::setRouteOptimizations().

+ Here is the caller graph for this function:

◆ setSegmentDetail()

void QGeoRouteRequest::setSegmentDetail ( QGeoRouteRequest::SegmentDetail segmentDetail)

Sets the level of detail to use when representing routing segments to segmentDetail.

Definition at line 388 of file qgeorouterequest.cpp.

References segmentDetail(), and QGeoRouteRequestPrivate::segmentDetail.

Referenced by QDeclarativeGeoRouteQuery::setSegmentDetail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTravelModes()

void QGeoRouteRequest::setTravelModes ( TravelModes travelModes)

Sets the travel modes which should be considered during the planning of the route to travelModes.

The default value is QGeoRouteRequest::CarTravel.

Definition at line 312 of file qgeorouterequest.cpp.

References travelModes(), and QGeoRouteRequestPrivate::travelModes.

Referenced by QDeclarativeGeoRouteQuery::setTravelModes(), and QGeoRoutingManagerEngineNokia::updateRoute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWaypoints()

void QGeoRouteRequest::setWaypoints ( const QList< QGeoCoordinate > & waypoints)

Sets waypoints as the waypoints that the route should pass through.

The waypoints should be given in order from origin to destination.

This request will be invalid until the waypoints have been set to a list containing two or more coordinates.

Definition at line 258 of file qgeorouterequest.cpp.

References waypoints(), and QGeoRouteRequestPrivate::waypoints.

Referenced by QDeclarativeGeoRouteQuery::routeRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ swap()

void QGeoRouteRequest::swap ( QGeoRouteRequest & other)
inlinenoexcept

Definition at line 86 of file qgeorouterequest.h.

References other().

+ Here is the call graph for this function:

◆ travelModes()

QGeoRouteRequest::TravelModes QGeoRouteRequest::travelModes ( ) const

Returns the travel modes which this request specifies should be considered during the planning of the route.

Definition at line 321 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::travelModes.

Referenced by QDeclarativeGeoRouteQuery::setTravelModes(), setTravelModes(), and QDeclarativeGeoRouteQuery::travelModes().

+ Here is the caller graph for this function:

◆ waypoints()

QList< QGeoCoordinate > QGeoRouteRequest::waypoints ( ) const

Returns the waypoints that the route will pass through.

Definition at line 266 of file qgeorouterequest.cpp.

References QGeoRouteRequestPrivate::waypoints.

Referenced by QDeclarativeGeoRouteQuery::QDeclarativeGeoRouteQuery(), QGeoRouteRequest(), and setWaypoints().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool QGeoRouteRequest::operator!= ( const QGeoRouteRequest & lhs,
const QGeoRouteRequest & rhs )
friend

Returns whether the route requests lhs and rhs are not equal.

Definition at line 93 of file qgeorouterequest.h.

◆ operator==

bool QGeoRouteRequest::operator== ( const QGeoRouteRequest & lhs,
const QGeoRouteRequest & rhs )
friend

Returns whether the route requests lhs and rhs are equal.

Definition at line 88 of file qgeorouterequest.h.


The documentation for this class was generated from the following files: