QGeoRectangleclass defines a rectangular geographic area. 更多 …
def
__eq__
(other)
def
__ior__
(rectangle)
def
__ne__
(other)
def
__or__
(rectangle)
def
bottomLeft
()
def
bottomRight
()
def
contains
(rectangle)
def
extendRectangle
(coordinate)
def
height
()
def
intersects
(rectangle)
def
setBottomLeft
(bottomLeft)
def
setBottomRight
(bottomRight)
def
setCenter
(center)
def
setHeight
(degreesHeight)
def
setTopLeft
(topLeft)
def
setTopRight
(topRight)
def
setWidth
(degreesWidth)
def
topLeft
()
def
topRight
()
def
translate
(degreesLatitude, degreesLongitude)
def
translated
(degreesLatitude, degreesLongitude)
def
united
(rectangle)
def
width
()
The rectangle is defined in terms of a
QGeoCoordinatewhich specifies the top left coordinate of the rectangle and aQGeoCoordinatewhich 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_GADGETsince Qt 5.5. It can be directly used from C++ and QML .
QGeoRectangle
¶
QGeoRectangle(center, degreesWidth, degreesHeight)
QGeoRectangle(topLeft, bottomRight)
QGeoRectangle(other)
QGeoRectangle(other)
QGeoRectangle(coordinates)
- param degreesWidth
double- param coordinates
- param topLeft
- param degreesHeight
double- param bottomRight
- param other
- param center
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
.
PySide2.QtPositioning.QGeoRectangle.
bottomLeft
(
)
¶
Returns the bottom left coordinate of this geo rectangle.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
bottomRight
(
)
¶
Returns the bottom right coordinate of this geo rectangle.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
contains
(
rectangle
)
¶
rectangle
–
QGeoRectangle
bool
Returns whether the geo rectangle
rectangle
is contained within this geo rectangle.
PySide2.QtPositioning.QGeoRectangle.
extendRectangle
(
coordinate
)
¶
coordinate
–
QGeoCoordinate
Extends the geo rectangle to also cover the coordinate
coordinate
PySide2.QtPositioning.QGeoRectangle.
height
(
)
¶
double
Returns the height of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
intersects
(
rectangle
)
¶
rectangle
–
QGeoRectangle
bool
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.
PySide2.QtPositioning.QGeoRectangle.
__ne__
(
other
)
¶
other
–
QGeoRectangle
bool
Returns whether this geo rectangle is not equal to
other
.
PySide2.QtPositioning.QGeoRectangle.
__eq__
(
other
)
¶
other
–
QGeoRectangle
bool
Returns whether this geo rectangle is equal to
other
.
PySide2.QtPositioning.QGeoRectangle.
__or__
(
rectangle
)
¶
rectangle
–
QGeoRectangle
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.
PySide2.QtPositioning.QGeoRectangle.
__ior__
(
rectangle
)
¶
rectangle
–
QGeoRectangle
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.
PySide2.QtPositioning.QGeoRectangle.
setBottomLeft
(
bottomLeft
)
¶
bottomLeft
–
QGeoCoordinate
Sets the bottom left coordinate of this geo rectangle to
bottomLeft
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
setBottomRight
(
bottomRight
)
¶
bottomRight
–
QGeoCoordinate
Sets the bottom right coordinate of this geo rectangle to
bottomRight
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
setCenter
(
center
)
¶
center
–
QGeoCoordinate
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.
另请参阅
center()
PySide2.QtPositioning.QGeoRectangle.
setHeight
(
degreesHeight
)
¶
degreesHeight
–
double
Sets the height of this geo rectangle in degrees to
degreesHeight
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
setTopLeft
(
topLeft
)
¶
topLeft
–
QGeoCoordinate
Sets the top left coordinate of this geo rectangle to
topLeft
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
setTopRight
(
topRight
)
¶
topRight
–
QGeoCoordinate
Sets the top right coordinate of this geo rectangle to
topRight
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
setWidth
(
degreesWidth
)
¶
degreesWidth
–
double
Sets the width of this geo rectangle in degrees to
degreesWidth
.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
topLeft
(
)
¶
Returns the top left coordinate of this geo rectangle.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
topRight
(
)
¶
Returns the top right coordinate of this geo rectangle.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
translate
(
degreesLatitude
,
degreesLongitude
)
¶
degreesLatitude
–
double
degreesLongitude
–
double
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.
PySide2.QtPositioning.QGeoRectangle.
translated
(
degreesLatitude
,
degreesLongitude
)
¶
degreesLatitude
–
double
degreesLongitude
–
double
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.
另请参阅
PySide2.QtPositioning.QGeoRectangle.
united
(
rectangle
)
¶
rectangle
–
QGeoRectangle
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.
PySide2.QtPositioning.QGeoRectangle.
width
(
)
¶
double
Returns the width of this geo rectangle in degrees.
The return value is undefined if this geo rectangle is invalid.
另请参阅