routeSegment QML Type

The routeSegment type represents a segment of a Route. 更多...

import 语句: import QtLocation 6.7
Since: QtLocation 5.5

特性

详细描述

A routeSegment 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 optional routeManeuver s associated with the end of the route segment.

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

The primary means of acquiring Route objects is via Routes via RouteModel .

范例

The following QML snippet demonstrates how to print information about a route segment:

import QtQuick
import QtPositioning
import QtLocation
Text {
    text: "Segment distance " + routeSegment.distance + " meters, " + routeSegment.path.length + " points."
}
					

特性文档编制

distance : real

Read-only property which holds the distance covered by this segment of the route, in meters.

maneuver : RouteManeuver

Read-only property which holds the maneuver for this route segment.

Will return invalid maneuver if no information has been attached to the endpoint of this route segment.

path : list < coordinate >

Read-only property which holds the geographical coordinates of this segment. Coordinates are listed in the order in which they would be traversed by someone traveling along this segment of the route.

To access individual segments you can use standard list accessors: 'path.length' indicates the number of objects and 'path[index starting from zero]' gives the actual object.

另请参阅 QtPositioning::coordinate .

travelTime : int

Read-only property which holds the estimated amount of time it will take to traverse this segment, in seconds.