QGeoRectangle 类定义矩形地理区域。 更多...
头: | #include <QGeoRectangle> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning) |
qmake: | QT += positioning |
继承: | QGeoShape |
|
QGeoRectangle () | |
QGeoRectangle (const QGeoCoordinate & center , double degreesWidth , double degreesHeight ) | |
QGeoRectangle (const QGeoCoordinate & topLeft , const QGeoCoordinate & bottomRight ) | |
QGeoRectangle (const QList<QGeoCoordinate> & coordinates ) | |
QGeoRectangle (const QGeoShape & other ) | |
QGeoRectangle (const QGeoRectangle & other ) | |
~QGeoRectangle () | |
QGeoCoordinate | bottomLeft () const |
QGeoCoordinate | bottomRight () const |
QGeoCoordinate | center () const |
bool | contains (const QGeoRectangle & rectangle ) const |
void | extendRectangle (const QGeoCoordinate & coordinate ) |
double | height () const |
bool | intersects (const QGeoRectangle & rectangle ) const |
void | setBottomLeft (const QGeoCoordinate & bottomLeft ) |
void | setBottomRight (const QGeoCoordinate & bottomRight ) |
void | setCenter (const QGeoCoordinate & center ) |
void | setHeight (double degreesHeight ) |
void | setTopLeft (const QGeoCoordinate & topLeft ) |
void | setTopRight (const QGeoCoordinate & topRight ) |
void | setWidth (double degreesWidth ) |
QString | toString () const |
QGeoCoordinate | topLeft () const |
QGeoCoordinate | topRight () const |
void | translate (double degreesLatitude , double degreesLongitude ) |
QGeoRectangle | translated (double degreesLatitude , double degreesLongitude ) const |
QGeoRectangle | united (const QGeoRectangle & rectangle ) const |
double | width () const |
QGeoRectangle & | operator= (const QGeoRectangle & other ) |
QGeoRectangle | operator| (const QGeoRectangle & rectangle ) const |
QGeoRectangle & | operator|= (const QGeoRectangle & rectangle ) |
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 .
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.
访问函数:
QGeoCoordinate | bottomLeft () const |
void | setBottomLeft (const QGeoCoordinate & bottomLeft ) |
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.
访问函数:
QGeoCoordinate | bottomRight () const |
void | setBottomRight (const QGeoCoordinate & bottomRight ) |
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.
访问函数:
QGeoCoordinate | center () const |
void | setCenter (const QGeoCoordinate & center ) |
另请参阅 QGeoShape::center .
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.
访问函数:
double | height () const |
void | setHeight (double degreesHeight ) |
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.
访问函数:
QGeoCoordinate | topLeft () const |
void | setTopLeft (const QGeoCoordinate & topLeft ) |
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.
访问函数:
QGeoCoordinate | topRight () const |
void | setTopRight (const QGeoCoordinate & topRight ) |
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.
访问函数:
double | width () const |
void | setWidth (double degreesWidth ) |
Constructs a new, invalid geo rectangle.
Constructs a new geo rectangle centered at center with a width in degrees of degreesWidth and a height in degrees of degreesHeight .
若 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.
Constructs a new geo rectangle with a top left coordinate topLeft and a bottom right coordinate bottomRight .
Constructs a new geo rectangle, of minimum size, containing all of the coordinates .
Constructs a geo rectangle from the contents of other .
Constructs a geo rectangle from the contents of other .
Destroys this geo rectangle.
Returns the bottom left coordinate of this geo rectangle.
注意: Getter function for property bottomLeft.
另请参阅 setBottomLeft ().
Returns the bottom right coordinate of this geo rectangle.
注意: Getter function for property bottomRight.
另请参阅 setBottomRight ().
Returns the center of this geo rectangle. Equivalent to QGeoShape::center ().
注意: Getter function for property center.
另请参阅 setCenter ().
Returns whether the geo rectangle rectangle is contained within this geo rectangle.
[invokable]
void
QGeoRectangle::
extendRectangle
(const
QGeoCoordinate
&
coordinate
)
Extends the geo rectangle to also cover the coordinate coordinate
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Returns the height of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
注意: Getter function for property height.
另请参阅 setHeight ().
[invokable]
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.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Sets the bottom left coordinate of this geo rectangle to bottomLeft .
注意: setter 函数对于特性 bottomLeft .
另请参阅 bottomLeft ().
Sets the bottom right coordinate of this geo rectangle to bottomRight .
注意: setter 函数对于特性 bottomRight .
另请参阅 bottomRight ().
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.
注意: setter 函数对于特性 center .
另请参阅 center ().
Sets the height of this geo rectangle in degrees to degreesHeight .
注意: setter 函数对于特性 height .
另请参阅 height ().
Sets the top left coordinate of this geo rectangle to topLeft .
注意: setter 函数对于特性 topLeft .
另请参阅 topLeft ().
Sets the top right coordinate of this geo rectangle to topRight .
注意: setter 函数对于特性 topRight .
另请参阅 topRight ().
Sets the width of this geo rectangle in degrees to degreesWidth .
注意: setter 函数对于特性 width .
另请参阅 width ().
[invokable]
QString
QGeoRectangle::
toString
() const
Returns the geo rectangle properties as a string.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Returns the top left coordinate of this geo rectangle.
注意: Getter function for property topLeft.
另请参阅 setTopLeft ().
Returns the top right coordinate of this geo rectangle.
注意: Getter function for property topRight.
另请参阅 setTopRight ().
[invokable]
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.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
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.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 translate ().
[invokable]
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.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Returns the width of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
注意: Getter function for property width.
另请参阅 setWidth ().
赋值 other to this geo rectangle and returns a reference to this geo 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.
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.