QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
A QgsRectangle with associated coordinate reference system. More...
#include <qgsreferencedgeometry.h>
Public Member Functions | |
QgsReferencedRectangle ()=default | |
QgsReferencedRectangle (const QgsRectangle &rectangle, const QgsCoordinateReferenceSystem &crs) | |
Constructor for QgsReferencedRectangle, with the specified initial rectangle and crs. | |
operator QVariant () const | |
Allows direct construction of QVariants from rectangle. | |
bool | operator!= (const QgsReferencedRectangle &other) const |
bool | operator== (const QgsReferencedRectangle &other) const |
Public Member Functions inherited from QgsRectangle | |
QgsRectangle ()=default | |
Constructor for a null rectangle. | |
QgsRectangle (const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true) | |
Construct a rectangle from two points. | |
QgsRectangle (const QgsRectangle &other) | |
QgsRectangle (const QRectF &qRectF) | |
Construct a rectangle from a QRectF. | |
QgsRectangle (double xMin, double yMin=0, double xMax=0, double yMax=0, bool normalize=true) | |
Constructs a QgsRectangle from a set of x and y minimum and maximum coordinates. | |
~QgsRectangle ()=default | |
double | area () const |
Returns the area of the rectangle. | |
QString | asPolygon () const |
Returns the rectangle as a polygon. | |
QString | asWktCoordinates () const |
Returns a string representation of the rectangle in WKT format. | |
QString | asWktPolygon () const |
Returns a string representation of the rectangle as a WKT Polygon. | |
QgsRectangle | buffered (double width) const |
Gets rectangle enlarged by buffer. | |
QgsPointXY | center () const |
Returns the center point of the rectangle. | |
void | combineExtentWith (const QgsPointXY &point) |
Expands the rectangle so that it covers both the original rectangle and the given point. | |
void | combineExtentWith (const QgsRectangle &rect) |
Expands the rectangle so that it covers both the original rectangle and the given rectangle. | |
void | combineExtentWith (double x, double y) |
Expands the rectangle so that it covers both the original rectangle and the given point. | |
bool | contains (const QgsPointXY &p) const |
Returns true when rectangle contains a point. | |
bool | contains (const QgsRectangle &rect) const |
Returns true when rectangle contains other rectangle. | |
bool | contains (double x, double y) const |
Returns true when rectangle contains the point at (x, y). | |
double | distance (const QgsPointXY &point) const |
Returns the distance from point to the nearest point on the boundary of the rectangle. | |
void | grow (double delta) |
Grows the rectangle in place by the specified amount. | |
double | height () const |
Returns the height of the rectangle. | |
void | include (const QgsPointXY &p) |
Updates the rectangle to include the specified point. | |
QgsRectangle | intersect (const QgsRectangle &rect) const |
Returns the intersection with the given rectangle. | |
bool | intersects (const QgsRectangle &rect) const |
Returns true when rectangle intersects with other rectangle. | |
void | invert () |
Swap x/y coordinates in the rectangle. | |
bool | isEmpty () const |
Returns true if the rectangle has no area. | |
bool | isFinite () const |
Returns true if the rectangle has finite boundaries. | |
bool | isNull () const |
Test if the rectangle is null (holding no spatial information). | |
void | normalize () |
Normalize the rectangle so it has non-negative width/height. | |
operator QVariant () const | |
Allows direct construction of QVariants from rectangles. | |
bool | operator!= (const QgsRectangle &r1) const |
QgsRectangle | operator+ (QgsVector v) const |
Returns a rectangle offset from this one in the direction of the vector. | |
QgsRectangle & | operator+= (QgsVector v) |
Moves this rectangle in the direction of the vector. | |
QgsRectangle | operator- (QgsVector v) const |
Returns a rectangle offset from this one in the direction of the reversed vector. | |
QgsRectangle & | operator-= (QgsVector v) |
Moves this rectangle in the direction of the reversed vector. | |
QgsRectangle & | operator= (const QgsRectangle &r1) |
bool | operator== (const QgsRectangle &r1) const |
double | perimeter () const |
Returns the perimeter of the rectangle. | |
void | scale (double scaleFactor, const QgsPointXY *c=nullptr) |
Scale the rectangle around its center point. | |
void | scale (double scaleFactor, double centerX, double centerY) |
Scale the rectangle around its center point. | |
QgsRectangle | scaled (double scaleFactor, const QgsPointXY *center=nullptr) const |
Scale the rectangle around its center point. | |
void | set (const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true) |
Sets the rectangle from two QgsPoints. | |
void | set (double xMin, double yMin, double xMax, double yMax, bool normalize=true) |
Sets the rectangle from four points. | |
Q_DECL_DEPRECATED void | setMinimal () |
Set a rectangle so that min corner is at max and max corner is at min. | |
void | setNull () |
Mark a rectangle as being null (holding no spatial information). | |
void | setXMaximum (double x) |
Set the maximum x value. | |
void | setXMinimum (double x) |
Set the minimum x value. | |
void | setYMaximum (double y) |
Set the maximum y value. | |
void | setYMinimum (double y) |
Set the minimum y value. | |
QgsRectangle | snappedToGrid (double spacing) const |
Returns a copy of this rectangle that is snapped to a grid with the specified spacing between the grid lines. | |
QgsBox3D | toBox3d (double zMin, double zMax) const |
Converts the rectangle to a 3D box, with the specified zMin and zMax z values. | |
QRectF | toRectF () const |
Returns a QRectF with same coordinates as the rectangle. | |
QString | toString (int precision=16) const |
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the specified precision. | |
double | width () const |
Returns the width of the rectangle. | |
double | xMaximum () const |
Returns the x maximum value (right side of rectangle). | |
double | xMinimum () const |
Returns the x minimum value (left side of rectangle). | |
double | yMaximum () const |
Returns the y maximum value (top side of rectangle). | |
double | yMinimum () const |
Returns the y minimum value (bottom side of rectangle). | |
Public Member Functions inherited from QgsReferencedGeometryBase | |
QgsReferencedGeometryBase (const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) | |
Constructor for QgsReferencedGeometryBase, with the specified crs. | |
QgsCoordinateReferenceSystem | crs () const |
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set. | |
void | setCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the associated crs. | |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsRectangle | |
static QgsRectangle | fromCenterAndSize (const QgsPointXY ¢er, double width, double height) |
Creates a new rectangle, given the specified center point and width and height. | |
static QgsRectangle | fromWkt (const QString &wkt) |
Creates a new rectangle from a wkt string. | |
A QgsRectangle with associated coordinate reference system.
Definition at line 71 of file qgsreferencedgeometry.h.
QgsReferencedRectangle::QgsReferencedRectangle | ( | const QgsRectangle & | rectangle, |
const QgsCoordinateReferenceSystem & | crs | ||
) |
Constructor for QgsReferencedRectangle, with the specified initial rectangle and crs.
Definition at line 24 of file qgsreferencedgeometry.cpp.
|
default |
|
inline |
Allows direct construction of QVariants from rectangle.
Definition at line 84 of file qgsreferencedgeometry.h.
bool QgsReferencedRectangle::operator!= | ( | const QgsReferencedRectangle & | other | ) | const |
Definition at line 34 of file qgsreferencedgeometry.cpp.
bool QgsReferencedRectangle::operator== | ( | const QgsReferencedRectangle & | other | ) | const |
Definition at line 29 of file qgsreferencedgeometry.cpp.