mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
add QgsRectangle::scaled which returns the scaled rectangle
facilitates one-lines
This commit is contained in:
parent
edc03030ef
commit
80d0c33f5b
@ -183,6 +183,13 @@ Scale the rectangle around its center point.
|
||||
void scale( double scaleFactor, double centerX, double centerY );
|
||||
%Docstring
|
||||
Scale the rectangle around its center point.
|
||||
%End
|
||||
|
||||
QgsRectangle scaled( double scaleFactor, const QgsPointXY *center = 0 );
|
||||
%Docstring
|
||||
Scale the rectangle around its ``center`` point.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
void grow( double delta );
|
||||
|
@ -58,6 +58,13 @@ QgsRectangle QgsRectangle::fromCenterAndSize( QgsPointXY center, double width, d
|
||||
return QgsRectangle( xMin, yMin, xMax, yMax );
|
||||
}
|
||||
|
||||
QgsRectangle QgsRectangle::scaled( double scaleFactor, const QgsPointXY *center )
|
||||
{
|
||||
QgsRectangle scaledRect = QgsRectangle( *this );
|
||||
scaledRect.scale( scaleFactor, center );
|
||||
return scaledRect;
|
||||
}
|
||||
|
||||
QgsRectangle QgsRectangle::operator-( const QgsVector v ) const
|
||||
{
|
||||
double xmin = mXmin - v.x();
|
||||
|
@ -261,6 +261,12 @@ class CORE_EXPORT QgsRectangle
|
||||
mYmax = centerY + newHeight / 2.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale the rectangle around its \a center point.
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
QgsRectangle scaled( double scaleFactor, const QgsPointXY *center = nullptr );
|
||||
|
||||
/**
|
||||
* Grows the rectangle in place by the specified amount.
|
||||
* \see buffered()
|
||||
|
Loading…
x
Reference in New Issue
Block a user