![]() |
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 <qgeopolygon.h>
Public Member Functions | |
QGeoPolygon () | |
Constructs a new, empty geo polygon. | |
QGeoPolygon (const QList< QGeoCoordinate > &path) | |
Constructs a new geo polygon from the coordinates specified in path. | |
QGeoPolygon (const QGeoPolygon &other) | |
Constructs a new geo polygon from the contents of other. | |
QGeoPolygon (const QGeoShape &other) | |
Constructs a new geo polygon from the contents of other. | |
~QGeoPolygon () | |
Destroys this polygon. | |
QGeoPolygon & | operator= (const QGeoPolygon &other) |
Assigns other to this geo polygon and returns a reference to this geo polygon. | |
void | setPerimeter (const QList< QGeoCoordinate > &path) |
Sets the perimeter of the polygon based on a list of coordinates path. | |
const QList< QGeoCoordinate > & | perimeter () const |
Returns all the elements of the polygon's perimeter. | |
Q_INVOKABLE void | addHole (const QVariant &holePath) |
Sets the holePath for a hole inside the polygon. | |
void | addHole (const QList< QGeoCoordinate > &holePath) |
Overloaded method. | |
Q_INVOKABLE const QVariantList | hole (qsizetype index) const |
Returns a QVariant containing a QList<QGeoCoordinate> which represents the hole at index. | |
const QList< QGeoCoordinate > | holePath (qsizetype index) const |
Returns a QList<QGeoCoordinate> which represents the hole at index. | |
Q_INVOKABLE void | removeHole (qsizetype index) |
Removes element at position index from the list of holes. | |
Q_INVOKABLE qsizetype | holesCount () const |
Returns the number of holes. | |
Q_INVOKABLE void | translate (double degreesLatitude, double degreesLongitude) |
Translates this geo polygon by degreesLatitude northwards and degreesLongitude eastwards. | |
Q_INVOKABLE QGeoPolygon | translated (double degreesLatitude, double degreesLongitude) const |
Returns a copy of this geo polygon translated by degreesLatitude northwards and degreesLongitude eastwards. | |
Q_INVOKABLE double | length (qsizetype indexFrom=0, qsizetype indexTo=-1) const |
Returns the length of the polygon's perimeter, in meters, from the element indexFrom to the element indexTo. | |
Q_INVOKABLE qsizetype | size () const |
Returns the number of elements in the polygon. | |
Q_INVOKABLE void | addCoordinate (const QGeoCoordinate &coordinate) |
Appends coordinate to the polygon. | |
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 polygon's perimeter contains coordinate as one of the elements. | |
Q_INVOKABLE void | removeCoordinate (const QGeoCoordinate &coordinate) |
Removes the last occurrence of coordinate from the polygon. | |
Q_INVOKABLE void | removeCoordinate (qsizetype index) |
Removes element at position index from the polygon. | |
Q_INVOKABLE QString | toString () const |
Returns the geo polygon 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 | |
QList< QGeoCoordinate > | perimeter |
![]() | |
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 QGeoPolygon &polygon) |
QDataStream & | operator>> (QDataStream &stream, QGeoPolygon &polygon) |
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 QGeoPolygon class defines a geographic polygon.
The polygon is defined by an ordered list of \l QGeoCoordinate objects representing its perimeter.
Each two adjacent elements in this list 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 date line 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}.
Definition at line 15 of file qgeopolygon.h.
QGeoPolygon::QGeoPolygon | ( | ) |
Constructs a new, empty geo polygon.
Definition at line 77 of file qgeopolygon.cpp.
QGeoPolygon::QGeoPolygon | ( | const QList< QGeoCoordinate > & | path | ) |
Constructs a new geo polygon from the coordinates specified in path.
Definition at line 86 of file qgeopolygon.cpp.
QGeoPolygon::QGeoPolygon | ( | const QGeoPolygon & | other | ) |
Constructs a new geo polygon from the contents of other.
Definition at line 94 of file qgeopolygon.cpp.
QGeoPolygon::QGeoPolygon | ( | const QGeoShape & | other | ) |
Constructs a new geo polygon from the contents of other.
Definition at line 137 of file qgeopolygon.cpp.
QGeoPolygon::~QGeoPolygon | ( | ) |
Destroys this polygon.
Definition at line 161 of file qgeopolygon.cpp.
void QGeoPolygon::addCoordinate | ( | const QGeoCoordinate & | coordinate | ) |
Appends coordinate to the polygon.
Definition at line 249 of file qgeopolygon.cpp.
void QGeoPolygon::addHole | ( | const QList< QGeoCoordinate > & | holePath | ) |
Overloaded method.
Sets the holePath for a hole inside the polygon. The hole is a QList<QGeoCoordinate>.
Definition at line 353 of file qgeopolygon.cpp.
Sets the holePath for a hole inside the polygon.
The hole is a QVariant containing a QList<QGeoCoordinate>.
Definition at line 334 of file qgeopolygon.cpp.
bool QGeoPolygon::containsCoordinate | ( | const QGeoCoordinate & | coordinate | ) | const |
Returns true if the polygon's perimeter contains coordinate as one of the elements.
Definition at line 287 of file qgeopolygon.cpp.
QGeoCoordinate QGeoPolygon::coordinateAt | ( | qsizetype | index | ) | const |
Returns the coordinate at index .
Definition at line 278 of file qgeopolygon.cpp.
const QVariantList QGeoPolygon::hole | ( | qsizetype | index | ) | const |
Returns a QVariant containing a QList<QGeoCoordinate> which represents the hole at index.
Definition at line 367 of file qgeopolygon.cpp.
const QList< QGeoCoordinate > QGeoPolygon::holePath | ( | qsizetype | index | ) | const |
Returns a QList<QGeoCoordinate> which represents the hole at index.
Definition at line 381 of file qgeopolygon.cpp.
qsizetype QGeoPolygon::holesCount | ( | ) | const |
void QGeoPolygon::insertCoordinate | ( | qsizetype | index, |
const QGeoCoordinate & | coordinate ) |
Inserts coordinate at the specified index.
Definition at line 260 of file qgeopolygon.cpp.
Returns the length of the polygon's perimeter, 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.
Definition at line 226 of file qgeopolygon.cpp.
QGeoPolygon & QGeoPolygon::operator= | ( | const QGeoPolygon & | other | ) |
Assigns other to this geo polygon and returns a reference to this geo polygon.
Definition at line 166 of file qgeopolygon.cpp.
const QList< QGeoCoordinate > & QGeoPolygon::perimeter | ( | ) | const |
Returns all the elements of the polygon's perimeter.
Definition at line 188 of file qgeopolygon.cpp.
void QGeoPolygon::removeCoordinate | ( | const QGeoCoordinate & | coordinate | ) |
Removes the last occurrence of coordinate from the polygon.
Definition at line 296 of file qgeopolygon.cpp.
Removes element at position index from the polygon.
Definition at line 305 of file qgeopolygon.cpp.
Removes element at position index from the list of holes.
Definition at line 392 of file qgeopolygon.cpp.
void QGeoPolygon::replaceCoordinate | ( | qsizetype | index, |
const QGeoCoordinate & | coordinate ) |
Replaces the path element at the specified index with coordinate.
Definition at line 269 of file qgeopolygon.cpp.
void QGeoPolygon::setPerimeter | ( | const QList< QGeoCoordinate > & | path | ) |
Sets the perimeter of the polygon based on a list of coordinates path.
Definition at line 177 of file qgeopolygon.cpp.
qsizetype QGeoPolygon::size | ( | ) | const |
Returns the number of elements in the polygon.
Definition at line 237 of file qgeopolygon.cpp.
QString QGeoPolygon::toString | ( | ) | const |
Returns the geo polygon properties as a string.
Definition at line 314 of file qgeopolygon.cpp.
void QGeoPolygon::translate | ( | double | degreesLatitude, |
double | degreesLongitude ) |
Translates this geo polygon by degreesLatitude northwards and degreesLongitude eastwards.
Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.
Definition at line 200 of file qgeopolygon.cpp.
QGeoPolygon QGeoPolygon::translated | ( | double | degreesLatitude, |
double | degreesLongitude ) const |
Returns a copy of this geo polygon translated by degreesLatitude northwards and degreesLongitude eastwards.
Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.
Definition at line 215 of file qgeopolygon.cpp.
|
friend |
Definition at line 58 of file qgeopolygon.h.
|
friend |
Definition at line 62 of file qgeopolygon.h.
|
readwrite |
Definition at line 18 of file qgeopolygon.h.