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

QGeoRoute Class

The QGeoRoute class represents a route between two points.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QGeoRoute Class

  • Header: QGeoRoute

  • qmake: QT += location

  • Group: QGeoRoute is part of QtLocation-routing

Detailed Description

A QGeoRoute object 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 QGeoRouteSegment objecs which describe subsections of the route in greater detail.

Routing information is normally requested using QGeoRoutingManager::calculateRoute(), which returns a QGeoRouteReply instance. If the operation is completed successfully the routing information can be accessed with QGeoRouteReply::routes()

See Also

Property Documentation

 

[read-only] bounds : const QGeoRectangle

This property holds the bounding box which encompasses the entire route

Access functions:

  • bounds() const

[read-only] distance : const qreal

This property holds the distance covered by this route, in meters

Access functions:

  • distance() const

[read-only] extendedAttributes : const QVariantMap

This property holds the extended attributes associated with this route

Access functions:

  • QVariantMap extendedAttributes() const

[read-only] legIndex : const int

This property holds the leg index of this route

The index of the leg inside the containing QGeoRoute::routeLegs list can be used to find the next legs.

Access functions:

  • int legIndex() const

[read-only] overallRoute : const QGeoRoute

This property holds the route that contains this route leg

This this route is not a leg within an overall route, then this property holds an empty route.

Access functions:

  • overallRoute() const

path : QList<QGeoCoordinate>

This property holds the geometric shape of the route

The coordinates should be listed in the order in which they would be traversed by someone traveling along this segment of the route.

Access functions:

  • <> path() const

  • void setPath(const <> &path)

[read-only] routeId : const QString

This property holds the identifier of this route

Service providers which support the updating of routes commonly assign identifiers to routes. If this route came from such a service provider, then changing the identifier will probably cause route updates to stop working.

Access functions:

  • routeId() const

[read-only] routeLegs : const QList<QGeoRoute>

This property holds the route legs for a multi-waypoint route

Access functions:

  • <> routeLegs() const

[read-only] segments : const QList<QGeoRouteSegment>

This property holds the list of QGeoRouteSegment objects of this route

Access functions:

  • <> segments() const

[read-only] segmentsCount : const qsizetype

This property holds the number of segments in the route

Access functions:

  • qsizetype segmentsCount() const

[read-only] travelTime : const int

This property holds the estimated amount of time it will take to traverse this route, in seconds

Access functions:

  • int travelTime() const

Member Function Documentation

 

QGeoRoute::QGeoRoute()

Constructs a route object.

QGeoRoute::QGeoRoute(const QGeoRoute &other)

Constructs a route object from the contents of other.

QGeoRoute::~QGeoRoute()

Destroys this route object.

[protected] QExplicitlySharedDataPointer<QGeoRoutePrivate> &QGeoRoute::d()

Returns the private implementation.

QGeoRouteSegment QGeoRoute::firstRouteSegment() const

Returns the first route segment in the route.

Will return an invalid route segment if there are no route segments associated with the route.

The remaining route segments can be accessed sequentially with QGeoRouteSegment::nextRouteSegment.

See Also

void QGeoRoute::setFirstRouteSegment(const QGeoRouteSegment &routeSegment)

Sets the first route segment in the route to routeSegment.

See Also

See also firstRouteSegment()

void QGeoRoute::setTravelMode(QGeoRouteRequest::TravelMode mode)

Sets the travel mode for this route to mode.

This should be one of the travel modes returned by request().travelModes().

See Also

See also travelMode()

QGeoRouteRequest::TravelMode QGeoRoute::travelMode() const

Returns the travel mode for the this route.

This should be one of the travel modes returned by request().travelModes().

See Also

See also setTravelMode()

QGeoRoute &QGeoRoute::operator=(const QGeoRoute &other)

Assigns the contents of other to this route and returns a reference to this route.

Related Non-Members

 

bool operator!=(const QGeoRoute &lhs, const QGeoRoute &rhs)

Returns whether the routes lhs and rhs are not equal.

bool operator==(const QGeoRoute &lhs, const QGeoRoute &rhs)

Returns whether the routes lhs and rhs are equal.

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