QGeoPolygon¶
The QGeoPolygon
class defines a geographic polygon. More…
New in version 5.10.
Synopsis¶
Functions¶
def
addCoordinate
(coordinate)def
addHole
(holePath)def
addHole
(holePath)def
containsCoordinate
(coordinate)def
coordinateAt
(index)def
hole
(index)def
holePath
(index)def
holesCount
()def
insertCoordinate
(index, coordinate)def
length
([indexFrom=0[, indexTo=-1]])def
perimeter
()def
removeCoordinate
(coordinate)def
removeCoordinate
(index)def
removeHole
(index)def
replaceCoordinate
(index, coordinate)def
setPerimeter
(path)def
size
()def
translate
(degreesLatitude, degreesLongitude)def
translated
(degreesLatitude, degreesLongitude)
Detailed Description¶
The polygon is defined by an ordered list of 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 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 .
- class PySide6.QtPositioning.QGeoPolygon¶
PySide6.QtPositioning.QGeoPolygon(other)
PySide6.QtPositioning.QGeoPolygon(other)
PySide6.QtPositioning.QGeoPolygon(path)
- Parameters
path –
Constructs a new, empty geo polygon.
Constructs a new geo polygon from the contents of other
.
Constructs a new geo polygon from the contents of other
.
- PySide6.QtPositioning.QGeoPolygon.addCoordinate(coordinate)¶
- Parameters
coordinate –
PySide6.QtPositioning.QGeoCoordinate
Appends coordinate
to the polygon.
- PySide6.QtPositioning.QGeoPolygon.addHole(holePath)¶
- Parameters
holePath –
- PySide6.QtPositioning.QGeoPolygon.addHole(holePath)
- Parameters
holePath – object
Sets the holePath
for a hole inside the polygon. The hole is a QVariant
containing a QList
< QGeoCoordinate
>.
- PySide6.QtPositioning.QGeoPolygon.containsCoordinate(coordinate)¶
- Parameters
coordinate –
PySide6.QtPositioning.QGeoCoordinate
- Return type
bool
Returns true if the polygon’s perimeter contains coordinate
as one of the elements.
- PySide6.QtPositioning.QGeoPolygon.coordinateAt(index)¶
- Parameters
index –
qsizetype
- Return type
Returns the coordinate at index
.
- PySide6.QtPositioning.QGeoPolygon.hole(index)¶
- Parameters
index –
qsizetype
- Return type
Returns a QVariant
containing a QList
< QGeoCoordinate
> which represents the hole at index
.
- PySide6.QtPositioning.QGeoPolygon.holePath(index)¶
- Parameters
index –
qsizetype
- Return type
Returns a QList
< QGeoCoordinate
> which represents the hole at index
.
- PySide6.QtPositioning.QGeoPolygon.holesCount()¶
- Return type
qsizetype
Returns the number of holes.
- PySide6.QtPositioning.QGeoPolygon.insertCoordinate(index, coordinate)¶
- Parameters
index –
qsizetype
coordinate –
PySide6.QtPositioning.QGeoCoordinate
Inserts coordinate
at the specified index
.
- PySide6.QtPositioning.QGeoPolygon.length([indexFrom=0[, indexTo=-1]])¶
- Parameters
indexFrom –
qsizetype
indexTo –
qsizetype
- Return type
double
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.
- PySide6.QtPositioning.QGeoPolygon.perimeter()¶
- Return type
- PySide6.QtPositioning.QGeoPolygon.removeCoordinate(index)¶
- Parameters
index –
qsizetype
Removes element at position index
from the polygon.
- PySide6.QtPositioning.QGeoPolygon.removeCoordinate(coordinate)
- Parameters
coordinate –
PySide6.QtPositioning.QGeoCoordinate
Removes the last occurrence of coordinate
from the polygon.
- PySide6.QtPositioning.QGeoPolygon.removeHole(index)¶
- Parameters
index –
qsizetype
Removes element at position index
from the list of holes.
- PySide6.QtPositioning.QGeoPolygon.replaceCoordinate(index, coordinate)¶
- Parameters
index –
qsizetype
coordinate –
PySide6.QtPositioning.QGeoCoordinate
Replaces the path element at the specified index
with coordinate
.
- PySide6.QtPositioning.QGeoPolygon.setPerimeter(path)¶
- Parameters
path –
- PySide6.QtPositioning.QGeoPolygon.size()¶
- Return type
qsizetype
Returns the number of elements in the polygon.
- PySide6.QtPositioning.QGeoPolygon.translate(degreesLatitude, degreesLongitude)¶
- Parameters
degreesLatitude –
double
degreesLongitude –
double
Translates this geo polygon by degreesLatitude
northwards and degreesLongitude
eastwards.
Negative values of degreesLatitude
and degreesLongitude
correspond to southward and westward translation respectively.
- PySide6.QtPositioning.QGeoPolygon.translated(degreesLatitude, degreesLongitude)¶
- Parameters
degreesLatitude –
double
degreesLongitude –
double
- Return type
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.
See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.