QGeoPolygonclass defines a geographic polygon. 更多 …
New in version 5.10.
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)
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 .
QGeoPolygon
¶
QGeoPolygon(other)
QGeoPolygon(other)
QGeoPolygon(path)
- param path
- param other
Constructs a new, empty geo polygon.
PySide2.QtPositioning.QGeoPolygon.
addCoordinate
(
coordinate
)
¶
coordinate
–
QGeoCoordinate
追加
coordinate
to the polygon.
PySide2.QtPositioning.QGeoPolygon.
addHole
(
holePath
)
¶
holePath –
PySide2.QtPositioning.QGeoPolygon.
addHole
(
holePath
)
¶
holePath – object
PySide2.QtPositioning.QGeoPolygon.
containsCoordinate
(
coordinate
)
¶
coordinate
–
QGeoCoordinate
bool
Returns true if the polygon’s perimeter contains
coordinate
as one of the elements.
PySide2.QtPositioning.QGeoPolygon.
coordinateAt
(
index
)
¶
index
–
int
Returns the coordinate at
index
.
PySide2.QtPositioning.QGeoPolygon.
hole
(
index
)
¶
index
–
int
返回
QVariant
包含
QVariant
包含
QList
<
QGeoCoordinate
> which represents the hole at
index
.
PySide2.QtPositioning.QGeoPolygon.
holePath
(
index
)
¶
index
–
int
返回
QList
<
QGeoCoordinate
> which represents the hole at
index
.
PySide2.QtPositioning.QGeoPolygon.
holesCount
(
)
¶
int
Returns the number of holes.
PySide2.QtPositioning.QGeoPolygon.
insertCoordinate
(
index
,
coordinate
)
¶
index
–
int
coordinate
–
QGeoCoordinate
插入
coordinate
at the specified
index
.
PySide2.QtPositioning.QGeoPolygon.
length
(
[
indexFrom=0
[
,
indexTo=-1
]
]
)
¶
indexFrom
–
int
indexTo
–
int
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.
PySide2.QtPositioning.QGeoPolygon.
__ne__
(
other
)
¶
other
–
QGeoPolygon
bool
Returns whether this geo polygon is not equal to
other
.
PySide2.QtPositioning.QGeoPolygon.
__eq__
(
other
)
¶
other
–
QGeoPolygon
bool
Returns whether this geo polygon is equal to
other
.
PySide2.QtPositioning.QGeoPolygon.
path
(
)
¶
Returns all the elements of the polygon’s boundary.
另请参阅
PySide2.QtPositioning.QGeoPolygon.
perimeter
(
)
¶
Returns all the elements of the polygon’s perimeter.
另请参阅
PySide2.QtPositioning.QGeoPolygon.
removeCoordinate
(
coordinate
)
¶
coordinate
–
QGeoCoordinate
PySide2.QtPositioning.QGeoPolygon.
removeCoordinate
(
index
)
¶
index
–
int
Removes element at position
index
from the polygon.
PySide2.QtPositioning.QGeoPolygon.
removeHole
(
index
)
¶
index
–
int
Removes element at position
index
from the holes
QList
.
PySide2.QtPositioning.QGeoPolygon.
replaceCoordinate
(
index
,
coordinate
)
¶
index
–
int
coordinate
–
QGeoCoordinate
Replaces the path element at the specified
index
with
coordinate
.
PySide2.QtPositioning.QGeoPolygon.
setPath
(
path
)
¶
path –
设置
path
for the polygon.
另请参阅
PySide2.QtPositioning.QGeoPolygon.
setPerimeter
(
path
)
¶
path –
Sets all the elements of the polygon’s perimeter based on a list of coordinates (
path
). .
另请参阅
PySide2.QtPositioning.QGeoPolygon.
size
(
)
¶
int
Returns the number of elements in the polygon.
PySide2.QtPositioning.QGeoPolygon.
translate
(
degreesLatitude
,
degreesLongitude
)
¶
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.
PySide2.QtPositioning.QGeoPolygon.
translated
(
degreesLatitude
,
degreesLongitude
)
¶
degreesLatitude
–
double
degreesLongitude
–
double
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.
另请参阅