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
QGeoRoute Class Reference

\inmodule QtLocation More...

#include <qgeoroute.h>

+ Collaboration diagram for QGeoRoute:

Public Member Functions

 QGeoRoute ()
 \qmlvaluetype route \inqmlmodule QtLocation
 
 QGeoRoute (const QGeoRoute &other) noexcept
 Constructs a route object from the contents of other.
 
 QGeoRoute (QGeoRoute &&other) noexcept=default
 
 ~QGeoRoute ()
 Destroys this route object.
 
QGeoRouteoperator= (const QGeoRoute &other) noexcept
 Assigns the contents of other to this route and returns a reference to this route.
 
void swap (QGeoRoute &other) noexcept
 
void setRouteId (const QString &id)
 
QString routeId () const
 
void setRequest (const QGeoRouteRequest &request)
 
QGeoRouteRequest request () const
 the route request which describes the criteria used in the calculation of this route
 
void setBounds (const QGeoRectangle &bounds)
 
QGeoRectangle bounds () const
 
void setFirstRouteSegment (const QGeoRouteSegment &routeSegment)
 Sets the first route segment in the route to routeSegment.
 
QGeoRouteSegment firstRouteSegment () const
 Returns the first route segment in the route.
 
qsizetype segmentsCount () const
 
QList< QGeoRouteSegmentsegments () const
 
void setTravelTime (int secs)
 
int travelTime () const
 
void setDistance (qreal distance)
 
qreal distance () const
 
void setTravelMode (QGeoRouteRequest::TravelMode mode)
 Sets the travel mode for this route to mode.
 
QGeoRouteRequest::TravelMode travelMode () const
 Returns the travel mode for the this route.
 
void setPath (const QList< QGeoCoordinate > &path)
 
QList< QGeoCoordinatepath () const
 
void setRouteLegs (const QList< QGeoRoute > &legs)
 
QList< QGeoRouterouteLegs () const
 
void setExtendedAttributes (const QVariantMap &extendedAttributes)
 
QVariantMap extendedAttributes () const
 
void setLegIndex (int idx)
 
int legIndex () const
 
void setOverallRoute (const QGeoRoute &route)
 
QGeoRoute overallRoute () const
 

Protected Member Functions

QExplicitlySharedDataPointer< QGeoRoutePrivate > & d ()
 Returns the private implementation.
 
const QExplicitlySharedDataPointer< QGeoRoutePrivate > & const_d () const
 

Properties

QML_STRUCTURED_VALUEQString routeId
 the identifier of this route
 
QGeoRectangle bounds
 \qmlproperty georectangle QtLocation::route::bounds
 
int travelTime
 \qmlproperty int QtLocation::route::travelTime
 
qreal distance
 \qmlproperty real QtLocation::route::distance
 
QList< QGeoCoordinatepath
 \qmlproperty list<coordinate> QtLocation::route::path
 
QList< QGeoRouterouteLegs
 \qmlproperty list<route> QtLocation::route::legs
 
QVariantMap extendedAttributes
 \qmlproperty Object route::extendedAttributes
 
int legIndex
 \qmlproperty int QtLocation::route::legIndex
 
QGeoRoute overallRoute
 \qmlproperty Route QtLocation::route::overallRoute
 
qsizetype segmentsCount
 \qmlmethod int QtLocation::route::segmentsCount()
 
QList< QGeoRouteSegmentsegments
 \qmlproperty list<routeSegment> QtLocation::route::segments
 

Friends

class QDeclarativeGeoRoute
 
class QGeoRoutePrivate
 
bool operator== (const QGeoRoute &lhs, const QGeoRoute &rhs) noexcept
 Returns whether the routes lhs and rhs are equal.
 
bool operator!= (const QGeoRoute &lhs, const QGeoRoute &rhs) noexcept
 Returns whether the routes lhs and rhs are not equal.
 

Detailed Description

\inmodule QtLocation

Since
5.6

The QGeoRoute class represents a route between two points.

A QGeoRoute object contains high level information about a route, such as the length the route, the estimated travel time for the route, and enough information to render a basic image of the route on a map.

The QGeoRoute object also contains a list of QGeoRouteSegment objecs which describe subsections of the route in greater detail.

Routing information is normally requested using QGeoRoutingManager::calculateRoute(), which returns a QGeoRouteReply instance. If the operation is completed successfully the routing information can be accessed with QGeoRouteReply::routes()

See also
QGeoRoutingManager

Definition at line 23 of file qgeoroute.h.

Constructor & Destructor Documentation

◆ QGeoRoute() [1/3]

QGeoRoute::QGeoRoute ( )

\qmlvaluetype route \inqmlmodule QtLocation

Since
QtLocation 5.5

The route type represents one geographical route.

A route type contains high level information about a route, such as the length the route, the estimated travel time for the route, and enough information to render a basic image of the route on a map.

The QGeoRoute object also contains a list of \l routeSegment objects which describe subsections of the route in greater detail.

The primary means of acquiring route objects is \l RouteModel.

Definition at line 73 of file qgeoroute.cpp.

◆ QGeoRoute() [2/3]

QGeoRoute::QGeoRoute ( const QGeoRoute & other)
defaultnoexcept

Constructs a route object from the contents of other.

◆ QGeoRoute() [3/3]

QGeoRoute::QGeoRoute ( QGeoRoute && other)
defaultnoexcept

◆ ~QGeoRoute()

QGeoRoute::~QGeoRoute ( )
default

Destroys this route object.

Member Function Documentation

◆ bounds()

QGeoRectangle QGeoRoute::bounds ( ) const

Definition at line 182 of file qgeoroute.cpp.

References QGeoRoutePrivate::bounds().

+ Here is the call graph for this function:

◆ const_d()

const QExplicitlySharedDataPointer< QGeoRoutePrivate > & QGeoRoute::const_d ( ) const
protected

Definition at line 85 of file qgeoroute.cpp.

Referenced by legIndex(), and overallRoute().

+ Here is the caller graph for this function:

◆ d()

QExplicitlySharedDataPointer< QGeoRoutePrivate > & QGeoRoute::d ( )
protected

Returns the private implementation.

Definition at line 80 of file qgeoroute.cpp.

Referenced by setLegIndex(), and setOverallRoute().

+ Here is the caller graph for this function:

◆ distance()

qreal QGeoRoute::distance ( ) const

Definition at line 286 of file qgeoroute.cpp.

References QGeoRoutePrivate::distance().

+ Here is the call graph for this function:

◆ extendedAttributes()

QVariantMap QGeoRoute::extendedAttributes ( ) const

Definition at line 398 of file qgeoroute.cpp.

References QGeoRoutePrivate::extendedAttributes().

+ Here is the call graph for this function:

◆ firstRouteSegment()

QGeoRouteSegment QGeoRoute::firstRouteSegment ( ) const

Returns the first route segment in the route.

Will return an invalid route segment if there are no route segments associated with the route.

The remaining route segments can be accessed sequentially with QGeoRouteSegment::nextRouteSegment.

Definition at line 204 of file qgeoroute.cpp.

References QGeoRoutePrivate::firstSegment().

+ Here is the call graph for this function:

◆ legIndex()

int QGeoRoute::legIndex ( ) const

Definition at line 425 of file qgeoroute.cpp.

References const_d(), and QGeoRoutePrivate::legIndex().

+ Here is the call graph for this function:

◆ operator=()

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

Assigns the contents of other to this route and returns a reference to this route.

Definition at line 104 of file qgeoroute.cpp.

References other().

+ Here is the call graph for this function:

◆ overallRoute()

QGeoRoute QGeoRoute::overallRoute ( ) const

Definition at line 448 of file qgeoroute.cpp.

References const_d(), and QGeoRoutePrivate::containingRoute().

+ Here is the call graph for this function:

◆ path()

QList< QGeoCoordinate > QGeoRoute::path ( ) const

Definition at line 338 of file qgeoroute.cpp.

References QGeoRoutePrivate::path().

+ Here is the call graph for this function:

◆ request()

QGeoRouteRequest QGeoRoute::request ( ) const

the route request which describes the criteria used in the calculation of this route

Definition at line 162 of file qgeoroute.cpp.

References QGeoRoutePrivate::request().

Referenced by setRequest(), and QGeoRoutingManagerEngineNokia::updateRoute().

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

◆ routeId()

QString QGeoRoute::routeId ( ) const

Definition at line 146 of file qgeoroute.cpp.

References QGeoRoutePrivate::id().

+ Here is the call graph for this function:

◆ routeLegs()

QList< QGeoRoute > QGeoRoute::routeLegs ( ) const

Definition at line 365 of file qgeoroute.cpp.

References QGeoRoutePrivate::routeLegs().

+ Here is the call graph for this function:

◆ segments()

QList< QGeoRouteSegment > QGeoRoute::segments ( ) const

Definition at line 244 of file qgeoroute.cpp.

References QGeoRoutePrivate::segments().

+ Here is the call graph for this function:

◆ segmentsCount()

qsizetype QGeoRoute::segmentsCount ( ) const

Definition at line 223 of file qgeoroute.cpp.

References QGeoRoutePrivate::segmentsCount().

+ Here is the call graph for this function:

◆ setBounds()

void QGeoRoute::setBounds ( const QGeoRectangle & bounds)

Definition at line 177 of file qgeoroute.cpp.

References bounds, and QGeoRoutePrivate::setBounds().

Referenced by QGeoRouteParserOsrmV5Private::parseReply().

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

◆ setDistance()

void QGeoRoute::setDistance ( qreal distance)

Definition at line 281 of file qgeoroute.cpp.

References QGeoRoutePrivate::setDistance().

Referenced by constructRoute(), and QGeoRouteParserOsrmV5Private::parseReply().

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

◆ setExtendedAttributes()

void QGeoRoute::setExtendedAttributes ( const QVariantMap & extendedAttributes)

Definition at line 393 of file qgeoroute.cpp.

References extendedAttributes, and QGeoRoutePrivate::setExtendedAttributes().

+ Here is the call graph for this function:

◆ setFirstRouteSegment()

void QGeoRoute::setFirstRouteSegment ( const QGeoRouteSegment & routeSegment)

Sets the first route segment in the route to routeSegment.

Definition at line 190 of file qgeoroute.cpp.

References QGeoRoutePrivate::setFirstSegment().

Referenced by constructRoute(), and QGeoRouteParserOsrmV5Private::parseReply().

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

◆ setLegIndex()

void QGeoRoute::setLegIndex ( int idx)

Definition at line 420 of file qgeoroute.cpp.

References d(), and QGeoRoutePrivate::setLegIndex().

+ Here is the call graph for this function:

◆ setOverallRoute()

void QGeoRoute::setOverallRoute ( const QGeoRoute & route)

Definition at line 443 of file qgeoroute.cpp.

References d(), and QGeoRoutePrivate::setContainingRoute().

+ Here is the call graph for this function:

◆ setPath()

void QGeoRoute::setPath ( const QList< QGeoCoordinate > & path)

Definition at line 332 of file qgeoroute.cpp.

References QGeoRoutePrivate::setPath().

Referenced by constructRoute(), and QGeoRouteParserOsrmV5Private::parseReply().

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

◆ setRequest()

void QGeoRoute::setRequest ( const QGeoRouteRequest & request)

Definition at line 157 of file qgeoroute.cpp.

References request(), and QGeoRoutePrivate::setRequest().

+ Here is the call graph for this function:

◆ setRouteId()

void QGeoRoute::setRouteId ( const QString & id)

Definition at line 141 of file qgeoroute.cpp.

References QGeoRoutePrivate::setId().

+ Here is the call graph for this function:

◆ setRouteLegs()

void QGeoRoute::setRouteLegs ( const QList< QGeoRoute > & legs)

Definition at line 360 of file qgeoroute.cpp.

References QGeoRoutePrivate::setRouteLegs().

Referenced by QGeoRouteParserOsrmV5Private::parseReply().

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

◆ setTravelMode()

void QGeoRoute::setTravelMode ( QGeoRouteRequest::TravelMode mode)

Sets the travel mode for this route to mode.

This should be one of the travel modes returned by request().travelModes().

Definition at line 296 of file qgeoroute.cpp.

References QGeoRoutePrivate::setTravelMode().

+ Here is the call graph for this function:

◆ setTravelTime()

void QGeoRoute::setTravelTime ( int secs)

Definition at line 261 of file qgeoroute.cpp.

References QGeoRoutePrivate::setTravelTime().

Referenced by constructRoute(), and QGeoRouteParserOsrmV5Private::parseReply().

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

◆ swap()

void QGeoRoute::swap ( QGeoRoute & other)
inlinenoexcept

Definition at line 50 of file qgeoroute.h.

References other(), and swap().

Referenced by swap().

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

◆ travelMode()

QGeoRouteRequest::TravelMode QGeoRoute::travelMode ( ) const

Returns the travel mode for the this route.

This should be one of the travel modes returned by request().travelModes().

Definition at line 306 of file qgeoroute.cpp.

References QGeoRoutePrivate::travelMode().

Referenced by QGeoRoutingManagerEngineNokia::updateRoute().

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

◆ travelTime()

int QGeoRoute::travelTime ( ) const

Definition at line 266 of file qgeoroute.cpp.

References QGeoRoutePrivate::travelTime().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

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

Returns whether the routes lhs and rhs are not equal.

Definition at line 54 of file qgeoroute.h.

◆ operator==

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

Returns whether the routes lhs and rhs are equal.

Definition at line 52 of file qgeoroute.h.

◆ QDeclarativeGeoRoute

friend class QDeclarativeGeoRoute
friend

Definition at line 103 of file qgeoroute.h.

◆ QGeoRoutePrivate

friend class QGeoRoutePrivate
friend

Definition at line 104 of file qgeoroute.h.

Property Documentation

◆ bounds

QGeoRoute::bounds
read

\qmlproperty georectangle QtLocation::route::bounds

Read-only property which holds a bounding box which encompasses the entire route.

the bounding box which encompasses the entire route

Definition at line 30 of file qgeoroute.h.

Referenced by setBounds().

◆ distance

QGeoRoute::distance
read

\qmlproperty real QtLocation::route::distance

Read-only property which holds distance covered by this route, in meters.

the distance covered by this route, in meters

Definition at line 32 of file qgeoroute.h.

◆ extendedAttributes

QGeoRoute::extendedAttributes
read

\qmlproperty Object route::extendedAttributes

This property holds the extended attributes of the route and is a map. These attributes are plugin specific, and can be empty.

Consult the \l {Qt Location::Plugin References and Parameters}{plugin documentation} for what attributes are supported and how they should be used.

Note, due to limitations of the QQmlPropertyMap, it is not possible to declaratively specify the attributes in QML, assignment of attributes keys and values can only be accomplished by JavaScript.

Since
QtLocation 5.13

the extended attributes associated with this route

Since
5.13

Definition at line 35 of file qgeoroute.h.

Referenced by setExtendedAttributes().

◆ legIndex

QGeoRoute::legIndex
read

\qmlproperty int QtLocation::route::legIndex

Read-only property which holds the index of the leg within the containing route's list of QtLocation::route::legs. The index is -1 if this route is not a leg within an overall route.

See also
overallRoute

the leg index of this route

The index of the leg inside the containing QGeoRoute::routeLegs list can be used to find the next legs.

Definition at line 36 of file qgeoroute.h.

◆ overallRoute

QGeoRoute::overallRoute
read

\qmlproperty Route QtLocation::route::overallRoute

Read-only property which holds the route that contains this leg.

the route that contains this route leg

This this route is not a leg within an overall route, then this property holds an empty route.

Definition at line 37 of file qgeoroute.h.

◆ path

QGeoRoute::path
readwrite

\qmlproperty list<coordinate> QtLocation::route::path

Read-only property which holds the geographical coordinates of this route. Coordinates are listed in the order in which they would be traversed by someone traveling along this segment of the route.

To access individual segments you can use standard list accessors: 'path.length' indicates the number of objects and 'path[index starting from zero]' gives the actual object.

See also
QtPositioning::coordinate

the geometric shape of the route

The coordinates should be listed in the order in which they would be traversed by someone traveling along this segment of the route.

Definition at line 33 of file qgeoroute.h.

Referenced by QDeclarativeRouteMapItem::setRoute().

◆ routeId

QGeoRoute::routeId
read

the identifier of this route

Service providers which support the updating of routes commonly assign identifiers to routes. If this route came from such a service provider, then changing the identifier will probably cause route updates to stop working.

Definition at line 29 of file qgeoroute.h.

◆ routeLegs

QGeoRoute::routeLegs
read

\qmlproperty list<route> QtLocation::route::legs

Returns the route legs associated with this route. Route legs are the sub-routes between each two adjacent waypoints. The result may be empty, if this level of detail is not supported by the backend.

Since
QtLocation 5.12

the route legs for a multi-waypoint route

Since
5.12

Definition at line 34 of file qgeoroute.h.

◆ segments

QGeoRoute::segments
read

\qmlproperty list<routeSegment> QtLocation::route::segments

Read-only property which holds the list of \l routeSegment objects of this route.

To access individual segments you can use standard list accessors: 'segments.length' indicates the number of objects and 'segments[index starting from zero]' gives the actual objects.

See also
routeSegment

the list of QGeoRouteSegment objects of this route

Definition at line 39 of file qgeoroute.h.

◆ segmentsCount

QGeoRoute::segmentsCount
read

\qmlmethod int QtLocation::route::segmentsCount()

Returns the number of segments in the route

See also
routeSegment
Since
5.11

the number of segments in the route

Definition at line 38 of file qgeoroute.h.

◆ travelTime

QGeoRoute::travelTime
read

\qmlproperty int QtLocation::route::travelTime

Read-only property which holds the estimated amount of time it will take to traverse this route, in seconds.

the estimated amount of time it will take to traverse this route, in seconds

Definition at line 31 of file qgeoroute.h.


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