Skip to content
Permalink
Browse files

Rename QgsRectangle::buffer to buffered and mark as const

  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 7d6034d commit d70416388461b7266f1cb7d8a059bc112c137695
@@ -2005,6 +2005,7 @@ QgsRectangle {#qgis_api_break_3_0_QgsRectangle}

- The protected members were removed - QgsRectangle is not intended to be subclassed.
- unionRect was removed. Use combineExtentWith instead.
- buffer was renamed to buffered.

QgsRelation {#qgis_api_break_3_0_QgsRelation}
-----------
@@ -163,18 +163,20 @@ Copy constructor

void grow( double delta );
%Docstring
Grows the rectangle by the specified amount.
Grows the rectangle in place by the specified amount.
.. seealso:: buffered()
%End

void include( const QgsPointXY &p );
%Docstring
Updates the rectangle to include the specified point.
%End

QgsRectangle buffer( double width );
QgsRectangle buffered( double width ) const;
%Docstring
Get rectangle enlarged by buffer.
.. versionadded:: 2.1
.. seealso:: grow()
:rtype: QgsRectangle
%End

@@ -263,7 +263,7 @@ def run(item, action, mainwindow):
ext = node_extent
ext.combineExtentWith(edge_extent)
# Grow by 1/20 of largest side
ext = ext.buffer(max(ext.width(), ext.height()) / 20)
ext = ext.buffered(max(ext.width(), ext.height()) / 20)
canvas.setExtent(ext)

# restore canvas render flag
@@ -147,7 +147,7 @@ void QgsRectangle::include( const QgsPointXY &p )
setYMaximum( p.y() );
}

QgsRectangle QgsRectangle::buffer( double width )
QgsRectangle QgsRectangle::buffered( double width ) const
{
return QgsRectangle( mXmin - width, mYmin - width, mXmax + width, mYmax + width );
}
@@ -161,7 +161,8 @@ class CORE_EXPORT QgsRectangle
void scale( double scaleFactor, double centerX, double centerY );

/**
* Grows the rectangle by the specified amount.
* Grows the rectangle in place by the specified amount.
* \see buffered()
*/
void grow( double delta );

@@ -173,8 +174,9 @@ class CORE_EXPORT QgsRectangle
/**
* Get rectangle enlarged by buffer.
* \since QGIS 2.1
* \see grow()
*/
QgsRectangle buffer( double width );
QgsRectangle buffered( double width ) const;

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Oct 3, 2017

Member

Can you update the\since to 3.0 and maybe add a previously buffer() since QGIS 2.1..

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Oct 3, 2017

Author Collaborator

Done in 4f34f94, thanks


/**
* Return the intersection with the given rectangle.
@@ -157,5 +157,5 @@ QgsRectangle QgsGeometryRubberBand::rubberBandRectangle() const
qreal scale = mMapCanvas->mapUnitsPerPixel();
qreal s = ( mIconSize - 1 ) / 2.0 * scale;
qreal p = mPen.width() * scale;
return mGeometry->boundingBox().buffer( s + p );
return mGeometry->boundingBox().buffered( s + p );
}
@@ -72,7 +72,7 @@ def testSimpleLineWithOffset(self):

extent = geom.geometry().boundingBox()
# buffer extent by 10%
extent = extent.buffer((extent.height() + extent.width()) / 20.0)
extent = extent.buffered((extent.height() + extent.width()) / 20.0)

ms.setExtent(extent)
ms.setOutputSize(image.size())
@@ -72,7 +72,7 @@ def testSimpleLineWithOffset(self):

extent = geom.geometry().boundingBox()
# buffer extent by 10%
extent = extent.buffer((extent.height() + extent.width()) / 20.0)
extent = extent.buffered((extent.height() + extent.width()) / 20.0)

ms.setExtent(extent)
ms.setOutputSize(image.size())
@@ -140,9 +140,9 @@ def renderGeometry(self, geom):
extent = geom.geometry().boundingBox()
# buffer extent by 10%
if extent.width() > 0:
extent = extent.buffer((extent.height() + extent.width()) / 20.0)
extent = extent.buffered((extent.height() + extent.width()) / 20.0)
else:
extent = extent.buffer(10)
extent = extent.buffered(10)

ms.setExtent(extent)
ms.setOutputSize(image.size())
@@ -382,7 +382,7 @@ def testRenderFillLayerDisabled(self):

extent = geom.geometry().boundingBox()
# buffer extent by 10%
extent = extent.buffer((extent.height() + extent.width()) / 20.0)
extent = extent.buffered((extent.height() + extent.width()) / 20.0)

ms.setExtent(extent)
ms.setOutputSize(image.size())
@@ -447,7 +447,7 @@ def testRenderLineLayerDisabled(self):

extent = geom.geometry().boundingBox()
# buffer extent by 10%
extent = extent.buffer((extent.height() + extent.width()) / 20.0)
extent = extent.buffered((extent.height() + extent.width()) / 20.0)

ms.setExtent(extent)
ms.setOutputSize(image.size())

0 comments on commit d704163

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