PySide6.QtPositioning.QGeoPolygon

class QGeoPolygon

QGeoPolygon 类定义了一个地理多边形。更多

PySide6.QtPositioning.QGeoPolygon 的继承图

概要

属性

方法

注意

本文档可能包含从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:

QGeoCoordinate

返回位于index的坐标。

hole(index)
Parameters:

索引 – int

Return type:

.QVariant 列表

返回一个包含QList< QGeoCoordinate >的QVariant,它表示在index处的孔。

holePath(index)
Parameters:

索引 – int

Return type:

QGeoCoordinate的列表

返回一个QList< QGeoCoordinate >,它表示在index处的孔。

holesCount()
Return type:

整数

返回孔的数量。

insertCoordinate(index, coordinate)
Parameters:

在指定的index处插入coordinate

length([indexFrom=0[, indexTo=-1]])
Parameters:
  • indexFrom – int

  • indexTo – 整数

Return type:

浮点数

返回多边形从元素indexFrom到元素indexTo的周长长度,单位为米。该长度应为每对相邻点之间最短距离的总和。

perimeter()
Return type:

QGeoCoordinate的列表

返回多边形周长的所有元素。

另请参阅

setPerimeter()

属性 perimeterᅟ 的获取器。

removeCoordinate(coordinate)
Parameters:

坐标QGeoCoordinate

从多边形中移除最后一次出现的coordinate

removeCoordinate(index)
Parameters:

索引 – int

从多边形中移除位置 index 处的元素。

removeHole(index)
Parameters:

索引 – int

从孔列表中移除位置 index 处的元素。

replaceCoordinate(index, coordinate)
Parameters:

coordinate替换指定index处的路径元素。

setPerimeter(path)
Parameters:

path – QGeoCoordinate 的列表

根据坐标列表 path 设置多边形的周长。

另请参阅

perimeter()

属性 perimeterᅟ 的设置器。

size()
Return type:

整数

返回多边形中的元素数量。

translate(degreesLatitude, degreesLongitude)
Parameters:
  • degreesLatitude – 浮点数

  • degreesLongitude – 浮点数

将这个地理多边形向北移动 degreesLatitude 度,向东移动 degreesLongitude 度。

degreesLatitudedegreesLongitude 的负值分别对应于向南和向西的平移。

translated(degreesLatitude, degreesLongitude)
Parameters:
  • degreesLatitude – 浮点数

  • degreesLongitude – 浮点数

Return type:

QGeoPolygon

返回此地理多边形的一个副本,该副本向北移动了degreesLatitude度,向东移动了degreesLongitude度。

degreesLatitudedegreesLongitude 的负值分别对应于向南和向西的平移。

另请参阅

translate()