QGeoRouteSegment Class

The QGeoRouteSegment class represents a segment of a route. 更多...

头: #include <QGeoRouteSegment>
qmake: QT += location
Since: Qt 5.6

该类在 Qt 5.6 引入。

公共函数

QGeoRouteSegment (const QGeoRouteSegment & other )
QGeoRouteSegment ()
QGeoRouteSegment & operator= (const QGeoRouteSegment & other )
~QGeoRouteSegment ()
qreal distance () const
bool isLegLastSegment () const
bool isValid () const
QGeoManeuver maneuver () const
QGeoRouteSegment nextRouteSegment () const
QList<QGeoCoordinate> path () const
void setDistance (qreal distance )
void setManeuver (const QGeoManeuver & maneuver )
void setNextRouteSegment (const QGeoRouteSegment & routeSegment )
void setPath (const QList<QGeoCoordinate> & path )
void setTravelTime (int secs )
int travelTime () const
bool operator!= (const QGeoRouteSegment & other ) const
bool operator== (const QGeoRouteSegment & other ) const

保护函数

QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> & d ()

详细描述

A QGeoRouteSegment instance has information about the physical layout of the route segment, the length of the route and estimated time required to traverse the route segment and an optional QGeoManeuver associated with the beginning of the route segment.

QGeoRouteSegment instances can be thought of as edges on a routing graph, with QGeoManeuver instances as optional labels attached to the vertices of the graph.

成员函数文档编制

QGeoRouteSegment:: QGeoRouteSegment (const QGeoRouteSegment & other )

Constructs a route segment object from the contents of other .

QGeoRouteSegment:: QGeoRouteSegment ()

Constructs an invalid route segment object.

The route segment will remain invalid until one of setNextRouteSegment (), setTravelTime (), setDistance (), setPath () 或 setManeuver () 被调用。

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

赋值 other to this route segment object and then returns a reference to this route segment object.

QGeoRouteSegment:: ~QGeoRouteSegment ()

Destroys this route segment object.

[protected] QExplicitlySharedDataPointer < QGeoRouteSegmentPrivate > &QGeoRouteSegment:: d ()

Returns the private implementation.

qreal QGeoRouteSegment:: distance () const

Returns the distance covered by this segment of the route, in meters.

另请参阅 setDistance ().

bool QGeoRouteSegment:: isLegLastSegment () const

Returns whether this route segment is the last segment of a route leg.

该函数在 Qt 5.12 引入。

bool QGeoRouteSegment:: isValid () const

Returns whether this route segment is valid or not.

nextRouteSegment () is called on the last route segment of a route, the returned value will be an invalid route segment.

QGeoManeuver QGeoRouteSegment:: maneuver () const

Returns the maneuver for this route segment.

Will return an invalid QGeoManeuver if no information has been attached to the starting point of this route segment.

另请参阅 setManeuver ().

QGeoRouteSegment QGeoRouteSegment:: nextRouteSegment () const

Returns the next route segment in the route.

Will return an invalid route segment if this is the last route segment in the route.

另请参阅 setNextRouteSegment ().

QList < QGeoCoordinate > QGeoRouteSegment:: path () const

Returns the geometric shape of this route segment 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.

另请参阅 setPath ().

void QGeoRouteSegment:: setDistance ( qreal distance )

Sets the distance covered by this segment of the route, in meters, to distance .

另请参阅 distance ().

void QGeoRouteSegment:: setManeuver (const QGeoManeuver & maneuver )

Sets the maneuver for this route segment to maneuver .

另请参阅 maneuver ().

void QGeoRouteSegment:: setNextRouteSegment (const QGeoRouteSegment & routeSegment )

Sets the next route segment in the route to routeSegment .

另请参阅 nextRouteSegment ().

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

Sets the geometric shape of this segment of the route to path .

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

另请参阅 path ().

void QGeoRouteSegment:: setTravelTime ( int secs )

Sets the estimated amount of time it will take to traverse this segment of the route, in seconds, to secs .

另请参阅 travelTime ().

int QGeoRouteSegment:: travelTime () const

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

另请参阅 setTravelTime ().

bool QGeoRouteSegment:: operator!= (const QGeoRouteSegment & other ) const

Returns whether this route segment and other are not equal.

nextRouteSegment () is not considered in the comparison.

bool QGeoRouteSegment:: operator== (const QGeoRouteSegment & other ) const

Returns whether this route segment and other 相等。

nextRouteSegment () is not considered in the comparison.