![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtPositioning More...
#include <qgeorectangle.h>
Public Member Functions | |
QGeoRectangle () | |
Constructs a new, invalid geo rectangle. | |
QGeoRectangle (const QGeoCoordinate ¢er, double degreesWidth, double degreesHeight) | |
Constructs a new geo rectangle centered at center with a width in degrees of degreesWidth and a height in degrees of degreesHeight. | |
QGeoRectangle (const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight) | |
Constructs a new geo rectangle with a top left coordinate topLeft and a bottom right coordinate bottomRight. | |
QGeoRectangle (const QList< QGeoCoordinate > &coordinates) | |
Constructs a new geo rectangle, of minimum size, containing all of the coordinates. | |
QGeoRectangle (const QGeoRectangle &other) | |
Constructs a geo rectangle from the contents of other. | |
QGeoRectangle (const QGeoShape &other) | |
Constructs a geo rectangle from the contents of other. | |
~QGeoRectangle () | |
Destroys this geo rectangle. | |
QGeoRectangle & | operator= (const QGeoRectangle &other) |
Assigns other to this geo rectangle and returns a reference to this geo rectangle. | |
void | setTopLeft (const QGeoCoordinate &topLeft) |
Sets the top left coordinate of this geo rectangle to topLeft. | |
QGeoCoordinate | topLeft () const |
Returns the top left coordinate of this geo rectangle. | |
void | setTopRight (const QGeoCoordinate &topRight) |
Sets the top right coordinate of this geo rectangle to topRight. | |
QGeoCoordinate | topRight () const |
Returns the top right coordinate of this geo rectangle. | |
void | setBottomLeft (const QGeoCoordinate &bottomLeft) |
Sets the bottom left coordinate of this geo rectangle to bottomLeft. | |
QGeoCoordinate | bottomLeft () const |
Returns the bottom left coordinate of this geo rectangle. | |
void | setBottomRight (const QGeoCoordinate &bottomRight) |
Sets the bottom right coordinate of this geo rectangle to bottomRight. | |
QGeoCoordinate | bottomRight () const |
Returns the bottom right coordinate of this geo rectangle. | |
void | setCenter (const QGeoCoordinate ¢er) |
Sets the center of this geo rectangle to center. | |
QGeoCoordinate | center () const |
Returns the center of this geo rectangle. | |
void | setWidth (double degreesWidth) |
Sets the width of this geo rectangle in degrees to degreesWidth. | |
double | width () const |
Returns the width of this geo rectangle in degrees. | |
void | setHeight (double degreesHeight) |
Sets the height of this geo rectangle in degrees to degreesHeight. | |
double | height () const |
Returns the height of this geo rectangle in degrees. | |
bool | contains (const QGeoRectangle &rectangle) const |
Returns whether the geo rectangle rectangle is contained within this geo rectangle. | |
Q_INVOKABLE bool | intersects (const QGeoRectangle &rectangle) const |
Returns whether the geo rectangle rectangle intersects this geo rectangle. | |
Q_INVOKABLE void | translate (double degreesLatitude, double degreesLongitude) |
Translates this geo rectangle by degreesLatitude northwards and degreesLongitude eastwards. | |
Q_INVOKABLE QGeoRectangle | translated (double degreesLatitude, double degreesLongitude) const |
Returns a copy of this geo rectangle translated by degreesLatitude northwards and degreesLongitude eastwards. | |
Q_INVOKABLE void | extendRectangle (const QGeoCoordinate &coordinate) |
Extends the geo rectangle to also cover the coordinate coordinate. | |
Q_INVOKABLE QGeoRectangle | united (const QGeoRectangle &rectangle) const |
Returns the smallest geo rectangle which contains both this geo rectangle and rectangle. | |
QGeoRectangle | operator| (const QGeoRectangle &rectangle) const |
Returns the smallest geo rectangle which contains both this geo rectangle and rectangle. | |
QGeoRectangle & | operator|= (const QGeoRectangle &rectangle) |
Returns the smallest geo rectangle which contains both this geo rectangle and rectangle. | |
Q_INVOKABLE QString | toString () const |
Returns the geo rectangle properties as a string. | |
Q_INVOKABLE bool | contains (const QGeoCoordinate &coordinate) const |
Returns whether the coordinate coordinate is contained within this geo shape. | |
![]() | |
QGeoShape () | |
Constructs a new invalid geo shape of \l UnknownType. | |
Q_INVOKABLE | QGeoShape (const QGeoShape &other) |
Constructs a new geo shape which is a copy of other. | |
~QGeoShape () | |
Destroys this geo shape. | |
ShapeType | type () const |
Returns the type of this geo shape. | |
bool | isValid () const |
Returns whether this geo shape is valid. | |
bool | isEmpty () const |
Returns whether this geo shape is empty. | |
Q_INVOKABLE bool | contains (const QGeoCoordinate &coordinate) const |
Returns whether the coordinate coordinate is contained within this geo shape. | |
Q_INVOKABLE QGeoRectangle | boundingGeoRectangle () const |
Returns a QGeoRectangle representing the geographical bounding rectangle of the geo shape, that defines the latitudinal/longitudinal bounds of the geo shape. | |
QGeoCoordinate | center () const |
Returns the coordinate located at the geometric center of the geo shape. | |
QGeoShape & | operator= (const QGeoShape &other) |
Assigns other to this geo shape and returns a reference to this geo shape. | |
Q_INVOKABLE QString | toString () const |
Returns a string representation of this geo shape. | |
Properties | |
QGeoCoordinate | bottomLeft |
This property holds the bottom left coorindate of this geo rectangle. | |
QGeoCoordinate | bottomRight |
This property holds the bottom right coordinate of this geo rectangle. | |
QGeoCoordinate | topLeft |
This property holds the top left coordinate of this geo rectangle. | |
QGeoCoordinate | topRight |
This property holds the top right coordinate of this geo rectangle. | |
QGeoCoordinate | center |
This property holds the center of this geo rectangle. | |
double | height |
This property holds the height of this geo rectangle in degrees. | |
double | width |
This property holds the width of this geo rectangle in degrees. | |
![]() | |
ShapeType | type |
This property holds the type of this geo shape. | |
bool | isValid |
This property holds the validity of the geo shape. | |
bool | isEmpty |
This property defines whether this geo shape is empty. | |
QGeoCoordinate | center |
Friends | |
QDataStream & | operator<< (QDataStream &stream, const QGeoRectangle &rectangle) |
QDataStream & | operator>> (QDataStream &stream, QGeoRectangle &rectangle) |
Additional Inherited Members | |
![]() | |
enum | ShapeType { UnknownType , RectangleType , CircleType , PathType , PolygonType } |
Describes the type of the shape. More... | |
![]() | |
QGeoShape (QGeoShapePrivate *d) | |
![]() | |
QSharedDataPointer< QGeoShapePrivate > | d_ptr |
\inmodule QtPositioning
The QGeoRectangle class defines a rectangular geographic area.
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 \l Q_GADGET since Qt 5.5. It can be \l{Cpp_value_integration_positioning}{directly used from C++ and QML}.
Definition at line 13 of file qgeorectangle.h.
QGeoRectangle::QGeoRectangle | ( | ) |
Constructs a new, invalid geo rectangle.
Definition at line 161 of file qgeorectangle.cpp.
QGeoRectangle::QGeoRectangle | ( | const QGeoCoordinate & | center, |
double | degreesWidth, | ||
double | degreesHeight ) |
Constructs a new geo rectangle centered at center with a width in degrees of degreesWidth and a height in degrees of degreesHeight.
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.
Definition at line 176 of file qgeorectangle.cpp.
QGeoRectangle::QGeoRectangle | ( | const QGeoCoordinate & | topLeft, |
const QGeoCoordinate & | bottomRight ) |
Constructs a new geo rectangle with a top left coordinate topLeft and a bottom right coordinate bottomRight.
Definition at line 187 of file qgeorectangle.cpp.
QGeoRectangle::QGeoRectangle | ( | const QList< QGeoCoordinate > & | coordinates | ) |
Constructs a new geo rectangle, of minimum size, containing all of the coordinates.
Definition at line 195 of file qgeorectangle.cpp.
QGeoRectangle::QGeoRectangle | ( | const QGeoRectangle & | other | ) |
Constructs a geo rectangle from the contents of other.
Definition at line 211 of file qgeorectangle.cpp.
QGeoRectangle::QGeoRectangle | ( | const QGeoShape & | other | ) |
Constructs a geo rectangle from the contents of other.
Definition at line 219 of file qgeorectangle.cpp.
QGeoRectangle::~QGeoRectangle | ( | ) |
Destroys this geo rectangle.
Definition at line 229 of file qgeorectangle.cpp.
QGeoCoordinate QGeoRectangle::bottomLeft | ( | ) | const |
Returns the bottom left coordinate of this geo rectangle.
Definition at line 316 of file qgeorectangle.cpp.
QGeoCoordinate QGeoRectangle::bottomRight | ( | ) | const |
Returns the bottom right coordinate of this geo rectangle.
Definition at line 340 of file qgeorectangle.cpp.
QGeoCoordinate QGeoRectangle::center | ( | ) | const |
Returns the center of this geo rectangle.
Equivalent to QGeoShape::center().
Definition at line 408 of file qgeorectangle.cpp.
bool QGeoShape::contains | ( | const QGeoCoordinate & | coordinate | ) | const |
Returns whether the coordinate coordinate is contained within this geo shape.
Definition at line 42 of file qgeoshape.cpp.
bool QGeoRectangle::contains | ( | const QGeoRectangle & | rectangle | ) | const |
Returns whether the geo rectangle rectangle is contained within this geo rectangle.
Definition at line 593 of file qgeorectangle.cpp.
void QGeoRectangle::extendRectangle | ( | const QGeoCoordinate & | coordinate | ) |
Extends the geo rectangle to also cover the coordinate coordinate.
Definition at line 716 of file qgeorectangle.cpp.
double QGeoRectangle::height | ( | ) | const |
Returns the height of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
Definition at line 524 of file qgeorectangle.cpp.
bool QGeoRectangle::intersects | ( | const QGeoRectangle & | rectangle | ) | const |
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.
Definition at line 610 of file qgeorectangle.cpp.
QGeoRectangle & QGeoRectangle::operator= | ( | const QGeoRectangle & | other | ) |
Assigns other to this geo rectangle and returns a reference to this geo rectangle.
Definition at line 236 of file qgeorectangle.cpp.
|
inline |
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.
Definition at line 89 of file qgeorectangle.h.
QGeoRectangle & QGeoRectangle::operator|= | ( | const QGeoRectangle & | rectangle | ) |
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.
Definition at line 808 of file qgeorectangle.cpp.
void QGeoRectangle::setBottomLeft | ( | const QGeoCoordinate & | bottomLeft | ) |
Sets the bottom left coordinate of this geo rectangle to bottomLeft.
Definition at line 305 of file qgeorectangle.cpp.
void QGeoRectangle::setBottomRight | ( | const QGeoCoordinate & | bottomRight | ) |
Sets the bottom right coordinate of this geo rectangle to bottomRight.
Definition at line 330 of file qgeorectangle.cpp.
void QGeoRectangle::setCenter | ( | const QGeoCoordinate & | center | ) |
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.
Definition at line 357 of file qgeorectangle.cpp.
void QGeoRectangle::setHeight | ( | double | degreesHeight | ) |
Sets the height of this geo rectangle in degrees to degreesHeight.
Definition at line 473 of file qgeorectangle.cpp.
void QGeoRectangle::setTopLeft | ( | const QGeoCoordinate & | topLeft | ) |
Sets the top left coordinate of this geo rectangle to topLeft.
Definition at line 260 of file qgeorectangle.cpp.
void QGeoRectangle::setTopRight | ( | const QGeoCoordinate & | topRight | ) |
Sets the top right coordinate of this geo rectangle to topRight.
Definition at line 280 of file qgeorectangle.cpp.
void QGeoRectangle::setWidth | ( | double | degreesWidth | ) |
Sets the width of this geo rectangle in degrees to degreesWidth.
Definition at line 418 of file qgeorectangle.cpp.
QGeoCoordinate QGeoRectangle::topLeft | ( | ) | const |
Returns the top left coordinate of this geo rectangle.
Definition at line 270 of file qgeorectangle.cpp.
QGeoCoordinate QGeoRectangle::topRight | ( | ) | const |
Returns the top right coordinate of this geo rectangle.
Definition at line 291 of file qgeorectangle.cpp.
QString QGeoRectangle::toString | ( | ) | const |
Returns the geo rectangle properties as a string.
Definition at line 858 of file qgeorectangle.cpp.
void QGeoRectangle::translate | ( | double | degreesLatitude, |
double | degreesLongitude ) |
Translates this geo rectangle by degreesLatitude northwards and degreesLongitude eastwards.
Negative values of degreesLatitude and degreesLongitude 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.
Definition at line 667 of file qgeorectangle.cpp.
QGeoRectangle QGeoRectangle::translated | ( | double | degreesLatitude, |
double | degreesLongitude ) const |
Returns a copy of this geo rectangle translated by degreesLatitude northwards and degreesLongitude eastwards.
Negative values of degreesLatitude and degreesLongitude correspond to southward and westward translation respectively.
Definition at line 704 of file qgeorectangle.cpp.
QGeoRectangle QGeoRectangle::united | ( | const QGeoRectangle & | rectangle | ) | const |
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.
Definition at line 731 of file qgeorectangle.cpp.
double QGeoRectangle::width | ( | ) | const |
Returns the width of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
Definition at line 454 of file qgeorectangle.cpp.
|
friend |
Definition at line 76 of file qgeorectangle.h.
|
friend |
Definition at line 80 of file qgeorectangle.h.
|
readwrite |
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.
Definition at line 16 of file qgeorectangle.h.
|
readwrite |
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.
Definition at line 17 of file qgeorectangle.h.
|
readwrite |
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.
Definition at line 20 of file qgeorectangle.h.
|
readwrite |
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 \l 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.
Definition at line 21 of file qgeorectangle.h.
|
readwrite |
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.
Definition at line 18 of file qgeorectangle.h.
|
readwrite |
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.
Definition at line 19 of file qgeorectangle.h.
|
readwrite |
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 \l 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.
Definition at line 22 of file qgeorectangle.h.