geoRectangle QML Value Type
El tipo geoRectangle representa un área geográfica rectangular. Más información...
| Import Statement: | import QtPositioning |
Propiedades
- bottomLeft : geoCoordinate
- bottomRight : geoCoordinate
- center : geoCoordinate
- height : double
- topLeft : geoCoordinate
- topRight : geoCoordinate
- width : double
Descripción detallada
El tipo geoRectangle es un objeto de tipo « geoShape » que representa un área geográfica rectangular. Este tipo es una representación directa de un objeto « QGeoRectangle ». Se define mediante un par de « coordinates » que representan las esquinas superior izquierda e inferior derecha del rectángulo. Se puede acceder a las coordenadas a través de los atributos « topLeft » y « bottomRight ».
Un rectángulo se considera inválido si las coordenadas de la esquina superior izquierda o de la esquina inferior derecha son inválidas, o si la coordenada de la esquina superior izquierda se encuentra al sur de la coordenada de la esquina inferior derecha.
Se puede acceder a las coordenadas de las cuatro esquinas del rectángulo mediante los atributos topLeft, topRight, bottomLeft y bottomRight. El atributo center se puede utilizar para obtener la coordenada del centro del rectángulo. Los atributos width y height se pueden utilizar para obtener la anchura y la altura del rectángulo en grados. Al establecer uno de estos atributos, los demás se ajustarán en consecuencia.
Limitaciones
Un geoRectangle nunca puede atravesar los polos.
Si se ajusta la altura o el centro de un geoRectangle de tal forma que atravesara uno de los polos, la altura se modificará para que el rectángulo toque el polo sin atravesarlo y para que la coordenada del centro siga estando en el centro del rectángulo.
Ejemplo de uso
Para crear un valor de geoRectangle, utiliza la función QtPositioning.rectangle():
import QtPositioning
Item {
property geoRectangle region: QtPositioning.rectangle(QtPositioning.coordinate(-27.5, 153.1),
QtPositioning.coordinate(-27.6, 153.2))
}Al integrar con C++, ten en cuenta que cualquier valor de « QGeoRectangle » pasado a QML desde C++ se convierte automáticamente en un valor de «geoRectangle», y viceversa.
Documentación de la propiedad
bottomLeft : geoCoordinate
Esta propiedad contiene la coordenada de la esquina inferior izquierda de este geoRectangle.
bottomRight : geoCoordinate
Esta propiedad contiene la coordenada de la esquina inferior derecha de este geoRectangle.
center : geoCoordinate
Esta propiedad contiene la coordenada central de este geoRectangle. Para obtener más información, consulta QGeoRectangle::setCenter().
height : double
Esta propiedad contiene la altura de este geoRectangle (en grados). Para obtener más información, consulta QGeoRectangle::setHeight().
Nota: Si el « geoRectangle » no es válido, no es posible establecer la altura. Las versiones de « QtPositioning » anteriores a Qt 5.5 permitían establecer la altura incluso en «geoRectangles» no válidos.
topLeft : geoCoordinate
Esta propiedad contiene la coordenada de la esquina superior izquierda de este geoRectangle.
topRight : geoCoordinate
Esta propiedad contiene la coordenada de la esquina superior derecha de este geoRectangle.
width : double
Esta propiedad contiene el ancho de este geoRectangle (en grados). Para obtener más información, consulta QGeoRectangle::setWidth().
Nota: Si el « geoRectangle » no es válido, no es posible establecer el ancho. Las versiones de « QtPositioning » anteriores a Qt 5.5 permitían establecer el ancho incluso con «geoRectangles» no válidos.
© 2026 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.