Skip to content
Permalink
Browse files

Remove duplicate QgsRectangle::unionRect method

QgsRectangle::combineExtentWith does the exact same thing
  • Loading branch information
nyalldawson committed Jun 11, 2017
1 parent 1034131 commit 74ce5550ad4db0f3a1ef63d114f9f0e4884ce5e4
@@ -1927,6 +1927,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.

QgsRelation {#qgis_api_break_3_0_QgsRelation}
-----------
@@ -267,11 +267,6 @@ Copy constructor
%End


void unionRect( const QgsRectangle &rect );
%Docstring
Updates the rectangle to include another rectangle.
%End

bool isFinite() const;
%Docstring
Returns true if the rectangle has finite boundaries. Will
@@ -342,18 +342,6 @@ QgsRectangle &QgsRectangle::operator=( const QgsRectangle &r )
return *this;
}

void QgsRectangle::unionRect( const QgsRectangle &r )
{
if ( r.xMinimum() < xMinimum() )
setXMinimum( r.xMinimum() );
if ( r.xMaximum() > xMaximum() )
setXMaximum( r.xMaximum() );
if ( r.yMinimum() < yMinimum() )
setYMinimum( r.yMinimum() );
if ( r.yMaximum() > yMaximum() )
setYMaximum( r.yMaximum() );
}

bool QgsRectangle::isFinite() const
{
if ( qIsInf( mXmin ) || qIsInf( mYmin ) || qIsInf( mXmax ) || qIsInf( mYmax ) )
@@ -259,11 +259,6 @@ class CORE_EXPORT QgsRectangle
*/
QgsRectangle &operator=( const QgsRectangle &r1 );

/**
* Updates the rectangle to include another rectangle.
*/
void unionRect( const QgsRectangle &rect );

/**
* Returns true if the rectangle has finite boundaries. Will
* return false if any of the rectangle boundaries are NaN or Inf.
@@ -278,7 +278,7 @@ QgsRectangle QgsMemoryProvider::extent() const
Q_FOREACH ( const QgsFeature &feat, mFeatures )
{
if ( feat.hasGeometry() )
mExtent.unionRect( feat.geometry().boundingBox() );
mExtent.combineExtentWith( feat.geometry().boundingBox() );
}
}

@@ -249,7 +249,7 @@ void QgsGml::calculateExtentFromFeatures()
}
else
{
mExtent.unionRect( currentGeometry.boundingBox() );
mExtent.combineExtentWith( currentGeometry.boundingBox() );
}
}
}
@@ -523,7 +523,7 @@ QgsRectangle QgsMapSettings::fullExtent() const
QgsRectangle extent = layerExtentToOutputExtent( lyr, lyr->extent() );

QgsDebugMsg( "Output extent: " + extent.toString() );
fullExtent.unionRect( extent );
fullExtent.combineExtentWith( extent );
}
}

@@ -117,7 +117,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError *> &errors,
if ( QgsGeometryCheckerUtils::sharedEdgeLength( geom, geom2, QgsGeometryCheckPrecision::reducedTolerance() ) > 0 )
{
neighboringIds.insert( feature.id() );
gapAreaBBox.unionRect( geom2->boundingBox() );
gapAreaBBox.combineExtentWith( geom2->boundingBox() );
}
}
if ( neighboringIds.isEmpty() )
@@ -117,7 +117,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method )
if ( mFeaturePool->get( id, f ) )
{
recheckFeatures.insert( id );
recheckArea.unionRect( f.geometry().boundingBox() );
recheckArea.combineExtentWith( f.geometry().boundingBox() );
}
}
}
@@ -128,7 +128,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method )
{
if ( err->affectedAreaBBox().intersects( recheckArea ) )
{
recheckArea.unionRect( err->affectedAreaBBox() );
recheckArea.combineExtentWith( err->affectedAreaBBox() );
}
}
}
@@ -366,7 +366,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
}
else
{
totextent.unionRect( geomextent );
totextent.combineExtentWith( geomextent );
}
}
}
@@ -392,12 +392,12 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
extent.setXMaximum( extent.xMaximum() + diff.x() );
extent.setYMinimum( extent.yMinimum() + diff.y() );
extent.setYMaximum( extent.yMaximum() + diff.y() );
extent.unionRect( pointExtent );
extent.combineExtentWith( pointExtent );
totextent = extent;
}
else
{
totextent.unionRect( pointExtent );
totextent.combineExtentWith( pointExtent );
}
}

@@ -47,8 +47,8 @@ void TestQgsRectangle::manipulate()
QVERIFY( ! rect2.contains( rect1 ) );

// Create the union
rect3.unionRect( rect1 );
rect3.unionRect( rect2 );
rect3.combineExtentWith( rect1 );
rect3.combineExtentWith( rect2 );
// Check union
QVERIFY( rect3 == QgsRectangle( 1.0, 1.0, 7.0, 5.0 ) );
}
@@ -172,7 +172,7 @@ def testUnion(self):
self.assertEqual(myResult, myExpectedResult, myMessage)

rect1 = QgsRectangle(0.0, 0.0, 5.0, 5.0)
rect1.unionRect(rect2)
rect1.combineExtentWith(rect2)
myMessage = ('Expected: %s\nGot: %s\n' %
(True, rect1.contains(rect2)))
assert rect1.contains(rect2), myMessage

0 comments on commit 74ce555

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