QGeoManeuver Class

The QGeoManeuver class represents the information relevant to the point at which two QGeoRouteSegments meet. 更多...

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

该类在 Qt 5.6 引入。

公共类型

enum InstructionDirection { NoDirection, DirectionForward, DirectionBearRight, DirectionLightRight, DirectionRight, …, DirectionBearLeft }

公共函数

QGeoManeuver (const QGeoManeuver & other )
QGeoManeuver ()
QGeoManeuver & operator= (const QGeoManeuver & other )
~QGeoManeuver ()
QGeoManeuver::InstructionDirection direction () const
qreal distanceToNextInstruction () const
QVariantMap extendedAttributes () const
QString instructionText () const
bool isValid () const
QGeoCoordinate position () const
void setDirection (QGeoManeuver::InstructionDirection direction )
void setDistanceToNextInstruction (qreal distance )
void setExtendedAttributes (const QVariantMap & extendedAttributes )
void setInstructionText (const QString & instructionText )
void setPosition (const QGeoCoordinate & position )
void setTimeToNextInstruction (int secs )
void setWaypoint (const QGeoCoordinate & coordinate )
int timeToNextInstruction () const
QGeoCoordinate waypoint () const
bool operator!= (const QGeoManeuver & other ) const
bool operator== (const QGeoManeuver & other ) const

详细描述

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.

The most interesting information help in a QGeoManeuver instance is normally the textual navigation to provide and the position at which to provide it, accessible by instructionText () 和 position () 分别。

It is also possible to determine if a routing waypoint has been passed by checking if waypoint () returns a valid QGeoCoordinate .

成员类型文档编制

enum QGeoManeuver:: InstructionDirection

Describes the change in direction associated with the instruction text that is associated with a QGeoManaeuver.

常量 描述
QGeoManeuver::NoDirection 0 There is no direction associated with the instruction text.
QGeoManeuver::DirectionForward 1 The instruction indicates that the direction of travel does not need to change.
QGeoManeuver::DirectionBearRight 2 The instruction indicates that the direction of travel should bear to the right.
QGeoManeuver::DirectionLightRight 3 The instruction indicates that a light turn to the right is required.
QGeoManeuver::DirectionRight 4 The instruction indicates that a turn to the right is required.
QGeoManeuver::DirectionHardRight 5 The instruction indicates that a hard turn to the right is required.
QGeoManeuver::DirectionUTurnRight 6 The instruction indicates that a u-turn to the right is required.
QGeoManeuver::DirectionUTurnLeft 7 The instruction indicates that a u-turn to the left is required.
QGeoManeuver::DirectionHardLeft 8 The instruction indicates that a hard turn to the left is required.
QGeoManeuver::DirectionLeft 9 The instruction indicates that a turn to the left is required.
QGeoManeuver::DirectionLightLeft 10 The instruction indicates that a light turn to the left is required.
QGeoManeuver::DirectionBearLeft 11 The instruction indicates that the direction of travel should bear to the left.

成员函数文档编制

QGeoManeuver:: QGeoManeuver (const QGeoManeuver & other )

Constructs a maneuver object from the contents of other .

QGeoManeuver:: QGeoManeuver ()

Constructs a invalid maneuver object.

The maneuver will remain invalid until one of setPosition (), setInstructionText (), setDirection (), setTimeToNextInstruction (), setDistanceToNextInstruction () 或 setWaypoint () 被调用。

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

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

QGeoManeuver:: ~QGeoManeuver ()

Destroys this maneuver object.

QGeoManeuver::InstructionDirection QGeoManeuver:: direction () const

Returns the direction associated with the associated instruction.

另请参阅 setDirection ().

qreal QGeoManeuver:: distanceToNextInstruction () const

Returns the distance, in meters, between the point at which the associated instruction was issued and the point that the next instruction should be issued.

另请参阅 setDistanceToNextInstruction ().

QVariantMap QGeoManeuver:: extendedAttributes () const

Returns the extended attributes associated with this maneuver.

This function was introduced in QtLocation 5.11.

另请参阅 setExtendedAttributes ().

QString QGeoManeuver:: instructionText () const

Returns the textual navigation instructions.

另请参阅 setInstructionText ().

bool QGeoManeuver:: isValid () const

Returns whether this maneuver is valid or not.

Invalid maneuvers are used when there is no information that needs to be attached to the endpoint of a QGeoRouteSegment 实例。

QGeoCoordinate QGeoManeuver:: position () const

Returns the position where instructionText () should be displayed.

另请参阅 setPosition ().

void QGeoManeuver:: setDirection ( QGeoManeuver::InstructionDirection direction )

Sets the direction associated with the associated instruction to direction .

另请参阅 direction ().

void QGeoManeuver:: setDistanceToNextInstruction ( qreal distance )

Sets the distance, in meters, between the point at which the associated instruction was issued and the point that the next instruction should be issued to distance .

另请参阅 distanceToNextInstruction ().

void QGeoManeuver:: setExtendedAttributes (const QVariantMap & extendedAttributes )

Sets the extended attributes extendedAttributes associated with this maneuver.

This function was introduced in QtLocation 5.11.

另请参阅 extendedAttributes ().

void QGeoManeuver:: setInstructionText (const QString & instructionText )

Sets the textual navigation instructions to instructionText .

另请参阅 instructionText ().

void QGeoManeuver:: setPosition (const QGeoCoordinate & position )

Sets the position where instructionText () should be displayed to position .

另请参阅 position ().

void QGeoManeuver:: setTimeToNextInstruction ( int secs )

Sets the estimated time it will take to travel from the point at which the associated instruction was issued and the point that the next instruction should be issued, in seconds, to secs .

另请参阅 timeToNextInstruction ().

void QGeoManeuver:: setWaypoint (const QGeoCoordinate & coordinate )

Sets the waypoint associated with this maneuver to coordinate .

另请参阅 waypoint ().

int QGeoManeuver:: timeToNextInstruction () const

Returns the estimated time it will take to travel from the point at which the associated instruction was issued and the point that the next instruction should be issued, in seconds.

另请参阅 setTimeToNextInstruction ().

QGeoCoordinate QGeoManeuver:: waypoint () const

Returns the waypoint associated with this maneuver.

If there is not waypoint associated with this maneuver an invalid QGeoCoordinate 将被返回。

另请参阅 setWaypoint ().

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

Returns whether this maneuver is not equal to other .

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

Returns whether this maneuver is equal to other .