![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtPositioning More...
#include <qgeopath.h>
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. | |
QGeoPath & | operator= (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. | |
![]() | |
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. | |
QGeoShape & | operator= (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. | |
![]() | |
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 | |
QDataStream & | operator<< (QDataStream &stream, const QGeoPath &path) |
QDataStream & | operator>> (QDataStream &stream, QGeoPath &path) |
Additional Inherited Members | |
![]() | |
enum | ShapeType { UnknownType , RectangleType , CircleType , PathType , PolygonType } |
Describes the type of the shape. More... | |
![]() | |
QGeoShape (QGeoShapePrivate *d) | |
![]() | |
QSharedDataPointer< QGeoShapePrivate > | d_ptr |
\inmodule QtPositioning
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.
Definition at line 15 of file qgeopath.h.
QGeoPath::QGeoPath | ( | ) |
Constructs a new, empty geo path.
Definition at line 74 of file qgeopath.cpp.
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::QGeoPath | ( | const QGeoPath & | other | ) |
Constructs a new geo path from the contents of other.
Definition at line 91 of file qgeopath.cpp.
QGeoPath::QGeoPath | ( | const QGeoShape & | other | ) |
Constructs a new geo path from the contents of other.
Definition at line 99 of file qgeopath.cpp.
QGeoPath::~QGeoPath | ( | ) |
Destroys this path.
Definition at line 109 of file qgeopath.cpp.
void QGeoPath::addCoordinate | ( | const QGeoCoordinate & | coordinate | ) |
Appends coordinate to the path.
Definition at line 259 of file qgeopath.cpp.
void QGeoPath::clearPath | ( | ) |
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.
QGeoCoordinate QGeoPath::coordinateAt | ( | qsizetype | index | ) | const |
Returns the coordinate at index .
Definition at line 288 of file qgeopath.cpp.
void QGeoPath::insertCoordinate | ( | qsizetype | index, |
const QGeoCoordinate & | coordinate ) |
Inserts coordinate at the specified index.
Definition at line 270 of file qgeopath.cpp.
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.
Assigns other to this geo path and returns a reference to this geo path.
Definition at line 114 of file qgeopath.cpp.
const QList< QGeoCoordinate > & QGeoPath::path | ( | ) | const |
Returns all the elements of the path.
Definition at line 132 of file qgeopath.cpp.
void QGeoPath::removeCoordinate | ( | const QGeoCoordinate & | coordinate | ) |
Removes the last occurrence of coordinate from the path.
Definition at line 306 of file qgeopath.cpp.
Removes element at position index from the path.
Definition at line 315 of file qgeopath.cpp.
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.
void QGeoPath::setPath | ( | const QList< QGeoCoordinate > & | path | ) |
Sets all the elements of the path.
Definition at line 123 of file qgeopath.cpp.
void QGeoPath::setVariantPath | ( | const QVariantList & | path | ) |
Sets all the elements of the path.
Definition at line 154 of file qgeopath.cpp.
Definition at line 184 of file qgeopath.cpp.
qsizetype QGeoPath::size | ( | ) | const |
QString QGeoPath::toString | ( | ) | const |
Returns the geo path properties as a string.
Definition at line 324 of file qgeopath.cpp.
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.
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.
Definition at line 221 of file qgeopath.cpp.
QVariantList QGeoPath::variantPath | ( | ) | const |
Returns all the elements of the path.
Definition at line 169 of file qgeopath.cpp.
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.
|
friend |
Definition at line 59 of file qgeopath.h.
|
friend |
Definition at line 63 of file qgeopath.h.
|
readwrite |
This property holds the list of coordinates for the geo path.
Definition at line 18 of file qgeopath.h.
|
readwrite |
the width of the path in meters.
Definition at line 19 of file qgeopath.h.