routeSegment QML Type
routeSegment 类型表示路由的一个分段。更多
Import Statement: | import QtLocation 6.9 |
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 |
路径.length "为只读属性,用于保存穿越此路段所需的估计时间,单位为秒。
© 2025 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.