RouteSegment QML Type

The RouteSegment type represents a segment of a Route. More...

Import Statement: import QtLocation 5.12
Since: QtLocation 5.5

Properties

Detailed Description

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 RouteManeuvers associated with the end of the route segment.

RouteSegment instances 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.

Example

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

import QtQuick 2.3
import QtPositioning 5.5
import QtLocation 5.6

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

Property Documentation

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.

See also QtPositioning::coordinate.


travelTime : int

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


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