Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QGeoRouteSegment Class Reference

\inmodule QtLocation More...

#include <qgeoroutesegment.h>

+ Collaboration diagram for QGeoRouteSegment:

Public Member Functions

 QGeoRouteSegment ()
 \qmltype routeSegment \inqmlmodule QtLocation
 
 QGeoRouteSegment (const QGeoRouteSegment &other) noexcept
 Constructs a route segment object from the contents of other.
 
 QGeoRouteSegment (QGeoRouteSegment &&other) noexcept=default
 
 ~QGeoRouteSegment ()
 Destroys this route segment object.
 
QGeoRouteSegmentoperator= (const QGeoRouteSegment &other) noexcept
 Assigns other to this route segment object and then returns a reference to this route segment object.
 
void swap (QGeoRouteSegment &other) noexcept
 
bool isValid () const
 Returns whether this route segment is valid or not.
 
bool isLegLastSegment () const
 Returns whether this route segment is the last segment of a route leg.
 
void setNextRouteSegment (const QGeoRouteSegment &routeSegment)
 Sets the next route segment in the route to routeSegment.
 
QGeoRouteSegment nextRouteSegment () const
 Returns the next route segment in the route.
 
void setTravelTime (int secs)
 
int travelTime () const
 
void setDistance (qreal distance)
 
qreal distance () const
 
void setPath (const QList< QGeoCoordinate > &path)
 
QList< QGeoCoordinatepath () const
 
void setManeuver (const QGeoManeuver &maneuver)
 
QGeoManeuver maneuver () const
 

Properties

QML_STRUCTURED_VALUEint travelTime
 \qmlproperty int QtLocation::routeSegment::travelTime
 
qreal distance
 \qmlproperty real QtLocation::routeSegment::distance
 
QList< QGeoCoordinatepath
 \qmlproperty list<coordinate> QtLocation::routeSegment::path
 
QGeoManeuver maneuver
 \qmlproperty RouteManeuver QtLocation::routeSegment::maneuver
 

Friends

class QGeoRouteSegmentPrivate
 
bool operator== (const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
 Returns whether the route segments lhs and rhs are equal.
 
bool operator!= (const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
 Returns whether the route segments lhs and rhs are not equal.
 

Detailed Description

\inmodule QtLocation

Since
5.6

The QGeoRouteSegment class represents a segment of a route.

A QGeoRouteSegment 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 an optional QGeoManeuver associated with the beginning of the route segment.

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

Definition at line 20 of file qgeoroutesegment.h.

Constructor & Destructor Documentation

◆ QGeoRouteSegment() [1/3]

QGeoRouteSegment::QGeoRouteSegment ( )

\qmltype routeSegment \inqmlmodule QtLocation

Since
QtLocation 5.5

The routeSegment type represents a segment of a Route.

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 \l {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 \l RouteModel.

Definition at line 68 of file qgeoroutesegment.cpp.

Referenced by nextRouteSegment().

+ Here is the caller graph for this function:

◆ QGeoRouteSegment() [2/3]

QGeoRouteSegment::QGeoRouteSegment ( const QGeoRouteSegment & other)
defaultnoexcept

Constructs a route segment object from the contents of other.

◆ QGeoRouteSegment() [3/3]

QGeoRouteSegment::QGeoRouteSegment ( QGeoRouteSegment && other)
defaultnoexcept

◆ ~QGeoRouteSegment()

QGeoRouteSegment::~QGeoRouteSegment ( )
default

Destroys this route segment object.

Member Function Documentation

◆ distance()

qreal QGeoRouteSegment::distance ( ) const

Definition at line 212 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::distance().

+ Here is the call graph for this function:

◆ isLegLastSegment()

bool QGeoRouteSegment::isLegLastSegment ( ) const

Returns whether this route segment is the last segment of a route leg.

Since
5.12

Definition at line 138 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::isLegLastSegment(), QGeoRouteSegmentPrivate::nextRouteSegment(), and QGeoRouteSegmentPrivate::valid().

+ Here is the call graph for this function:

◆ isValid()

bool QGeoRouteSegment::isValid ( ) const

Returns whether this route segment is valid or not.

If nextRouteSegment() is called on the last route segment of a route, the returned value will be an invalid route segment.

Definition at line 128 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::valid().

+ Here is the call graph for this function:

◆ maneuver()

QGeoManeuver QGeoRouteSegment::maneuver ( ) const

Definition at line 271 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::maneuver().

+ Here is the call graph for this function:

◆ nextRouteSegment()

QGeoRouteSegment QGeoRouteSegment::nextRouteSegment ( ) const

Returns the next route segment in the route.

Will return an invalid route segment if this is the last route segment in the route.

Definition at line 163 of file qgeoroutesegment.cpp.

References QGeoRouteSegment(), QGeoRouteSegmentPrivate::nextRouteSegment(), and QGeoRouteSegmentPrivate::valid().

+ Here is the call graph for this function:

◆ operator=()

QGeoRouteSegment & QGeoRouteSegment::operator= ( const QGeoRouteSegment & other)
noexcept

Assigns other to this route segment object and then returns a reference to this route segment object.

Definition at line 92 of file qgeoroutesegment.cpp.

References other().

+ Here is the call graph for this function:

◆ path()

QList< QGeoCoordinate > QGeoRouteSegment::path ( ) const

Definition at line 244 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::path().

+ Here is the call graph for this function:

◆ setDistance()

void QGeoRouteSegment::setDistance ( qreal distance)

Definition at line 206 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::setDistance(), and QGeoRouteSegmentPrivate::setValid().

Referenced by constructRoute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setManeuver()

void QGeoRouteSegment::setManeuver ( const QGeoManeuver & maneuver)

Definition at line 265 of file qgeoroutesegment.cpp.

References maneuver, QGeoRouteSegmentPrivate::setManeuver(), and QGeoRouteSegmentPrivate::setValid().

+ Here is the call graph for this function:

◆ setNextRouteSegment()

void QGeoRouteSegment::setNextRouteSegment ( const QGeoRouteSegment & routeSegment)

Sets the next route segment in the route to routeSegment.

Definition at line 151 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::setNextRouteSegment(), and QGeoRouteSegmentPrivate::setValid().

+ Here is the call graph for this function:

◆ setPath()

void QGeoRouteSegment::setPath ( const QList< QGeoCoordinate > & path)

Definition at line 238 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::setPath(), and QGeoRouteSegmentPrivate::setValid().

+ Here is the call graph for this function:

◆ setTravelTime()

void QGeoRouteSegment::setTravelTime ( int secs)

Definition at line 184 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::setTravelTime(), and QGeoRouteSegmentPrivate::setValid().

+ Here is the call graph for this function:

◆ swap()

void QGeoRouteSegment::swap ( QGeoRouteSegment & other)
inlinenoexcept

Definition at line 39 of file qgeoroutesegment.h.

References other(), and swap().

Referenced by swap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ travelTime()

int QGeoRouteSegment::travelTime ( ) const

Definition at line 190 of file qgeoroutesegment.cpp.

References QGeoRouteSegmentPrivate::travelTime().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool QGeoRouteSegment::operator!= ( const QGeoRouteSegment & lhs,
const QGeoRouteSegment & rhs )
friend

Returns whether the route segments lhs and rhs are not equal.

The value of nextRouteSegment() is not considered in the comparison.

Definition at line 43 of file qgeoroutesegment.h.

◆ operator==

bool QGeoRouteSegment::operator== ( const QGeoRouteSegment & lhs,
const QGeoRouteSegment & rhs )
friend

Returns whether the route segments lhs and rhs are equal.

The value of nextRouteSegment() is not considered in the comparison.

Definition at line 41 of file qgeoroutesegment.h.

◆ QGeoRouteSegmentPrivate

friend class QGeoRouteSegmentPrivate
friend

Definition at line 70 of file qgeoroutesegment.h.

Property Documentation

◆ distance

QGeoRouteSegment::distance
read

\qmlproperty real QtLocation::routeSegment::distance

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

the distance covered by this segment of the route, in meters.

Definition at line 27 of file qgeoroutesegment.h.

◆ maneuver

QGeoRouteSegment::maneuver
read

\qmlproperty RouteManeuver QtLocation::routeSegment::maneuver

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.

the maneuver for this route segment.

Holds an invalid QGeoManeuver if no information has been attached to the starting point of this route segment.

Definition at line 29 of file qgeoroutesegment.h.

Referenced by setManeuver().

◆ path

QGeoRouteSegment::path
read

\qmlproperty list<coordinate> QtLocation::routeSegment::path

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

the geometric shape of this route segment 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.

Definition at line 28 of file qgeoroutesegment.h.

◆ travelTime

QGeoRouteSegment::travelTime
read

\qmlproperty int QtLocation::routeSegment::travelTime

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

the estimated amount of time, in seconds, that it will take to traverse this segment.

Definition at line 26 of file qgeoroutesegment.h.


The documentation for this class was generated from the following files: