Skip to content

GeoPath

Base classes

Name Children Inherits
GeoShapeMixin
prettyqt.positioning.geoshape
QGeoPath
PySide6.QtPositioning
QGeoPath(self, other: PySide6.QtPositioning.QGeoPath, /, *, path: collections.abc.Sequence[Any] | None \= None, width: float | None \= None) -> None

⋔ Inheritance diagram

graph TD
  28136966["positioning.GeoPath"]
  2727036102["positioning.GeoShapeMixin"]
  2751680898["builtins.object"]
  588478502["QtPositioning.QGeoPath"]
  2678726727["QtPositioning.QGeoShape"]
  37984305["Shiboken.Object"]
  2727036102 --> 28136966
  2751680898 --> 2727036102
  588478502 --> 28136966
  2678726727 --> 588478502
  37984305 --> 2678726727
  2751680898 --> 37984305

🛈 DocStrings

Bases: GeoShapeMixin, QGeoPath

Source code in prettyqt/positioning/geopath.py
class GeoPath(positioning.GeoShapeMixin, QtPositioning.QGeoPath):
    def __len__(self):
        return self.size()

    def __getitem__(self, index: int) -> positioning.GeoCoordinate:
        return positioning.GeoCoordinate(self.coordinateAt(index))

    def __setitem__(self, index: int, value: QtPositioning.QGeoCoordinate):
        self.replaceCoordinate(index, value)

    def __delitem__(self, index: int):
        self.removeCoordinate(index)

    def __add__(self, other: QtPositioning.QGeoCoordinate):
        self.addCoordinate(other)
        return self

    def __repr__(self):
        # p = ", ".join([f"{p!r}" for p in self.get_path()])
        return f"{type(self).__name__}(<{len(self)} points>)"

    def get_path(self) -> list[positioning.GeoCoordinate]:
        return [positioning.GeoCoordinate(p) for p in self.path()]

:fa-brands-github: Show source on GitHub