routeSegment QML Type
routeSegment 类型表示路由的一个分段。更多
| Import Statement: | import QtLocation 6.11 |
| Since: | QtLocation 5.5 |
属性
- distance : real
- maneuver : RouteManeuver
- path : list<coordinate>
- travelTime : int
详细说明
routeSegment 实例包含路线段的物理布局信息、路线长度、穿越路线段所需的预计时间以及与路线段终点相关的可选routeManeuvers。
RouteSegment 实例可视为路由图上的边,而routeManeuver 实例则是附在路由图顶点上的可选标签。
获取路由对象的主要途径是通过RouteModel 获取路由。
示例
下面的 QML 代码段演示了如何打印路由段的信息:
import QtQuick import QtPositioning import QtLocation Text { text: "Segment distance " + routeSegment.distance + " meters, " + routeSegment.path.length + " points." }
属性文档
distance : real
只读属性,用于保存这段路线的距离,单位为米。
maneuver : RouteManeuver
只读属性,用于保存此航段的操纵信息。
如果该航段的端点未附加任何信息,则将返回无效操作。
path : list<coordinate>
只读属性,用于保存此路段的地理坐标。坐标按照沿此路段旅行的人所要穿越的顺序排列。
要访问单个路段,可以使用标准的列表访问器:path.length "表示对象的数量,"path[从零开始的索引]"表示实际的对象。
另请参见 QtPositioning::coordinate 。
travelTime : int
只读属性,用于保存遍历此段所需的估计时间,以秒为单位。
© 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.