The georectangle type represents a rectangular geographic area.
The georectangle
type is a geoshape that represents a rectangular geographic area. The type is direct representation of a QGeoRectangle.
It is defined by a pair of coordinates which represent the top-left and bottom-right corners of the georectangle
. The coordinates are accessible from the topLeft and bottomRight attributes.
A georectangle
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.
The coordinates of the four corners of the georectangle
can be accessed with the topLeft, topRight, bottomLeft and bottomRight attributes. The center attribute can be used to get the
coordinate of the center of the georectangle
. The width and height attributes can be used to get the width and height of the
georectangle
in degrees. Setting one of these attributes will cause the other attributes to be adjusted accordingly.
A georectangle
can never cross the poles.
If the height or center of a georectangle
is adjusted such that it would cross one of the poles the height is modified such that the georectangle
touches but does not cross the pole and that the
center coordinate is still in the center of the georectangle
.
Use properties of type variant to store a georectangle
. To create a georectangle
value, use the QtPositioning.rectangle() function:
import QtPositioning 5.2 Item { property variant region: QtPositioning.rectangle(QtPositioning.coordinate(-27.5, 153.1), QtPositioning.coordinate(-27.6, 153.2)) }
When integrating with C++, note that any QGeoRectangle value passed into QML from C++ is automatically converted into a georectangle
value, and vice-versa.
coordinate bottomLeft
This property holds the bottom left coordinate of this georectangle.
coordinate bottomRight
This property holds the bottom right coordinate of this georectangle.
coordinate center
This property holds the center coordinate of this georectangle. For more details see QGeoRectangle::setCenter().
double height
This property holds the height of this georectangle (in degrees). For more details see QGeoRectangle::setHeight().
Note: If the georectangle is invalid, it is not possible to set the height. QtPositioning releases prior to Qt 5.5 permitted the setting of the height even on invalid georectangles.
coordinate topLeft
This property holds the top left coordinate of this georectangle.
coordinate topRight
This property holds the top right coordinate of this georectangle.
double width
This property holds the width of this georectangle (in degrees). For more details see QGeoRectangle::setWidth().
Note: If the georectangle is invalid, it is not possible to set the width. QtPositioning releases prior to Qt 5.5 permitted the setting of the width even on invalid georectangles.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: