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
QGeoPath Class Reference

\inmodule QtPositioning More...

#include <qgeopath.h>

+ Inheritance diagram for QGeoPath:
+ Collaboration diagram for QGeoPath:

Public Member Functions

 QGeoPath ()
 Constructs a new, empty geo path.
 
 QGeoPath (const QList< QGeoCoordinate > &path, const qreal &width=0.0)
 Constructs a new geo path from a list of coordinates (path and width).
 
 QGeoPath (const QGeoPath &other)
 Constructs a new geo path from the contents of other.
 
 QGeoPath (const QGeoShape &other)
 Constructs a new geo path from the contents of other.
 
 ~QGeoPath ()
 Destroys this path.
 
QGeoPathoperator= (const QGeoPath &other)
 Assigns other to this geo path and returns a reference to this geo path.
 
void setPath (const QList< QGeoCoordinate > &path)
 Sets all the elements of the path.
 
const QList< QGeoCoordinate > & path () const
 Returns all the elements of the path.
 
void clearPath ()
 Clears the path.
 
void setVariantPath (const QVariantList &path)
 Sets all the elements of the path.
 
QVariantList variantPath () const
 Returns all the elements of the path.
 
void setWidth (const qreal &width)
 
qreal width () const
 Returns the width of the path, in meters.
 
Q_INVOKABLE void translate (double degreesLatitude, double degreesLongitude)
 Translates this geo path by degreesLatitude northwards and degreesLongitude eastwards.
 
Q_INVOKABLE QGeoPath translated (double degreesLatitude, double degreesLongitude) const
 Returns a copy of this geo path translated by degreesLatitude northwards and degreesLongitude eastwards.
 
Q_INVOKABLE double length (qsizetype indexFrom=0, qsizetype indexTo=-1) const
 Returns the length of the path, in meters, from the element indexFrom to the element indexTo.
 
Q_INVOKABLE qsizetype size () const
 Returns the number of elements in the path.
 
Q_INVOKABLE void addCoordinate (const QGeoCoordinate &coordinate)
 Appends coordinate to the path.
 
Q_INVOKABLE void insertCoordinate (qsizetype index, const QGeoCoordinate &coordinate)
 Inserts coordinate at the specified index.
 
Q_INVOKABLE void replaceCoordinate (qsizetype index, const QGeoCoordinate &coordinate)
 Replaces the path element at the specified index with coordinate.
 
Q_INVOKABLE QGeoCoordinate coordinateAt (qsizetype index) const
 Returns the coordinate at index .
 
Q_INVOKABLE bool containsCoordinate (const QGeoCoordinate &coordinate) const
 Returns true if the path contains coordinate as one of the elements.
 
Q_INVOKABLE void removeCoordinate (const QGeoCoordinate &coordinate)
 Removes the last occurrence of coordinate from the path.
 
Q_INVOKABLE void removeCoordinate (qsizetype index)
 Removes element at position index from the path.
 
Q_INVOKABLE QString toString () const
 Returns the geo path properties as a string.
 
- Public Member Functions inherited from QGeoShape
 QGeoShape ()
 Constructs a new invalid geo shape of \l UnknownType.
 
Q_INVOKABLE QGeoShape (const QGeoShape &other)
 Constructs a new geo shape which is a copy of other.
 
 ~QGeoShape ()
 Destroys this geo shape.
 
ShapeType type () const
 Returns the type of this geo shape.
 
bool isValid () const
 Returns whether this geo shape is valid.
 
bool isEmpty () const
 Returns whether this geo shape is empty.
 
Q_INVOKABLE bool contains (const QGeoCoordinate &coordinate) const
 Returns whether the coordinate coordinate is contained within this geo shape.
 
Q_INVOKABLE QGeoRectangle boundingGeoRectangle () const
 Returns a QGeoRectangle representing the geographical bounding rectangle of the geo shape, that defines the latitudinal/longitudinal bounds of the geo shape.
 
QGeoCoordinate center () const
 Returns the coordinate located at the geometric center of the geo shape.
 
QGeoShapeoperator= (const QGeoShape &other)
 Assigns other to this geo shape and returns a reference to this geo shape.
 
Q_INVOKABLE QString toString () const
 Returns a string representation of this geo shape.
 

Properties

QVariantList path
 This property holds the list of coordinates for the geo path.
 
qreal width
 the width of the path in meters.
 
- Properties inherited from QGeoShape
ShapeType type
 This property holds the type of this geo shape.
 
bool isValid
 This property holds the validity of the geo shape.
 
bool isEmpty
 This property defines whether this geo shape is empty.
 
QGeoCoordinate center
 

Friends

QDataStreamoperator<< (QDataStream &stream, const QGeoPath &path)
 
QDataStreamoperator>> (QDataStream &stream, QGeoPath &path)
 

Additional Inherited Members

- Public Types inherited from QGeoShape
enum  ShapeType {
  UnknownType , RectangleType , CircleType , PathType ,
  PolygonType
}
 Describes the type of the shape. More...
 
- Protected Member Functions inherited from QGeoShape
 QGeoShape (QGeoShapePrivate *d)
 
- Protected Attributes inherited from QGeoShape
QSharedDataPointer< QGeoShapePrivated_ptr
 

Detailed Description

\inmodule QtPositioning

Since
5.9

The QGeoPath class defines a geographic path.

The path is defined by an ordered list of \l QGeoCoordinate objects.

Each two adjacent elements in the path are intended to be connected together by the shortest line segment of constant bearing passing through both elements. This type of connection can cross the dateline in the longitudinal direction, but never crosses the poles.

This is relevant for the calculation of the bounding box returned by \l QGeoShape::boundingGeoRectangle() for this shape, which will have the latitude of the top left corner set to the maximum latitude in the path point set. Similarly, the latitude of the bottom right corner will be the minimum latitude in the path point set.

This class is a \l Q_GADGET. It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.

A QGeoPath is both invalid and empty if it contains no coordinate.

Note
A default constructed QGeoPath is both invalid and empty as it does not contain any coordinates.

Definition at line 15 of file qgeopath.h.

Constructor & Destructor Documentation

◆ QGeoPath() [1/4]

QGeoPath::QGeoPath ( )

Constructs a new, empty geo path.

Definition at line 74 of file qgeopath.cpp.

Referenced by QGeoPathEager::QGeoPathEager().

+ Here is the caller graph for this function:

◆ QGeoPath() [2/4]

QGeoPath::QGeoPath ( const QList< QGeoCoordinate > & path,
const qreal & width = 0.0 )

Constructs a new geo path from a list of coordinates (path and width).

Definition at line 83 of file qgeopath.cpp.

◆ QGeoPath() [3/4]

QGeoPath::QGeoPath ( const QGeoPath & other)

Constructs a new geo path from the contents of other.

Definition at line 91 of file qgeopath.cpp.

◆ QGeoPath() [4/4]

QGeoPath::QGeoPath ( const QGeoShape & other)

Constructs a new geo path from the contents of other.

Definition at line 99 of file qgeopath.cpp.

References QGeoShape::d_ptr, QGeoShape::PathType, and QGeoShape::type.

◆ ~QGeoPath()

QGeoPath::~QGeoPath ( )

Destroys this path.

Definition at line 109 of file qgeopath.cpp.

Member Function Documentation

◆ addCoordinate()

void QGeoPath::addCoordinate ( const QGeoCoordinate & coordinate)

Appends coordinate to the path.

Definition at line 259 of file qgeopath.cpp.

References d, kWarningString, and qWarning.

Referenced by QDeclarativePolylineMapItem::addCoordinate().

+ Here is the caller graph for this function:

◆ clearPath()

void QGeoPath::clearPath ( )

Clears the path.

Since
5.12

Definition at line 143 of file qgeopath.cpp.

References d.

◆ containsCoordinate()

bool QGeoPath::containsCoordinate ( const QGeoCoordinate & coordinate) const

Returns true if the path contains coordinate as one of the elements.

Definition at line 297 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::containsCoordinate().

+ Here is the caller graph for this function:

◆ coordinateAt()

QGeoCoordinate QGeoPath::coordinateAt ( qsizetype index) const

Returns the coordinate at index .

Definition at line 288 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::coordinateAt().

+ Here is the caller graph for this function:

◆ insertCoordinate()

void QGeoPath::insertCoordinate ( qsizetype index,
const QGeoCoordinate & coordinate )

Inserts coordinate at the specified index.

Definition at line 270 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::insertCoordinate().

+ Here is the caller graph for this function:

◆ length()

double QGeoPath::length ( qsizetype indexFrom = 0,
qsizetype indexTo = -1 ) const

Returns the length of the path, in meters, from the element indexFrom to the element indexTo.

The length is intended to be the sum of the shortest distances for each pair of adjacent points.

If indexTo is -1 (the default value), the length will be including the distance between last coordinate and the first (closed loop). To retrieve the length for the path, use 0 for indexFrom and \l QGeoPath::size() - 1 for indexTo.

Definition at line 236 of file qgeopath.cpp.

References d.

◆ operator=()

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

Assigns other to this geo path and returns a reference to this geo path.

Definition at line 114 of file qgeopath.cpp.

References QGeoShape::operator=(), and other().

+ Here is the call graph for this function:

◆ path()

const QList< QGeoCoordinate > & QGeoPath::path ( ) const

Returns all the elements of the path.

Definition at line 132 of file qgeopath.cpp.

References d.

◆ removeCoordinate() [1/2]

void QGeoPath::removeCoordinate ( const QGeoCoordinate & coordinate)

Removes the last occurrence of coordinate from the path.

Definition at line 306 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::removeCoordinate(), and QDeclarativePolylineMapItem::removeCoordinate().

+ Here is the caller graph for this function:

◆ removeCoordinate() [2/2]

void QGeoPath::removeCoordinate ( qsizetype index)

Removes element at position index from the path.

Definition at line 315 of file qgeopath.cpp.

References d.

◆ replaceCoordinate()

void QGeoPath::replaceCoordinate ( qsizetype index,
const QGeoCoordinate & coordinate )

Replaces the path element at the specified index with coordinate.

Definition at line 279 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::replaceCoordinate().

+ Here is the caller graph for this function:

◆ setPath()

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

Sets all the elements of the path.

Definition at line 123 of file qgeopath.cpp.

References d.

Referenced by QGeoPathEager::QGeoPathEager(), and QDeclarativePolylineMapItem::setPathFromGeoList().

+ Here is the caller graph for this function:

◆ setVariantPath()

void QGeoPath::setVariantPath ( const QVariantList & path)

Sets all the elements of the path.

Definition at line 154 of file qgeopath.cpp.

References d, and path.

◆ setWidth()

void QGeoPath::setWidth ( const qreal & width)

Definition at line 184 of file qgeopath.cpp.

References d.

Referenced by QGeoPathEager::QGeoPathEager().

+ Here is the caller graph for this function:

◆ size()

qsizetype QGeoPath::size ( ) const

Returns the number of elements in the path.

Since
5.10

Definition at line 247 of file qgeopath.cpp.

References d, kWarningString, and qWarning.

◆ toString()

QString QGeoPath::toString ( ) const

Returns the geo path properties as a string.

Definition at line 324 of file qgeopath.cpp.

References path, QGeoShape::PathType, QStringLiteral, qWarning, and QGeoShape::type.

◆ translate()

void QGeoPath::translate ( double degreesLatitude,
double degreesLongitude )

Translates this geo path by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

Definition at line 206 of file qgeopath.cpp.

References d.

Referenced by QDeclarativePolylineMapItem::geometryChange().

+ Here is the caller graph for this function:

◆ translated()

QGeoPath QGeoPath::translated ( double degreesLatitude,
double degreesLongitude ) const

Returns a copy of this geo path translated by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

See also
translate()

Definition at line 221 of file qgeopath.cpp.

◆ variantPath()

QVariantList QGeoPath::variantPath ( ) const

Returns all the elements of the path.

Definition at line 169 of file qgeopath.cpp.

References d, and QVariant::fromValue().

+ Here is the call graph for this function:

◆ width()

qreal QGeoPath::width ( ) const

Returns the width of the path, in meters.

This information is used in the \l contains method. The default value is 0.

Definition at line 194 of file qgeopath.cpp.

References d.

Friends And Related Symbol Documentation

◆ operator<<

QDataStream & operator<< ( QDataStream & stream,
const QGeoPath & path )
friend

Definition at line 59 of file qgeopath.h.

◆ operator>>

QDataStream & operator>> ( QDataStream & stream,
QGeoPath & path )
friend

Definition at line 63 of file qgeopath.h.

Property Documentation

◆ path

◆ width

QGeoPath::width
readwrite

the width of the path in meters.

Definition at line 19 of file qgeopath.h.


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