QGeoRoute Class

The QGeoRoute class represents a route between two points. 更多...

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

特性

公共函数

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 )

保护函数

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

详细描述

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

另请参阅 QGeoRoutingManager .

特性文档编制

[read-only] bounds : const QGeoRectangle

This property holds the bounding box which encompasses the entire route

访问函数:

QGeoRectangle bounds () const

[read-only] distance : const qreal

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

访问函数:

qreal distance () const

[read-only] extendedAttributes : const QVariantMap

This property holds the extended attributes associated with this route

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

QString routeId () const

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

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

访问函数:

QList<QGeoRoute> routeLegs () const

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

This property holds the list of QGeoRouteSegment objects of this route

访问函数:

QList<QGeoRouteSegment> segments () const

[read-only] segmentsCount : const qsizetype

This property holds the number of segments in the route

访问函数:

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

访问函数:

int travelTime () const

成员函数文档编制

QGeoRoute:: QGeoRoute ()

Constructs a route object.

[noexcept] QGeoRoute:: QGeoRoute (const QGeoRoute & other )

Constructs a route object from the contents of other .

[noexcept] 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 .

另请参阅 setFirstRouteSegment ().

void QGeoRoute:: setFirstRouteSegment (const QGeoRouteSegment & routeSegment )

Sets the first route segment in the route to routeSegment .

另请参阅 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().

另请参阅 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().

另请参阅 setTravelMode ().

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

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

相关非成员

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

Returns whether the routes lhs and rhs are not equal.

[noexcept] bool operator== (const QGeoRoute & lhs , const QGeoRoute & rhs )

Returns whether the routes lhs and rhs 相等。