QGeoRectangle Class
The QGeoRectangle class defines a rectangular geographic area. More...
| Header: | #include <QGeoRectangle> |
| qmake: | QT += positioning |
| Since: | Qt 5.2 |
| Inherits: | QGeoShape |
This class was introduced in Qt 5.2.
Properties
|
Public Functions
| QGeoCoordinate | bottomLeft() const |
| QGeoCoordinate | bottomRight() const |
| QGeoCoordinate | center() const |
| double | height() const |
| void | setBottomLeft(const QGeoCoordinate &bottomLeft) |
| void | setBottomRight(const QGeoCoordinate &bottomRight) |
| void | setCenter(const QGeoCoordinate ¢er) |
| void | setHeight(double degreesHeight) |
| void | setTopLeft(const QGeoCoordinate &topLeft) |
| void | setTopRight(const QGeoCoordinate &topRight) |
| void | setWidth(double degreesWidth) |
| QGeoCoordinate | topLeft() const |
| QGeoCoordinate | topRight() const |
| double | width() const |
Detailed Description
The rectangle is defined in terms of a QGeoCoordinate which specifies the top left coordinate of the rectangle and a QGeoCoordinate 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.
Property Documentation
bottomLeft : QGeoCoordinate
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.
This property was introduced in Qt 5.5.
Access functions:
| QGeoCoordinate | bottomLeft() const |
| void | setBottomLeft(const QGeoCoordinate &bottomLeft) |
bottomRight : QGeoCoordinate
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.
This property was introduced in Qt 5.5.
Access functions:
| QGeoCoordinate | bottomRight() const |
| void | setBottomRight(const QGeoCoordinate &bottomRight) |
center : QGeoCoordinate
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.
This property was introduced in Qt 5.5.
Access functions:
| QGeoCoordinate | center() const |
| void | setCenter(const QGeoCoordinate ¢er) |
See also QGeoShape::center.
height : double
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.
This property was introduced in Qt 5.5.
Access functions:
| double | height() const |
| void | setHeight(double degreesHeight) |
topLeft : QGeoCoordinate
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.
This property was introduced in Qt 5.5.
Access functions:
| QGeoCoordinate | topLeft() const |
| void | setTopLeft(const QGeoCoordinate &topLeft) |
topRight : QGeoCoordinate
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.
This property was introduced in Qt 5.5.
Access functions:
| QGeoCoordinate | topRight() const |
| void | setTopRight(const QGeoCoordinate &topRight) |
width : double
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.
This property was introduced in Qt 5.5.
Access functions:
| double | width() const |
| void | setWidth(double degreesWidth) |