本页内容

QGeoManeuver Class

QGeoManeuver 类表示两个 QGeoRouteSegment 相交点的相关信息。更多内容...

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

公共类型

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

属性

公开活动

QGeoManeuver()
QGeoManeuver(const QGeoManeuver &other)
QGeoManeuver(QGeoManeuver &&other)
~QGeoManeuver()
QGeoManeuver::InstructionDirection direction() const
qreal distanceToNextInstruction() const
QVariantMap extendedAttributes() const
QString instructionText() const
bool isValid() const
QGeoCoordinate position() const
int timeToNextInstruction() const
QGeoCoordinate waypoint() const
QGeoManeuver &operator=(const QGeoManeuver &other)
bool operator!=(const QGeoManeuver &lhs, const QGeoManeuver &rhs)
bool operator==(const QGeoManeuver &lhs, const QGeoManeuver &rhs)

详细说明

QGeoRouteSegment 实例可视为路由图上的边,而 QGeoManeuver 实例则是附加在图的顶点上的可选标签。

QGeoManeuver 实例中最有用的信息通常是需要提供的文本导航信息以及提供该信息的位置,分别可通过instructionText() 和position() 访问。

此外,还可以通过检查waypoint() 是否返回一个有效的QGeoCoordinate 来确定是否已通过某个路线航点。

成员类型文档

enum QGeoManeuver::InstructionDirection

描述与 QGeoManaeuver 相关联的指令文本所对应的方向变化。

常量值描述
QGeoManeuver::NoDirection0该指令文本未关联任何方向。
QGeoManeuver::DirectionForward1该指令表明行进方向无需改变。
QGeoManeuver::DirectionBearRight2该指令表示行驶方向应向右偏转。
QGeoManeuver::DirectionLightRight3该指令表示需要向右轻微转弯。
QGeoManeuver::DirectionRight4该指令表示需要向右转弯。
QGeoManeuver::DirectionHardRight5该指令表示需要向右急转弯。
QGeoManeuver::DirectionUTurnRight6该指令表示需要向右掉头。
QGeoManeuver::DirectionUTurnLeft7该指令表示需要向左掉头。
QGeoManeuver::DirectionHardLeft8该指示表示需要向左急转弯。
QGeoManeuver::DirectionLeft9该指令表示需要向左转弯。
QGeoManeuver::DirectionLightLeft10该指示表明需要向左轻微转弯。
QGeoManeuver::DirectionBearLeft11该指示表明行驶方向应偏向左侧。

属性文档

[read-only] direction : const InstructionDirection

该属性保存与相关指令关联的方向。

访问函数:

QGeoManeuver::InstructionDirection direction() const

[read-only] distanceToNextInstruction : const qreal

该属性存储了发出此指令的点与应发出下一条指令的点之间的距离(单位:米)。

访问函数:

qreal distanceToNextInstruction() const

[read-only, since QtLocation 5.11] extendedAttributes : const QVariantMap

该属性存储了与该机动相关的扩展属性。

该枚举在 QtLocation 5.11 中引入。

访问函数:

QVariantMap extendedAttributes() const

[read-only] instructionText : const QString

该属性包含文本导航说明。

访问函数:

QString instructionText() const

[read-only] position : const QGeoCoordinate

该属性指定了instructionText 应显示的位置。

访问函数:

QGeoCoordinate position() const

[read-only] timeToNextInstruction : const int

该属性存储从相关指令发出时点到应发出下一条指令时点所需时间的估计值(单位为秒)。

访问函数:

int timeToNextInstruction() const

[read-only] valid : const bool

该属性用于表示此机动是否有效。

当QGeoRouteSegment 实例的端点无需附加任何信息时,会使用无效操作。

访问函数:

bool isValid() const

[read-only] waypoint : const QGeoCoordinate

该属性存储与该飞行动作相关联的航点。

如果该机动操作未关联任何航点,则该属性将包含一个无效的QGeoCoordinate 。

访问函数:

QGeoCoordinate waypoint() const

成员函数文档

QGeoManeuver::QGeoManeuver()

创建一个无效的航法对象。

在调用 setPosition()、setInstructionText()、setDirection()、setTimeToNextInstruction()、setDistanceToNextInstruction() 或 setWaypoint() 中的任意一个之前,该航行将保持无效状态。

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

根据other 中的内容创建一个机动对象。

[constexpr noexcept default] QGeoManeuver::QGeoManeuver(QGeoManeuver &&other)

通过`Move`构造一个QGeoManeuver 的实例。

[noexcept] QGeoManeuver::~QGeoManeuver()

销毁此机动对象。

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

将other 分配给此机动对象,然后返回对此机动对象的引用。

相关的非成员

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

返回lhs 操作是否不等于rhs 。

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

返回lhs 操作是否等同于rhs 。

© 2026 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.