PySide6.QtPositioning.QGeoPath

class QGeoPath

QGeoPath 类定义了一个地理路径。更多

PySide6.QtPositioning.QGeoPath 的继承图

概要

属性

  • pathᅟ - 此属性保存地理路径的坐标列表

  • widthᅟ - 路径的宽度,单位为米

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

路径由一系列有序的QGeoCoordinate对象定义。

路径中每两个相邻的元素旨在通过通过这两个元素的最短恒定方位线段连接在一起。这种类型的连接可以在经度方向上跨越日期变更线,但永远不会跨越极点。

这与由boundingGeoRectangle()返回的边界框的计算相关,该边界框的左上角纬度将设置为路径点集中的最大纬度。同样,右下角的纬度将是路径点集中的最小纬度。

这个类是一个Q_GADGET。它可以直接从C++和QML中使用。

如果QGeoPath不包含任何坐标,则它既无效又为空。

注意

默认构造的QGeoPath既无效又为空,因为它不包含任何坐标。

注意

当使用from __feature__ import true_property时,属性可以直接使用,否则通过访问器函数使用。

property pathᅟ: list of QVariant

此属性保存地理路径的坐标列表。

注意

坐标不能就地处理。要更改此属性的值,请检索完整的坐标列表,处理它们,并将新值分配给该属性。

Access functions:
property widthᅟ: float

此属性表示路径的宽度,单位为米。

Access functions:
__init__()

构造一个新的、空的geo路径。

__init__(other)
Parameters:

其他QGeoPath

other的内容构造一个新的地理路径。

__init__(other)
Parameters:

其他QGeoShape

other的内容构造一个新的地理路径。

__init__(path[, width=0.0])
Parameters:
  • path – QGeoCoordinate 的列表

  • width – 浮点数

从坐标列表(pathwidth)构造一个新的地理路径。

addCoordinate(coordinate)
Parameters:

坐标QGeoCoordinate

coordinate附加到路径中。

clearPath()

清除路径。

containsCoordinate(coordinate)
Parameters:

坐标QGeoCoordinate

Return type:

布尔

如果路径包含coordinate作为其中一个元素,则返回true。

coordinateAt(index)
Parameters:

索引 – int

Return type:

QGeoCoordinate

返回位于index的坐标。

insertCoordinate(index, coordinate)
Parameters:

在指定的index处插入coordinate

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

  • indexTo – 整数

Return type:

浮点数

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

如果 indexTo 是 -1(默认值),长度将包括最后一个坐标和第一个坐标之间的距离(闭合环)。要获取路径的长度,请使用 0 作为 indexFromsize() - 1 作为 indexTo

path()
Return type:

QGeoCoordinate的列表

返回路径的所有元素。

另请参阅

setPath()

removeCoordinate(coordinate)
Parameters:

坐标QGeoCoordinate

从路径中移除最后一次出现的coordinate

removeCoordinate(index)
Parameters:

索引 – int

从路径中移除位置 index 处的元素。

replaceCoordinate(index, coordinate)
Parameters:

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

setPath(path)
Parameters:

path – QGeoCoordinate 的列表

设置path的所有元素。

另请参阅

path()

setVariantPath(path)
Parameters:

path – QVariant 的列表

属性 pathᅟ 的设置器。

setWidth(width)
Parameters:

width – 浮点数

另请参阅

width()

属性 widthᅟ 的设置器。

size()
Return type:

整数

返回路径中的元素数量。

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

  • degreesLongitude – 浮点数

将此地理路径向北移动 degreesLatitude 度,向东移动 degreesLongitude 度。

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

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

  • degreesLongitude – 浮点数

Return type:

QGeoPath

返回此地理路径的副本,该副本已向北移动 degreesLatitude 度,向东移动 degreesLongitude 度。

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

另请参阅

translate()

variantPath()
Return type:

.QVariant 列表

属性 pathᅟ 的获取器。

width()
Return type:

浮点数

返回路径的宽度,单位为米。此信息用于contains方法。默认值为0。

另请参阅

setWidth()

属性 widthᅟ 的获取器。