- class QGeoPolygon#
QGeoPolygon类定义了一个地理多边形。更多...概览#
属性#
方法#
def
__init__()def
addCoordinate()def
addHole()def
coordinateAt()定义
hole()定义
holePath()定义
holesCount()定义
length()定义
perimeter()定义
removeHole()定义
size()定义
translate()定义
translated()
注意
本文档可能包含来自 C++ 自动翻译到 Python 的代码片段。我们总是欢迎对代码片段翻译的贡献。如果您发现翻译存在问题,也可以通过在 https:/bugreports.qt.io/projects/PYSIDE 上创建工单来通知我们。
详细描述#
多边形由表示其周长的
QGeoCoordinate对象的有序列表定义。列表中相邻的两个元素应通过通过这两个元素的最短定常方位线段连接在一起。这种类型的连接可以在经度上穿过日界线,但永远不会穿过极点。
这适用于计算由
boundingGeoRectangle()返回的边界框,该边界框的右上角的纬度设置为路径点集中的最大纬度。类似地,底部右角的纬度将设置为路径点集中的最小纬度。此类是一个 Q_GADGET。它可以被 直接从 C++ 和 QML 使用。
注意
当使用
from __feature__ import true_property时,可以直接使用属性,否则通过访问函数进行使用。- 属性perimeter: QGeoCoordinate 列表#
- __init__(other)#
- 参数:
other –
QGeoPolygon
从
other的内容中构建一个新的地理多边形。- __init__(other)
- 参数:
other –
QGeoShape
从
other的内容中构建一个新的地理多边形。- __init__(path)
- 参数:
path – .QGeoCoordinate 列表
从在
path中指定的坐标构建一个新的地理多边形。- __init__()
构建一个新的、空的地理多边形。
- addCoordinate(coordinate)#
- 参数:
coordinate –
QGeoCoordinate
将
coordinate添加到多边形中。- addHole(holePath)#
- 参数:
holePath – .QGeoCoordinate 列表
重载方法。设置多边形内部的孔的
holePath。孔是一个 QList<QGeoCoordinate>- addHole(holePath)
- 参数:
holePath – 对象
设置多边形内部的孔的
holePath。孔是一个包含 QList<QGeoCoordinate> 的 QVariant。- containsCoordinate(coordinate)#
- 参数:
coordinate –
QGeoCoordinate- 返回类型:
bool
如果多边形的周长包含
coordinate作为其中一个元素,则返回 true。- coordinateAt(index)#
- 参数:
索引 – int
- 返回类型:
返回
index位置的坐标。- hole(index)#
- 参数:
索引 – int
- 返回类型:
. QVariant 列表
返回一个包含代表
index位置的洞的QGeoCoordinate> QList 的 QVariant。- holePath(index)#
- 参数:
索引 – int
- 返回类型:
. QGeoCoordinate 列表
返回一个包含代表
index位置的洞的QGeoCoordinate> QList。- holesCount()#
- 返回类型:
int
返回洞的数量。
- insertCoordinate(index, coordinate)#
- 参数:
索引 – int
coordinate –
QGeoCoordinate
在指定的
index位置插入coordinate。- length([indexFrom=0[, indexTo=-1]])#
- 参数:
indexFrom – int
indexTo – int
- 返回类型:
float
返回从元素
indexFrom到元素indexTo的多边形周长,单位为米。长度是每个相邻点之间最短距离的总和。- perimeter()#
- 返回类型:
. QGeoCoordinate 列表
返回多边形周长的所有元素。
另请参阅
属性
perimeter的获取器。- removeCoordinate(coordinate)#
- 参数:
coordinate –
QGeoCoordinate
从多边形中删除
coordinate的最后一次出现。- removeCoordinate(index)
- 参数:
索引 – int
从多边形中删除位置
index的元素。- removeHole(index)#
- 参数:
索引 – int
从洞的列表中删除位置
index的元素。- replaceCoordinate(index, coordinate)#
- 参数:
索引 – int
coordinate –
QGeoCoordinate
使用坐标替换指定
index处的路径元素。- setPerimeter(path)#
- 参数:
path – .QGeoCoordinate 列表
基于坐标列表
path设置多边形的周长。另请参阅
属性
perimeter的设置器。- size()#
- 返回类型:
int
返回多边形中的元素数量。
- translate(degreesLatitude, degreesLongitude)#
- 参数:
degreesLatitude – float
degreesLongitude – float
通过向北
degreesLatitude和向东degreesLongitude翻译此地理多边形。degreesLatitude和degreesLongitude的负值对应于向南和向西的平移。- translated(degreesLatitude, degreesLongitude)#
- 参数:
degreesLatitude – float
degreesLongitude – float
- 返回类型:
返回一个地理多边形的副本,通过
degreesLatitude向北和degreesLongitude向东平移。degreesLatitude和degreesLongitude的负值对应于向南和向西的平移。另请参阅