- class QGeoRectangle¶
The
QGeoRectangle
class defines a rectangular geographic area. More…Synopsis¶
Properties¶
bottomLeftᅟ
- This property holds the bottom left coorindate of this geo rectanglebottomRightᅟ
- This property holds the bottom right coordinate of this geo rectanglecenterᅟ
- This property holds the center of this geo rectangleheightᅟ
- This property holds the height of this geo rectangle in degreestopLeftᅟ
- This property holds the top left coordinate of this geo rectangletopRightᅟ
- This property holds the top right coordinate of this geo rectanglewidthᅟ
- This property holds the width of this geo rectangle in degrees
Methods¶
def
__init__()
def
bottomLeft()
def
bottomRight()
def
contains()
def
height()
def
intersects()
def
__or__()
def
__ior__()
def
setBottomLeft()
def
setBottomRight()
def
setCenter()
def
setHeight()
def
setTopLeft()
def
setTopRight()
def
setWidth()
def
topLeft()
def
topRight()
def
translate()
def
translated()
def
united()
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 rectangle is defined in terms of a
QGeoCoordinate
which specifies the top left coordinate of the rectangle and aQGeoCoordinate
which specifies the bottom right coordinate of the rectangle.A geo rectangle is considered invalid if the top left or bottom right coordinates are invalid or if the top left coordinate is south of the bottom right coordinate.
Geo rectangles can never cross the poles.
Several methods behave as though the geo rectangle is defined in terms of a center coordinate, the width of the geo rectangle in degrees and the height of the geo rectangle in degrees.
If the height or center of a geo rectangle is adjusted such that it would cross one of the poles the height is modified such that the geo rectangle touches but does not cross the pole and that the center coordinate is still in the center of the geo rectangle.
This class is a Q_GADGET since Qt 5.5. It can be directly used from C++ and QML .
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property bottomLeftᅟ: QGeoCoordinate¶
This property holds This property holds the bottom left coorindate of this geo rectangle..
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- property bottomRightᅟ: QGeoCoordinate¶
This property holds This property holds the bottom right coordinate of this geo rectangle..
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- property centerᅟ: QGeoCoordinate¶
This property holds This property holds the center of this geo rectangle..
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
See also
- Access functions:
- property heightᅟ: float¶
This property holds This property holds the height of this geo rectangle in degrees..
The property value is undefined if this geo rectangle is invalid.
If the new height is less than 0.0 or if this geo rectangle is invalid, the property is not changed. To set up the values of an invalid geo rectangle based on the center, width, and height, you should use
setCenter()
first to make the geo rectangle valid.If the change in height would cause the geo rectangle to cross a pole, the height is adjusted such that the geo rectangle only touches the pole.
This change is done such that the center coordinate is still at the center of the geo rectangle, which may result in a geo rectangle with a smaller height than expected.
180.0 is the height used only if the new height is greater or equal than 180.
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- property topLeftᅟ: QGeoCoordinate¶
This property holds This property holds the top left coordinate of this geo rectangle..
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- property topRightᅟ: QGeoCoordinate¶
This property holds This property holds the top right coordinate of this geo rectangle..
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- property widthᅟ: float¶
This property holds This property holds the width of this geo rectangle in degrees..
The property value is undefined if this geo rectangle is invalid.
If the new width is less than 0.0 or if this geo rectangle is invalid, this function does nothing. To set up the values of an invalid geo rectangle based on the center, width, and height, you should use
setCenter()
first to make the geo rectangle valid.360.0 is the width used only if the new width is equal or greater than 360. In such cases the leftmost longitude of the geo rectangle is set to -180.0 degrees and the rightmost longitude of the geo rectangle is set to 180.0 degrees.
While this property is introduced in Qt 5.5, the related accessor functions exist since the first version of this class.
- Access functions:
- __init__()¶
Constructs a new, invalid geo rectangle.
- __init__(other)
- Parameters:
other –
QGeoRectangle
Constructs a geo rectangle from the contents of
other
.- __init__(other)
- Parameters:
other –
QGeoShape
Constructs a geo rectangle from the contents of
other
.- __init__(coordinates)
- Parameters:
coordinates – .list of QGeoCoordinate
Constructs a new geo rectangle, of minimum size, containing all of the
coordinates
.- __init__(topLeft, bottomRight)
- Parameters:
topLeft –
QGeoCoordinate
bottomRight –
QGeoCoordinate
Constructs a new geo rectangle with a top left coordinate
topLeft
and a bottom right coordinatebottomRight
.- __init__(center, degreesWidth, degreesHeight)
- Parameters:
center –
QGeoCoordinate
degreesWidth – float
degreesHeight – float
Constructs a new geo rectangle centered at
center
with a width in degrees ofdegreesWidth
and a height in degrees ofdegreesHeight
.If
degreesHeight
would take the geo rectangle beyond one of the poles, the height of the geo rectangle will be truncated such that the geo rectangle only extends up to the pole. The center of the geo rectangle will be unchanged, and the height will be adjusted such that the center point is at the center of the truncated geo rectangle.- bottomLeft()¶
- Return type:
Returns the bottom left coordinate of this geo rectangle.
See also
Getter of property
bottomLeftᅟ
.- bottomRight()¶
- Return type:
Returns the bottom right coordinate of this geo rectangle.
See also
Getter of property
bottomRightᅟ
.- contains(rectangle)¶
- Parameters:
rectangle –
QGeoRectangle
- Return type:
bool
Returns whether the geo rectangle
rectangle
is contained within this geo rectangle.- extendRectangle(coordinate)¶
- Parameters:
coordinate –
QGeoCoordinate
Extends the geo rectangle to also cover the coordinate
coordinate
- height()¶
- Return type:
float
Returns the height of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
See also
Getter of property
heightᅟ
.- intersects(rectangle)¶
- Parameters:
rectangle –
QGeoRectangle
- Return type:
bool
Returns whether the geo rectangle
rectangle
intersects this geo rectangle.If the top or bottom edges of both geo rectangles are at one of the poles the geo rectangles are considered to be intersecting, since the longitude is irrelevant when the edges are at the pole.
- __or__(rectangle)¶
- Parameters:
rectangle –
QGeoRectangle
- Return type:
Returns the smallest geo rectangle which contains both this geo rectangle and
rectangle
.If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the rightmost longitude set to 180.0 degrees. This is done to ensure that the result is independent of the order of the operands.
- __ior__(rectangle)¶
- Parameters:
rectangle –
QGeoRectangle
- Return type:
Returns the smallest geo rectangle which contains both this geo rectangle and
rectangle
.If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the rightmost longitude set to 180.0 degrees. This is done to ensure that the result is independent of the order of the operands.
- setBottomLeft(bottomLeft)¶
- Parameters:
bottomLeft –
QGeoCoordinate
Sets the bottom left coordinate of this geo rectangle to
bottomLeft
.See also
Setter of property
bottomLeftᅟ
.- setBottomRight(bottomRight)¶
- Parameters:
bottomRight –
QGeoCoordinate
Sets the bottom right coordinate of this geo rectangle to
bottomRight
.See also
Setter of property
bottomRightᅟ
.- setCenter(center)¶
- Parameters:
center –
QGeoCoordinate
Sets the center of this geo rectangle to
center
.If this causes the geo rectangle to cross on of the poles the height of the geo rectangle will be truncated such that the geo rectangle only extends up to the pole. The center of the geo rectangle will be unchanged, and the height will be adjusted such that the center point is at the center of the truncated geo rectangle.
See also
center()
Setter of property
centerᅟ
.- setHeight(degreesHeight)¶
- Parameters:
degreesHeight – float
Sets the height of this geo rectangle in degrees to
degreesHeight
.See also
Setter of property
heightᅟ
.- setTopLeft(topLeft)¶
- Parameters:
topLeft –
QGeoCoordinate
Sets the top left coordinate of this geo rectangle to
topLeft
.See also
Setter of property
topLeftᅟ
.- setTopRight(topRight)¶
- Parameters:
topRight –
QGeoCoordinate
Sets the top right coordinate of this geo rectangle to
topRight
.See also
Setter of property
topRightᅟ
.- setWidth(degreesWidth)¶
- Parameters:
degreesWidth – float
Sets the width of this geo rectangle in degrees to
degreesWidth
.See also
Setter of property
widthᅟ
.- topLeft()¶
- Return type:
Returns the top left coordinate of this geo rectangle.
See also
Getter of property
topLeftᅟ
.- topRight()¶
- Return type:
Returns the top right coordinate of this geo rectangle.
See also
Getter of property
topRightᅟ
.- translate(degreesLatitude, degreesLongitude)¶
- Parameters:
degreesLatitude – float
degreesLongitude – float
Translates this geo rectangle by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.If the translation would have caused the geo rectangle to cross a pole the geo rectangle will be translated until the top or bottom edge of the geo rectangle touches the pole but not further.
- translated(degreesLatitude, degreesLongitude)¶
- Parameters:
degreesLatitude – float
degreesLongitude – float
- Return type:
Returns a copy of this geo rectangle translated by
degreesLatitude
northwards anddegreesLongitude
eastwards.Negative values of
degreesLatitude
anddegreesLongitude
correspond to southward and westward translation respectively.See also
- united(rectangle)¶
- Parameters:
rectangle –
QGeoRectangle
- Return type:
Returns the smallest geo rectangle which contains both this geo rectangle and
rectangle
.If the centers of the two geo rectangles are separated by exactly 180.0 degrees then the width is set to 360.0 degrees with the leftmost longitude set to -180.0 degrees and the rightmost longitude set to 180.0 degrees. This is done to ensure that the result is independent of the order of the operands.
- width()¶
- Return type:
float
Returns the width of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
See also
Getter of property
widthᅟ
.