The QGeoPath class defines a geographic path. More...
Header: | #include <QGeoPath> |
qmake: | QT += positioning |
Since: | Qt 5.9 |
Inherits: | QGeoShape |
QGeoPath() | |
QGeoPath(const QList<QGeoCoordinate> &path, const qreal &width = 0.0) | |
QGeoPath(const QGeoPath &other) | |
QGeoPath(const QGeoShape &other) | |
~QGeoPath() | |
void | addCoordinate(const QGeoCoordinate &coordinate) |
bool | containsCoordinate(const QGeoCoordinate &coordinate) const |
QGeoCoordinate | coordinateAt(int index) const |
void | insertCoordinate(int index, const QGeoCoordinate &coordinate) |
double | length(int indexFrom = 0, int indexTo = -1) const |
const QList<QGeoCoordinate> & | path() const |
void | removeCoordinate(const QGeoCoordinate &coordinate) |
void | removeCoordinate(int index) |
void | replaceCoordinate(int index, const QGeoCoordinate &coordinate) |
void | setPath(const QList<QGeoCoordinate> &path) |
void | setWidth(const qreal &width) |
int | size() const |
QString | toString() const |
void | translate(double degreesLatitude, double degreesLongitude) |
QGeoPath | translated(double degreesLatitude, double degreesLongitude) const |
qreal | width() const |
bool | operator!=(const QGeoPath &other) const |
QGeoPath & | operator=(const QGeoPath &other) |
bool | operator==(const QGeoPath &other) const |
The QGeoPath class defines a geographic path.
The path is defined by an ordered list of QGeoCoordinates.
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 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 Q_GADGET. It can be 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.
This property holds the list of coordinates for the geo path.
Note: The coordinates cannot be processed in place. To change the value of this property, retrieve the complete list of coordinates, process them, and assign the new value to the property.
This property holds the width of the path in meters.
Access functions:
qreal | width() const |
void | setWidth(const qreal &width) |
Constructs a new, empty geo path.
Constructs a new geo path from a list of coordinates (path and width).
Constructs a new geo path from the contents of other.
Constructs a new geo path from the contents of other.
Destroys this path.
Appends coordinate to the path.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Returns true if the path contains coordinate as one of the elements.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Returns the coordinate at index .
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Inserts coordinate at the specified index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
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.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Returns all the elements of the path.
See also setPath().
Removes the last occurrence of coordinate from the path.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Removes element at position index from the path.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Replaces the path element at the specified index with coordinate.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Sets all the elements of the path.
See also path().
Returns the number of elements in the path.
This function was introduced in Qt 5.10.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Returns the geo path properties as a string.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
Translates this geo path by degreesLatitude northwards and degreesLongitude eastwards.
Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
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.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also translate().
Returns the width of the path, in meters. This information is used in the contains method. The default value is 0.
Note: Getter function for property width.
See also setWidth().
Returns whether this geo path is not equal to other.
Assigns other to this geo path and returns a reference to this geo path.
Returns whether this geo path is equal to other.