QGeoPolygon

The QGeoPolygon class defines a geographic polygon. More

Inheritance diagram of PySide2.QtPositioning.QGeoPolygon

New in version 5.10.

Synopsis

Functions

Detailed Description

The polygon is defined by an ordered list of QGeoCoordinates representing its perimeter.

Each two adjacent elements in this list 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 date line 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 .

class PySide2.QtPositioning.QGeoPolygon

PySide2.QtPositioning.QGeoPolygon(other)

PySide2.QtPositioning.QGeoPolygon(other)

PySide2.QtPositioning.QGeoPolygon(path)

param path:

param other:

PySide2.QtPositioning.QGeoPolygon

Constructs a new, empty geo polygon.

PySide2.QtPositioning.QGeoPolygon.addCoordinate(coordinate)
Parameters:

coordinatePySide2.QtPositioning.QGeoCoordinate

Appends coordinate to the polygon.

PySide2.QtPositioning.QGeoPolygon.addHole(holePath)
Parameters:

holePath

PySide2.QtPositioning.QGeoPolygon.addHole(holePath)
Parameters:

holePath – object

PySide2.QtPositioning.QGeoPolygon.containsCoordinate(coordinate)
Parameters:

coordinatePySide2.QtPositioning.QGeoCoordinate

Return type:

bool

Returns true if the polygon’s perimeter contains coordinate as one of the elements.

PySide2.QtPositioning.QGeoPolygon.coordinateAt(index)
Parameters:

index – int

Return type:

PySide2.QtPositioning.QGeoCoordinate

Returns the coordinate at index .

PySide2.QtPositioning.QGeoPolygon.hole(index)
Parameters:

index – int

Return type:

Returns a QVariant containing a QVariant containing a QList < QGeoCoordinate > which represents the hole at index .

PySide2.QtPositioning.QGeoPolygon.holePath(index)
Parameters:

index – int

Return type:

Returns a QList < QGeoCoordinate > which represents the hole at index .

PySide2.QtPositioning.QGeoPolygon.holesCount()
Return type:

int

Returns the number of holes.

PySide2.QtPositioning.QGeoPolygon.insertCoordinate(index, coordinate)
Parameters:

Inserts coordinate at the specified index .

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

  • indexTo – int

Return type:

double

Returns the length of the polygon’s perimeter, in meters, from the element indexFrom to the element indexTo . The length is intended to be the sum of the shortest distances for each pair of adjacent points.

PySide2.QtPositioning.QGeoPolygon.__ne__(other)
Parameters:

otherPySide2.QtPositioning.QGeoPolygon

Return type:

bool

Returns whether this geo polygon is not equal to other .

PySide2.QtPositioning.QGeoPolygon.__eq__(other)
Parameters:

otherPySide2.QtPositioning.QGeoPolygon

Return type:

bool

Returns whether this geo polygon is equal to other .

PySide2.QtPositioning.QGeoPolygon.path()
Return type:

Returns all the elements of the polygon’s boundary.

See also

setPath()

PySide2.QtPositioning.QGeoPolygon.perimeter()
Return type:

PySide2.QtPositioning.QGeoPolygon.removeCoordinate(coordinate)
Parameters:

coordinatePySide2.QtPositioning.QGeoCoordinate

PySide2.QtPositioning.QGeoPolygon.removeCoordinate(index)
Parameters:

index – int

Removes element at position index from the polygon.

PySide2.QtPositioning.QGeoPolygon.removeHole(index)
Parameters:

index – int

Removes element at position index from the holes QList .

PySide2.QtPositioning.QGeoPolygon.replaceCoordinate(index, coordinate)
Parameters:

Replaces the path element at the specified index with coordinate .

PySide2.QtPositioning.QGeoPolygon.setPath(path)
Parameters:

path

Sets the path for the polygon.

See also

path()

PySide2.QtPositioning.QGeoPolygon.setPerimeter(path)
Parameters:

path

PySide2.QtPositioning.QGeoPolygon.size()
Return type:

int

Returns the number of elements in the polygon.

PySide2.QtPositioning.QGeoPolygon.translate(degreesLatitude, degreesLongitude)
Parameters:
  • degreesLatitudedouble

  • degreesLongitudedouble

Translates this geo polygon by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

PySide2.QtPositioning.QGeoPolygon.translated(degreesLatitude, degreesLongitude)
Parameters:
  • degreesLatitudedouble

  • degreesLongitudedouble

Return type:

PySide2.QtPositioning.QGeoPolygon

Returns a copy of this geo polygon translated by degreesLatitude northwards and degreesLongitude eastwards.

Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.

See also

translate()