PySide6.QtPositioning.QGeoPath¶
- class QGeoPath¶
The
QGeoPath
class defines a geographic path. More…Synopsis¶
Properties¶
Methods¶
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()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
The path is defined by an ordered list of
QGeoCoordinate
objects.Each two adjacent elements in the path are intended to be connected together by the shortest line segment of constant bearing passing through both elements. This type of connection can cross the dateline in the longitudinal direction, but never crosses the poles.
This is relevant for the calculation of the bounding box returned by
boundingGeoRectangle()
for this shape, which will have the latitude of the top left corner set to the maximum latitude in the path point set. Similarly, the latitude of the bottom right corner will be the minimum latitude in the path point set.This class is a Q_GADGET. It can be directly used from C++ and QML .
A
QGeoPath
is both invalid and empty if it contains no coordinate.Note
A default constructed
QGeoPath
is both invalid and empty as it does not contain any coordinates.Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property pathᅟ: list of QVariant¶
This property holds This property holds the list of coordinates for the geo path..
Note
The coordinates cannot be processed in place. To change the value of this property, retrieve the complete list of coordinates, process them, and assign the new value to the property.
- Access functions:
- property widthᅟ: float¶
This property holds the width of the path in meters..
- Access functions:
- __init__()¶
Constructs a new, empty geo path.
- __init__(other)
- Parameters:
other –
QGeoPath
Constructs a new geo path from the contents of
other
.- __init__(other)
- Parameters:
other –
QGeoShape
Constructs a new geo path from the contents of
other
.- __init__(path[, width=0.0])
- Parameters:
path – .list of QGeoCoordinate
width – float
Constructs a new geo path from a list of coordinates (
path
andwidth
).- addCoordinate(coordinate)¶
- Parameters:
coordinate –
QGeoCoordinate
Appends
coordinate
to the path.- clearPath()¶
Clears the path.
- containsCoordinate(coordinate)¶
- Parameters:
coordinate –
QGeoCoordinate
- Return type:
bool
Returns true if the path contains
coordinate
as one of the elements.- coordinateAt(index)¶
- Parameters:
index – int
- Return type:
Returns the coordinate at
index
.- insertCoordinate(index, coordinate)¶
- Parameters:
index – int
coordinate –
QGeoCoordinate
Inserts
coordinate
at the specifiedindex
.- length([indexFrom=0[, indexTo=-1]])¶
- Parameters:
indexFrom – int
indexTo – int
- Return type:
float
Returns the length of the path, in meters, from the element
indexFrom
to the elementindexTo
. The length is intended to be the sum of the shortest distances for each pair of adjacent points.If
indexTo
is -1 (the default value), the length will be including the distance between last coordinate and the first (closed loop). To retrieve the length for the path, use 0 forindexFrom
andsize()
- 1 forindexTo
.- path()¶
- Return type:
.list of QGeoCoordinate
Returns all the elements of the path.
See also
- removeCoordinate(coordinate)¶
- Parameters:
coordinate –
QGeoCoordinate
Removes the last occurrence of
coordinate
from the path.- removeCoordinate(index)
- Parameters:
index – int
Removes element at position
index
from the path.- replaceCoordinate(index, coordinate)¶
- Parameters:
index – int
coordinate –
QGeoCoordinate
Replaces the path element at the specified
index
withcoordinate
.- setPath(path)¶
- Parameters:
path – .list of QGeoCoordinate
Sets all the elements of the
path
.See also
- setVariantPath(path)¶
- Parameters:
path – .list of QVariant
Setter of property
pathᅟ
.Setter of property
widthᅟ
.- size()¶
- Return type:
int
Returns the number of elements in the path.
- translate(degreesLatitude, degreesLongitude)¶
- Parameters:
degreesLatitude – float
degreesLongitude – float
Translates this geo path by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.- translated(degreesLatitude, degreesLongitude)¶
- Parameters:
degreesLatitude – float
degreesLongitude – float
- Return type:
Returns a copy of this geo path translated by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.See also
- variantPath()¶
- Return type:
.list of QVariant
Getter of property
pathᅟ
.- width()¶
- Return type:
float
Returns the width of the path, in meters. This information is used in the
contains
method. The default value is 0.See also
Getter of property
widthᅟ
.