Skip to content
Permalink
Browse files

add QgsRectangle::scaled which returns the scaled rectangle

facilitates one-lines
  • Loading branch information
3nids committed Oct 25, 2018
1 parent edc0303 commit 80d0c33f5b5c85d4981e24e32dc0acb1861e31f8
@@ -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()

0 comments on commit 80d0c33

Please sign in to comment.
You can’t perform that action at this time.