IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Route QML Type

The Route type represents one geographical route.

This type was introduced in QtLocation 5.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Route QML Type

  • Import Statement: import QtLocation 5.12

  • Since: QtLocation 5.5

  • Group: Route is part of qml-QtLocation5-routing

Detailed Description

A Route type contains high level information about a route, such as the length the route, the estimated travel time for the route, and enough information to render a basic image of the route on a map.

The QGeoRoute object also contains a list of RouteSegment objects which describe subsections of the route in greater detail.

The primary means of acquiring Route objects is RouteModel.

Example

This example shows how to display a route's maneuvers in a ListView:

 
Sélectionnez
import QtQuick 2.3
import QtPositioning 5.5
import QtLocation 5.6

RouteModel {
    id: routeModel
    // model initialization
}

ListView {
    id: listview
    anchors.fill: parent
    spacing: 10
    model: routeModel.status == RouteModel.Ready ? routeModel.get(0).segments : null
    visible: model ? true : false
    delegate: Row {
        width: parent.width
        spacing: 10
        property bool hasManeuver : modelData.maneuver && modelData.maneuver.valid
        visible: hasManeuver
        Text { text: (1 + index) + "." }
        Text { text: hasManeuver ? modelData.maneuver.instructionText : "" }
    }
}

Property Documentation

 

bounds : georectangle

Read-only property which holds a bounding box which encompasses the entire route.

distance : real

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

[since QtLocation 5.12] legs : list<Route>

Returns the route legs associated with this route. Route legs are the sub-routes between each two adjacent waypoints. The result may be empty, if this level of detail is not supported by the backend.

This property was introduced in QtLocation 5.12.

path : list<coordinate>

Read-only property which holds the geographical coordinates of this route. 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

[since 5.11] routeQuery : RouteQuery

Returns the route query associated with this route.

This property was introduced in Qt 5.11.

segments : list<RouteSegment>

Read-only property which holds the list of RouteSegment objects of this route.

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

See Also

See also RouteSegment

travelTime : int

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

Method Documentation

 

[since 5.12] bool equals(Route other)

This method performs deep comparison.

This method was introduced in Qt 5.12.

[since 5.11] int segmentsCount()

Returns the number of segments in the route

This method was introduced in Qt 5.11.

See Also

See also RouteSegment

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+