QGeoRoute Class

The QGeoRoute class represents a route between two points. More...

Header: #include <QGeoRoute>
qmake: QT += location

Properties

Public Functions

QGeoRoute()
QGeoRoute(const QGeoRoute &other)
~QGeoRoute()
QGeoRectangle bounds() const
qreal distance() const
QVariantMap extendedAttributes() const
QGeoRouteSegment firstRouteSegment() const
int legIndex() const
QGeoRoute overallRoute() const
QList<QGeoCoordinate> path() const
QString routeId() const
QList<QGeoRoute> routeLegs() const
QList<QGeoRouteSegment> segments() const
qsizetype segmentsCount() const
void setFirstRouteSegment(const QGeoRouteSegment &routeSegment)
void setPath(const QList<QGeoCoordinate> &path)
void setTravelMode(QGeoRouteRequest::TravelMode mode)
QGeoRouteRequest::TravelMode travelMode() const
int travelTime() const
QGeoRoute &operator=(const QGeoRoute &other)

Protected Functions

QExplicitlySharedDataPointer<QGeoRoutePrivate> &d()
bool operator!=(const QGeoRoute &lhs, const QGeoRoute &rhs)
bool operator==(const QGeoRoute &lhs, const QGeoRoute &rhs)

Detailed Description

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.

Property Documentation

[read-only] bounds : const QGeoRectangle

This property holds the bounding box which encompasses the entire route

Access functions:

QGeoRectangle bounds() const

[read-only] distance : const qreal

This property holds the distance covered by this route, in meters

Access functions:

qreal distance() const

[read-only] extendedAttributes : const QVariantMap

This property holds the extended attributes associated with this route

Access functions:

QVariantMap extendedAttributes() const

[read-only] legIndex : const int

This property holds 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.

Access functions:

int legIndex() const

[read-only] overallRoute : const QGeoRoute

This property holds 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.

Access functions:

QGeoRoute overallRoute() const

path : QList<QGeoCoordinate>

This property holds 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.

Access functions:

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

[read-only] routeId : const QString

This property holds 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.

Access functions:

QString routeId() const

[read-only] routeLegs : const QList<QGeoRoute>

This property holds the route legs for a multi-waypoint route

Access functions:

QList<QGeoRoute> routeLegs() const

[read-only] segments : const QList<QGeoRouteSegment>

This property holds the list of QGeoRouteSegment objects of this route

Access functions:

QList<QGeoRouteSegment> segments() const

[read-only] segmentsCount : const qsizetype

This property holds the number of segments in the route

Access functions:

qsizetype segmentsCount() const

[read-only] travelTime : const int

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

Access functions:

int travelTime() const

Member Function Documentation

QGeoRoute::QGeoRoute()

Constructs a route object.

QGeoRoute::QGeoRoute(const QGeoRoute &other)

Constructs a route object from the contents of other.

QGeoRoute::~QGeoRoute()

Destroys this route object.

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

Returns the private implementation.

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.

See also setFirstRouteSegment().

void QGeoRoute::setFirstRouteSegment(const QGeoRouteSegment &routeSegment)

Sets the first route segment in the route to routeSegment.

See also firstRouteSegment().

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().

See also 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().

See also setTravelMode().

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

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

Related Non-Members

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

Returns whether the routes lhs and rhs are not equal.

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

Returns whether the routes lhs and rhs are equal.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.