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