Skip to content

Commit dd0bb8c

Browse files
authoredJun 11, 2017
Merge pull request #4713 from nyalldawson/rect_api
Remove duplicate QgsRectangle::unionRect method
2 parents 1034131 + 74ce555 commit dd0bb8c

File tree

12 files changed

+13
-34
lines changed

12 files changed

+13
-34
lines changed
 

‎doc/api_break.dox

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,7 @@ QgsRectangle {#qgis_api_break_3_0_QgsRectangle}
19271927
------------
19281928

19291929
- The protected members were removed - QgsRectangle is not intended to be subclassed.
1930+
- unionRect was removed. Use combineExtentWith instead.
19301931

19311932
QgsRelation {#qgis_api_break_3_0_QgsRelation}
19321933
-----------

‎python/core/geometry/qgsrectangle.sip

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,6 @@ Copy constructor
267267
%End
268268

269269

270-
void unionRect( const QgsRectangle &rect );
271-
%Docstring
272-
Updates the rectangle to include another rectangle.
273-
%End
274-
275270
bool isFinite() const;
276271
%Docstring
277272
Returns true if the rectangle has finite boundaries. Will

‎src/core/geometry/qgsrectangle.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,18 +342,6 @@ QgsRectangle &QgsRectangle::operator=( const QgsRectangle &r )
342342
return *this;
343343
}
344344

345-
void QgsRectangle::unionRect( const QgsRectangle &r )
346-
{
347-
if ( r.xMinimum() < xMinimum() )
348-
setXMinimum( r.xMinimum() );
349-
if ( r.xMaximum() > xMaximum() )
350-
setXMaximum( r.xMaximum() );
351-
if ( r.yMinimum() < yMinimum() )
352-
setYMinimum( r.yMinimum() );
353-
if ( r.yMaximum() > yMaximum() )
354-
setYMaximum( r.yMaximum() );
355-
}
356-
357345
bool QgsRectangle::isFinite() const
358346
{
359347
if ( qIsInf( mXmin ) || qIsInf( mYmin ) || qIsInf( mXmax ) || qIsInf( mYmax ) )

‎src/core/geometry/qgsrectangle.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,6 @@ class CORE_EXPORT QgsRectangle
259259
*/
260260
QgsRectangle &operator=( const QgsRectangle &r1 );
261261

262-
/**
263-
* Updates the rectangle to include another rectangle.
264-
*/
265-
void unionRect( const QgsRectangle &rect );
266-
267262
/**
268263
* Returns true if the rectangle has finite boundaries. Will
269264
* return false if any of the rectangle boundaries are NaN or Inf.

‎src/core/providers/memory/qgsmemoryprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ QgsRectangle QgsMemoryProvider::extent() const
278278
Q_FOREACH ( const QgsFeature &feat, mFeatures )
279279
{
280280
if ( feat.hasGeometry() )
281-
mExtent.unionRect( feat.geometry().boundingBox() );
281+
mExtent.combineExtentWith( feat.geometry().boundingBox() );
282282
}
283283
}
284284

‎src/core/qgsgml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void QgsGml::calculateExtentFromFeatures()
249249
}
250250
else
251251
{
252-
mExtent.unionRect( currentGeometry.boundingBox() );
252+
mExtent.combineExtentWith( currentGeometry.boundingBox() );
253253
}
254254
}
255255
}

‎src/core/qgsmapsettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ QgsRectangle QgsMapSettings::fullExtent() const
523523
QgsRectangle extent = layerExtentToOutputExtent( lyr, lyr->extent() );
524524

525525
QgsDebugMsg( "Output extent: " + extent.toString() );
526-
fullExtent.unionRect( extent );
526+
fullExtent.combineExtentWith( extent );
527527
}
528528
}
529529

‎src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError *> &errors,
117117
if ( QgsGeometryCheckerUtils::sharedEdgeLength( geom, geom2, QgsGeometryCheckPrecision::reducedTolerance() ) > 0 )
118118
{
119119
neighboringIds.insert( feature.id() );
120-
gapAreaBBox.unionRect( geom2->boundingBox() );
120+
gapAreaBBox.combineExtentWith( geom2->boundingBox() );
121121
}
122122
}
123123
if ( neighboringIds.isEmpty() )

‎src/plugins/geometry_checker/qgsgeometrychecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method )
117117
if ( mFeaturePool->get( id, f ) )
118118
{
119119
recheckFeatures.insert( id );
120-
recheckArea.unionRect( f.geometry().boundingBox() );
120+
recheckArea.combineExtentWith( f.geometry().boundingBox() );
121121
}
122122
}
123123
}
@@ -128,7 +128,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError *error, int method )
128128
{
129129
if ( err->affectedAreaBBox().intersects( recheckArea ) )
130130
{
131-
recheckArea.unionRect( err->affectedAreaBBox() );
131+
recheckArea.combineExtentWith( err->affectedAreaBBox() );
132132
}
133133
}
134134
}

‎src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
366366
}
367367
else
368368
{
369-
totextent.unionRect( geomextent );
369+
totextent.combineExtentWith( geomextent );
370370
}
371371
}
372372
}
@@ -392,12 +392,12 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
392392
extent.setXMaximum( extent.xMaximum() + diff.x() );
393393
extent.setYMinimum( extent.yMinimum() + diff.y() );
394394
extent.setYMaximum( extent.yMaximum() + diff.y() );
395-
extent.unionRect( pointExtent );
395+
extent.combineExtentWith( pointExtent );
396396
totextent = extent;
397397
}
398398
else
399399
{
400-
totextent.unionRect( pointExtent );
400+
totextent.combineExtentWith( pointExtent );
401401
}
402402
}
403403

‎tests/src/core/testqgsrectangle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ void TestQgsRectangle::manipulate()
4747
QVERIFY( ! rect2.contains( rect1 ) );
4848

4949
// Create the union
50-
rect3.unionRect( rect1 );
51-
rect3.unionRect( rect2 );
50+
rect3.combineExtentWith( rect1 );
51+
rect3.combineExtentWith( rect2 );
5252
// Check union
5353
QVERIFY( rect3 == QgsRectangle( 1.0, 1.0, 7.0, 5.0 ) );
5454
}

‎tests/src/python/test_qgsrectangle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def testUnion(self):
172172
self.assertEqual(myResult, myExpectedResult, myMessage)
173173

174174
rect1 = QgsRectangle(0.0, 0.0, 5.0, 5.0)
175-
rect1.unionRect(rect2)
175+
rect1.combineExtentWith(rect2)
176176
myMessage = ('Expected: %s\nGot: %s\n' %
177177
(True, rect1.contains(rect2)))
178178
assert rect1.contains(rect2), myMessage

0 commit comments

Comments
 (0)
Please sign in to comment.