18 #ifndef QGSRECTANGLE_H 19 #define QGSRECTANGLE_H 21 #include "qgis_core.h" 23 #include <QDomDocument> 47 explicit QgsRectangle(
double xMin,
double yMin = 0,
double xMax = 0,
double yMax = 0 );
84 void set(
double mXmin,
double mYmin,
double mXmax,
double mYmax );
142 double width()
const {
return mXmax - mXmin; }
149 double height()
const {
return mYmax - mYmin; }
158 double area()
const {
return ( mXmax - mXmin ) * ( mYmax - mYmin ); }
165 double perimeter()
const {
return 2 * ( mXmax - mXmin ) + 2 * ( mYmax - mYmin ); }
175 void scale(
double scaleFactor,
const QgsPointXY *c =
nullptr );
180 void scale(
double scaleFactor,
double centerX,
double centerY );
186 void grow(
double delta );
229 void combineExtentWith(
double x,
double y );
259 bool isEmpty()
const;
271 QString asWktCoordinates()
const;
276 QString asWktPolygon()
const;
281 QRectF toRectF()
const;
288 QString toString(
int precision = 16 )
const;
293 QString asPolygon()
const;
317 bool isFinite()
const;
329 QgsBox3d toBox3d(
double zMin,
double zMax )
const;
332 operator QVariant()
const 334 return QVariant::fromValue( *
this );
362 return os << r.
toString().toLocal8Bit().data();
367 #endif // QGSRECTANGLE_H A rectangle specified with double values.
void setXMaximum(double x)
Set the maximum x value.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
A class to represent a 2D point.
double perimeter() const
Returns the perimeter of the rectangle.
A 3-dimensional box composed of x, y, z coordinates.
Q_DECLARE_METATYPE(QModelIndex)
CORE_EXPORT QDataStream & operator<<(QDataStream &out, const QgsRectangle &rectangle)
Writes the list rectangle to stream out.
double width() const
Returns the width of the rectangle.
void setYMinimum(double y)
Set the minimum y value.
QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
QDateTime operator+(const QDateTime &start, QgsInterval interval)
A class to represent a vector.
QgsInterval operator-(const QDateTime &dt1, const QDateTime &dt2)
Returns the interval between two datetimes.
double area() const
Returns the area of the rectangle.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
CORE_EXPORT QDataStream & operator>>(QDataStream &in, QgsRectangle &rectangle)
Reads a rectangle from stream in into rectangle.
void setYMaximum(double y)
Set the maximum y value.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
QgsPointXY center() const
Returns the center point of the rectangle.
void setXMinimum(double x)
Set the minimum x value.
double height() const
Returns the height of the rectangle.