PySide6.QtPositioning.QGeoPath¶
- class QGeoPath¶
-
概要¶
属性¶
方法¶
def
__init__()def
addCoordinate()def
clearPath()def
coordinateAt()def
length()def
path()def
setPath()def
setVariantPath()def
setWidth()def
size()def
translate()def
translated()def
variantPath()def
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 – 浮点数
从坐标列表(
path和width)构造一个新的地理路径。- addCoordinate(coordinate)¶
- Parameters:
坐标 –
QGeoCoordinate
将
coordinate附加到路径中。- clearPath()¶
清除路径。
- containsCoordinate(coordinate)¶
- Parameters:
坐标 –
QGeoCoordinate- Return type:
布尔
如果路径包含
coordinate作为其中一个元素,则返回true。- coordinateAt(index)¶
- Parameters:
索引 – int
- Return type:
返回位于
index的坐标。- insertCoordinate(index, coordinate)¶
- Parameters:
index – 整数
coordinate –
QGeoCoordinate
在指定的
index处插入coordinate。- length([indexFrom=0[, indexTo=-1]])¶
- Parameters:
indexFrom – int
indexTo – 整数
- Return type:
浮点数
返回从元素
indexFrom到元素indexTo的路径长度,单位为米。该长度应为每对相邻点之间最短距离的总和。如果
indexTo是 -1(默认值),长度将包括最后一个坐标和第一个坐标之间的距离(闭合环)。要获取路径的长度,请使用 0 作为indexFrom和size()- 1 作为indexTo。- path()¶
- Return type:
返回路径的所有元素。
另请参阅
- removeCoordinate(coordinate)¶
- Parameters:
坐标 –
QGeoCoordinate
从路径中移除最后一次出现的
coordinate。- removeCoordinate(index)
- Parameters:
索引 – int
从路径中移除位置
index处的元素。- replaceCoordinate(index, coordinate)¶
- Parameters:
index – 整数
coordinate –
QGeoCoordinate
用
coordinate替换指定index处的路径元素。- setPath(path)¶
- Parameters:
path – QGeoCoordinate 的列表
设置
path的所有元素。另请参阅
- setVariantPath(path)¶
- Parameters:
path – QVariant 的列表
属性
pathᅟ的设置器。属性
widthᅟ的设置器。- 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的负值分别对应于向南和向西的平移。另请参阅
- variantPath()¶
- Return type:
.QVariant 列表
属性
pathᅟ的获取器。- width()¶
- Return type:
浮点数
返回路径的宽度,单位为米。此信息用于
contains方法。默认值为0。另请参阅
属性
widthᅟ的获取器。