PySide6.QtPositioning.QGeoPolygon¶
- class QGeoPolygon¶
- The - QGeoPolygonclass defines a geographic polygon. More…- Synopsis¶- Properties¶- Methods¶- def - __init__()
- def - addCoordinate()
- def - addHole()
- def - coordinateAt()
- def - hole()
- def - holePath()
- def - holesCount()
- def - length()
- def - perimeter()
- def - removeHole()
- def - setPerimeter()
- def - size()
- def - translate()
- def - translated()
 - 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 polygon is defined by an ordered list of - QGeoCoordinateobjects 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 . - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property perimeterᅟ: list of QGeoCoordinate¶
 - Access functions:
 - __init__()¶
 - Constructs a new, empty geo polygon. - __init__(other)
- Parameters:
- other – - QGeoPolygon
 
 - Constructs a new geo polygon from the contents of - other.- __init__(other)
- Parameters:
- other – - QGeoShape
 
 - Constructs a new geo polygon from the contents of - other.- __init__(path)
- Parameters:
- path – .list of QGeoCoordinate 
 
 - Constructs a new geo polygon from the coordinates specified in - path.- addCoordinate(coordinate)¶
- Parameters:
- coordinate – - QGeoCoordinate
 
 - Appends - coordinateto the polygon.- addHole(holePath)¶
- Parameters:
- holePath – .list of QGeoCoordinate 
 
 - Overloaded method. Sets the - holePathfor a hole inside the polygon. The hole is a QList<- QGeoCoordinate>.- addHole(holePath)
- Parameters:
- holePath – object 
 
 - Sets the - holePathfor a hole inside the polygon. The hole is a QVariant containing a QList<- QGeoCoordinate>.- containsCoordinate(coordinate)¶
- Parameters:
- coordinate – - QGeoCoordinate
- Return type:
- bool 
 
 - Returns true if the polygon’s perimeter contains - coordinateas one of the elements.- coordinateAt(index)¶
- Parameters:
- index – int 
- Return type:
 
 - Returns the coordinate at - index.- hole(index)¶
- Parameters:
- index – int 
- Return type:
- .list of QVariant 
 
 - Returns a QVariant containing a QList< - QGeoCoordinate> which represents the hole at- index.- holePath(index)¶
- Parameters:
- index – int 
- Return type:
- .list of QGeoCoordinate 
 
 - Returns a QList< - QGeoCoordinate> which represents the hole at- index.- holesCount()¶
- Return type:
- int 
 
 - Returns the number of holes. - insertCoordinate(index, coordinate)¶
- Parameters:
- index – int 
- coordinate – - QGeoCoordinate
 
 
 - Inserts - coordinateat the specified- index.- length([indexFrom=0[, indexTo=-1]])¶
- Parameters:
- indexFrom – int 
- indexTo – int 
 
- Return type:
- float 
 
 - Returns the length of the polygon’s perimeter, in meters, from the element - indexFromto the element- indexTo. The length is intended to be the sum of the shortest distances for each pair of adjacent points.- perimeter()¶
- Return type:
- .list of QGeoCoordinate 
 
 - Returns all the elements of the polygon’s perimeter. - See also - Getter of property - perimeterᅟ.- removeCoordinate(coordinate)¶
- Parameters:
- coordinate – - QGeoCoordinate
 
 - Removes the last occurrence of - coordinatefrom the polygon.- removeCoordinate(index)
- Parameters:
- index – int 
 
 - Removes element at position - indexfrom the polygon.- removeHole(index)¶
- Parameters:
- index – int 
 
 - Removes element at position - indexfrom the list of holes.- replaceCoordinate(index, coordinate)¶
- Parameters:
- index – int 
- coordinate – - QGeoCoordinate
 
 
 - Replaces the path element at the specified - indexwith- coordinate.- setPerimeter(path)¶
- Parameters:
- path – .list of QGeoCoordinate 
 
 - Sets the perimeter of the polygon based on a list of coordinates - path.- See also - Setter of property - perimeterᅟ.- size()¶
- Return type:
- int 
 
 - Returns the number of elements in the polygon. - translate(degreesLatitude, degreesLongitude)¶
- Parameters:
- degreesLatitude – float 
- degreesLongitude – float 
 
 
 - Translates this geo polygon by - degreesLatitudenorthwards and- degreesLongitudeeastwards.- Negative values of - degreesLatitudeand- degreesLongitudecorrespond to southward and westward translation respectively.- translated(degreesLatitude, degreesLongitude)¶
- Parameters:
- degreesLatitude – float 
- degreesLongitude – float 
 
- Return type:
 
 - Returns a copy of this geo polygon translated by - degreesLatitudenorthwards and- degreesLongitudeeastwards.- Negative values of - degreesLatitudeand- degreesLongitudecorrespond to southward and westward translation respectively.- See also