Skip to content

GeoPolygon

Base classes

Name Children Inherits
GeoShapeMixin
prettyqt.positioning.geoshape
QGeoPolygon
PySide6.QtPositioning
QGeoPolygon(self, other: PySide6.QtPositioning.QGeoPolygon, /, *, perimeter: collections.abc.Sequence[PySide6.QtPositioning.QGeoCoordinate] | None \= None) -> None

⋔ Inheritance diagram

graph TD
  3005685568["positioning.GeoPolygon"]
  2727036102["positioning.GeoShapeMixin"]
  2751680898["builtins.object"]
  655440408["QtPositioning.QGeoPolygon"]
  2678726727["QtPositioning.QGeoShape"]
  37984305["Shiboken.Object"]
  2727036102 --> 3005685568
  2751680898 --> 2727036102
  655440408 --> 3005685568
  2678726727 --> 655440408
  37984305 --> 2678726727
  2751680898 --> 37984305

🛈 DocStrings

Bases: GeoShapeMixin, QGeoPolygon

Source code in prettyqt/positioning/geopolygon.py
class GeoPolygon(positioning.GeoShapeMixin, QtPositioning.QGeoPolygon):
    def __len__(self):
        return self.size()

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

    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 get_hole_path(self, index: int) -> list[positioning.GeoCoordinate]:
        return [positioning.GeoCoordinate(p) for p in self.holePath(index)]

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

:fa-brands-github: Show source on GitHub