QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
QgsReferencedRectangle Class Reference

A QgsRectangle with associated coordinate reference system. More...

#include <qgsreferencedgeometry.h>

Inheritance diagram for QgsReferencedRectangle:
Inheritance graph
[legend]

Public Member Functions

 QgsReferencedRectangle ()=default
 Constructor for QgsReferencedRectangle. More...
 
 QgsReferencedRectangle (const QgsRectangle &rectangle, const QgsCoordinateReferenceSystem &crs)
 Constructor for QgsReferencedRectangle, with the specified initial rectangle and crs. More...
 
 operator QVariant () const
 Allows direct construction of QVariants from rectangle. More...
 
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. More...
 
 QgsRectangle (const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true) SIP_HOLDGIL
 Construct a rectangle from two points. More...
 
 QgsRectangle (const QgsRectangle &other) SIP_HOLDGIL
 Copy constructor. More...
 
 QgsRectangle (const QRectF &qRectF) SIP_HOLDGIL
 Construct a rectangle from a QRectF. More...
 
 QgsRectangle (double xMin, double yMin=0, double xMax=0, double yMax=0, bool normalize=true) SIP_HOLDGIL
 Constructs a QgsRectangle from a set of x and y minimum and maximum coordinates. More...
 
 ~QgsRectangle ()=default
 
double area () const SIP_HOLDGIL
 Returns the area of the rectangle. More...
 
QString asPolygon () const
 Returns the rectangle as a polygon. More...
 
QString asWktCoordinates () const
 Returns a string representation of the rectangle in WKT format. More...
 
QString asWktPolygon () const
 Returns a string representation of the rectangle as a WKT Polygon. More...
 
QgsRectangle buffered (double width) const
 Gets rectangle enlarged by buffer. More...
 
QgsPointXY center () const SIP_HOLDGIL
 Returns the center point of the rectangle. More...
 
void combineExtentWith (const QgsPointXY &point)
 Expands the rectangle so that it covers both the original rectangle and the given point. More...
 
void combineExtentWith (const QgsRectangle &rect)
 Expands the rectangle so that it covers both the original rectangle and the given rectangle. More...
 
void combineExtentWith (double x, double y)
 Expands the rectangle so that it covers both the original rectangle and the given point. More...
 
bool contains (const QgsPointXY &p) const SIP_HOLDGIL
 Returns true when rectangle contains a point. More...
 
bool contains (const QgsRectangle &rect) const SIP_HOLDGIL
 Returns true when rectangle contains other rectangle. More...
 
bool contains (double x, double y) const SIP_HOLDGIL
 Returns true when rectangle contains the point at (x, y). More...
 
double distance (const QgsPointXY &point) const
 Returns the distance from point to the nearest point on the boundary of the rectangle. More...
 
void grow (double delta)
 Grows the rectangle in place by the specified amount. More...
 
double height () const SIP_HOLDGIL
 Returns the height of the rectangle. More...
 
void include (const QgsPointXY &p)
 Updates the rectangle to include the specified point. More...
 
QgsRectangle intersect (const QgsRectangle &rect) const
 Returns the intersection with the given rectangle. More...
 
bool intersects (const QgsRectangle &rect) const SIP_HOLDGIL
 Returns true when rectangle intersects with other rectangle. More...
 
void invert ()
 Swap x/y coordinates in the rectangle. More...
 
bool isEmpty () const
 Returns true if the rectangle is empty. More...
 
bool isFinite () const
 Returns true if the rectangle has finite boundaries. More...
 
bool isNull () const
 Test if the rectangle is null (all coordinates zero or after call to setMinimal()). More...
 
void normalize ()
 Normalize the rectangle so it has non-negative width/height. More...
 
 operator QVariant () const
 Allows direct construction of QVariants from rectangles. More...
 
bool operator!= (const QgsRectangle &r1) const
 Comparison operator. More...
 
QgsRectangle operator+ (QgsVector v) const
 Returns a rectangle offset from this one in the direction of the vector. More...
 
QgsRectangleoperator+= (QgsVector v)
 Moves this rectangle in the direction of the vector. More...
 
QgsRectangle operator- (QgsVector v) const
 Returns a rectangle offset from this one in the direction of the reversed vector. More...
 
QgsRectangleoperator-= (QgsVector v)
 Moves this rectangle in the direction of the reversed vector. More...
 
QgsRectangleoperator= (const QgsRectangle &r1)
 Assignment operator. More...
 
bool operator== (const QgsRectangle &r1) const
 Comparison operator. More...
 
double perimeter () const SIP_HOLDGIL
 Returns the perimeter of the rectangle. More...
 
void scale (double scaleFactor, const QgsPointXY *c=nullptr)
 Scale the rectangle around its center point. More...
 
void scale (double scaleFactor, double centerX, double centerY)
 Scale the rectangle around its center point. More...
 
QgsRectangle scaled (double scaleFactor, const QgsPointXY *center=nullptr) const
 Scale the rectangle around its center point. More...
 
void set (const QgsPointXY &p1, const QgsPointXY &p2, bool normalize=true)
 Sets the rectangle from two QgsPoints. More...
 
void set (double xMin, double yMin, double xMax, double yMax, bool normalize=true)
 Sets the rectangle from four points. More...
 
void setMinimal () SIP_HOLDGIL
 Set a rectangle so that min corner is at max and max corner is at min. More...
 
void setXMaximum (double x) SIP_HOLDGIL
 Set the maximum x value. More...
 
void setXMinimum (double x) SIP_HOLDGIL
 Set the minimum x value. More...
 
void setYMaximum (double y) SIP_HOLDGIL
 Set the maximum y value. More...
 
void setYMinimum (double y) SIP_HOLDGIL
 Set the minimum y value. More...
 
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. More...
 
QgsBox3d toBox3d (double zMin, double zMax) const
 Converts the rectangle to a 3D box, with the specified zMin and zMax z values. More...
 
QRectF toRectF () const
 Returns a QRectF with same coordinates as the rectangle. More...
 
QString toString (int precision=16) const
 Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the specified precision. More...
 
double width () const SIP_HOLDGIL
 Returns the width of the rectangle. More...
 
double xMaximum () const SIP_HOLDGIL
 Returns the x maximum value (right side of rectangle). More...
 
double xMinimum () const SIP_HOLDGIL
 Returns the x minimum value (left side of rectangle). More...
 
double yMaximum () const SIP_HOLDGIL
 Returns the y maximum value (top side of rectangle). More...
 
double yMinimum () const SIP_HOLDGIL
 Returns the y minimum value (bottom side of rectangle). More...
 
- Public Member Functions inherited from QgsReferencedGeometryBase
 QgsReferencedGeometryBase (const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Constructor for QgsReferencedGeometryBase, with the specified crs. More...
 
QgsCoordinateReferenceSystem crs () const
 Returns the associated coordinate reference system, or an invalid CRS if no reference system is set. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the associated crs. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsRectangle
static QgsRectangle fromCenterAndSize (const QgsPointXY &center, double width, double height)
 Creates a new rectangle, given the specified center point and width and height. More...
 
static QgsRectangle fromWkt (const QString &wkt)
 Creates a new rectangle from a wkt string. More...
 

Detailed Description

A QgsRectangle with associated coordinate reference system.

Since
QGIS 3.0

Definition at line 73 of file qgsreferencedgeometry.h.

Constructor & Destructor Documentation

◆ QgsReferencedRectangle() [1/2]

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.

◆ QgsReferencedRectangle() [2/2]

QgsReferencedRectangle::QgsReferencedRectangle ( )
default

Constructor for QgsReferencedRectangle.

Member Function Documentation

◆ operator QVariant()

QgsReferencedRectangle::operator QVariant ( ) const
inline

Allows direct construction of QVariants from rectangle.

Definition at line 89 of file qgsreferencedgeometry.h.

◆ operator!=()

bool QgsReferencedRectangle::operator!= ( const QgsReferencedRectangle other) const

Definition at line 34 of file qgsreferencedgeometry.cpp.

◆ operator==()

bool QgsReferencedRectangle::operator== ( const QgsReferencedRectangle other) const

Definition at line 29 of file qgsreferencedgeometry.cpp.


The documentation for this class was generated from the following files: