QGeoPolygon¶
The
QGeoPolygon
class defines a geographic polygon. More…

New in version 5.10.
Synopsis¶
Functions¶
def
__eq__
(other)def
__ne__
(other)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
path
()def
perimeter
()def
removeCoordinate
(coordinate)def
removeCoordinate
(index)def
removeHole
(index)def
replaceCoordinate
(index, coordinate)def
setPath
(path)def
setPerimeter
(path)def
size
()def
translate
(degreesLatitude, degreesLongitude)def
translated
(degreesLatitude, degreesLongitude)
Detailed Description¶
The polygon is defined by an ordered list of QGeoCoordinates 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
QGeoPolygon
¶ QGeoPolygon(other)
QGeoPolygon(other)
QGeoPolygon(path)
- param path
- param other
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
.Constructs a new geo
polygon
from a list of coordinates.
-
PySide2.QtPositioning.QGeoPolygon.
addCoordinate
(coordinate)¶ - Parameters
coordinate –
QGeoCoordinate
Appends
coordinate
to the polygon.
-
PySide2.QtPositioning.QGeoPolygon.
addHole
(holePath)¶ - Parameters
holePath –
Overloaded method. Sets the
path
for a hole inside the polygon. The hole is aQList
<QGeoCoordinate
>.
-
PySide2.QtPositioning.QGeoPolygon.
addHole
(holePath) - Parameters
holePath – object
Sets the
path
for a hole inside the polygon. The hole is aQVariant
containing aQList
<QGeoCoordinate
>.
-
PySide2.QtPositioning.QGeoPolygon.
containsCoordinate
(coordinate)¶ - Parameters
coordinate –
QGeoCoordinate
- Return type
bool
Returns true if the polygon’s perimeter contains
coordinate
as one of the elements.
-
PySide2.QtPositioning.QGeoPolygon.
coordinateAt
(index)¶ - Parameters
index –
int
- Return type
Returns the coordinate at
index
.
-
PySide2.QtPositioning.QGeoPolygon.
hole
(index)¶ - Parameters
index –
int
- Return type
Returns a
QVariant
containing aQVariant
containing aQList
<QGeoCoordinate
> which represents the hole at index.
-
PySide2.QtPositioning.QGeoPolygon.
holePath
(index)¶ - Parameters
index –
int
- Return type
Returns a
QList
<QGeoCoordinate
> which represents the hole atindex
.
-
PySide2.QtPositioning.QGeoPolygon.
holesCount
()¶ - Return type
int
Returns the number of holes.
-
PySide2.QtPositioning.QGeoPolygon.
insertCoordinate
(index, coordinate)¶ - Parameters
index –
int
coordinate –
QGeoCoordinate
Inserts
coordinate
at the specifiedindex
.
-
PySide2.QtPositioning.QGeoPolygon.
length
([indexFrom=0[, indexTo=-1]])¶ - Parameters
indexFrom –
int
indexTo –
int
- Return type
double
Returns the length of the polygon’s perimeter, in meters, from the element
indexFrom
to the elementindexTo
. The length is intended to be the sum of the shortest distances for each pair of adjacent points.
-
PySide2.QtPositioning.QGeoPolygon.
__ne__
(other)¶ - Parameters
other –
QGeoPolygon
- Return type
bool
Returns whether this geo polygon is not equal to
other
.
-
PySide2.QtPositioning.QGeoPolygon.
__eq__
(other)¶ - Parameters
other –
QGeoPolygon
- Return type
bool
Returns whether this geo polygon is equal to
other
.
-
PySide2.QtPositioning.QGeoPolygon.
path
()¶ - Return type
Returns all the elements of the polygon’s boundary.
See also
-
PySide2.QtPositioning.QGeoPolygon.
perimeter
()¶ - Return type
Returns all the elements of the polygon’s perimeter.
See also
-
PySide2.QtPositioning.QGeoPolygon.
removeCoordinate
(coordinate)¶ - Parameters
coordinate –
QGeoCoordinate
Removes the last occurrence of
coordinate
from the polygon.
-
PySide2.QtPositioning.QGeoPolygon.
removeCoordinate
(index) - Parameters
index –
int
Removes element at position
index
from the polygon.
-
PySide2.QtPositioning.QGeoPolygon.
removeHole
(index)¶ - Parameters
index –
int
Removes element at position
index
from the holesQList
.
-
PySide2.QtPositioning.QGeoPolygon.
replaceCoordinate
(index, coordinate)¶ - Parameters
index –
int
coordinate –
QGeoCoordinate
Replaces the path element at the specified
index
withcoordinate
.
-
PySide2.QtPositioning.QGeoPolygon.
setPath
(path)¶ - Parameters
path –
Sets the
polygon
‘s boundary from a list of coordinates.See also
-
PySide2.QtPositioning.QGeoPolygon.
setPerimeter
(path)¶ - Parameters
path –
Sets all the elements of the polygon’s perimeter.
See also
-
PySide2.QtPositioning.QGeoPolygon.
size
()¶ - Return type
int
Returns the number of elements in the polygon.
-
PySide2.QtPositioning.QGeoPolygon.
translate
(degreesLatitude, degreesLongitude)¶ - Parameters
degreesLatitude –
double
degreesLongitude –
double
Translates this geo polygon by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.
-
PySide2.QtPositioning.QGeoPolygon.
translated
(degreesLatitude, degreesLongitude)¶ - Parameters
degreesLatitude –
double
degreesLongitude –
double
- Return type
Returns a copy of this geo polygon translated by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.See also