23 #include <QTextStream> 33 : xmin( newxmin ), ymin( newymin ), xmax( newxmax ), ymax( newymax )
105 double centerX, centerY;
116 scale( scaleFactor, centerX, centerY );
121 double newWidth =
width() * scaleFactor;
122 double newHeight =
height() * scaleFactor;
123 xmin = centerX - newWidth / 2.0;
124 xmax = centerX + newWidth / 2.0;
125 ymin = centerY - newHeight / 2.0;
126 ymax = centerY + newHeight / 2.0;
255 return QRectF( static_cast< qreal >(
xmin ), static_cast< qreal >(
ymin ), static_cast< qreal >(
xmax -
xmin ), static_cast< qreal >(
ymax -
ymin ) );
261 if ( automaticPrecision )
266 precision =
static_cast<int>( ceil( -1.0 * log10( qMin(
width(),
height() ) ) ) ) + 1;
268 if ( precision > 20 )
285 rep =
QString(
"%1,%2 : %3,%4" )
286 .
arg(
xmin, 0,
'f', thePrecision )
287 .
arg(
ymin, 0,
'f', thePrecision )
288 .
arg(
xmax, 0,
'f', thePrecision )
289 .
arg(
ymax, 0,
'f', thePrecision );
333 return ( !
operator==( r1 ) );
396 in >> xmin >> ymin >> xmax >>
ymax;
void unionRect(const QgsRectangle &rect)
Updates rectangle to include passed argument.
QgsRectangle & operator=(const QgsRectangle &r1)
Assignment operator.
bool intersects(const QgsRectangle &rect) const
returns true when rectangle intersects with other rectangle
A rectangle specified with double values.
bool isEmpty() const
test if rectangle is empty.
QRectF toRectF() const
returns a QRectF with same coordinates.
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
void setRealNumberNotation(RealNumberNotation notation)
void setXMaximum(double x)
Set the maximum x value.
QgsRectangle buffer(double width)
Get rectangle enlarged by buffer.
bool isFinite() const
Returns true if the rectangle has finite boundaries.
double yMaximum() const
Get the y maximum value (top side of rectangle)
void setRealNumberPrecision(int precision)
bool contains(const QgsRectangle &rect) const
return true when rectangle contains other rectangle
QDataStream & operator>>(QDataStream &in, QgsRectangle &rectangle)
Reads a rectangle from stream in into rectangle.
void scale(double scaleFactor, const QgsPoint *c=nullptr)
Scale the rectangle around its center point.
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
double x() const
Get the x value of the point.
void set(const QgsPoint &p1, const QgsPoint &p2)
Set the rectangle from two QgsPoints.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
void combineExtentWith(QgsRectangle *rect)
expand the rectangle so that covers both the original rectangle and the given rectangle ...
QgsRectangle(double xmin=0, double ymin=0, double xmax=0, double ymax=0)
Constructor.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double xMaximum() const
Get the x maximum value (right side of rectangle)
#define QgsDebugMsgLevel(str, level)
void grow(double delta)
Grow the rectangle by the specified amount.
void include(const QgsPoint &p)
Updates the rectangle to include the specified point.
QString qgsDoubleToString(double a, int precision=17)
void setYMinimum(double y)
Set the minimum y value.
QString asWktCoordinates() const
returns string representation in Wkt form
A class to represent a point.
bool operator!=(const QgsRectangle &r1) const
Comparison operator.
QString asWktPolygon() const
returns string representation as WKT Polygon
QString asPolygon() const
returns rectangle as a polygon
void setYMaximum(double y)
Set the maximum y value.
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
double y() const
Get the y value of the point.
QPointF bottomRight() const
void normalize()
Normalize the rectangle so it has non-negative width/height.
double width() const
Width of the rectangle.
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
double xMinimum() const
Get the x minimum value (left side of rectangle)
QDataStream & operator<<(QDataStream &out, const QgsRectangle &rectangle)
Writes the list rectangle to stream out.
void setXMinimum(double x)
Set the minimum x value.
double height() const
Height of the rectangle.
bool operator==(const QgsRectangle &r1) const
Comparison operator.