georectangle QML Basic Type
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.
Limitations
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
.
Example Usage
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.
Properties
bottomLeft
coordinate bottomLeft
This property holds the bottom left coordinate of this georectangle.
bottomRight
coordinate bottomRight
This property holds the bottom right coordinate of this georectangle.
center
coordinate center
This property holds the center coordinate of this georectangle. For more details see QGeoRectangle::setCenter().
height
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.
topLeft
coordinate topLeft
This property holds the top left coordinate of this georectangle.
topRight
coordinate topRight
This property holds the top right coordinate of this georectangle.
width
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.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.