Skip to content

Commit

Permalink
Drop the temporary QgsRectangle::createNull static, not more needed
Browse files Browse the repository at this point in the history
  • Loading branch information
strk authored and nyalldawson committed Oct 23, 2023
1 parent 376f979 commit f426999
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 21 deletions.
1 change: 0 additions & 1 deletion python/core/auto_generated/geometry/qgsrectangle.sip.in
Expand Up @@ -59,7 +59,6 @@ Copy constructor

~QgsRectangle();


static QgsRectangle fromWkt( const QString &wkt );
%Docstring
Creates a new rectangle from a ``wkt`` string.
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometry.cpp
Expand Up @@ -1204,7 +1204,7 @@ QgsRectangle QgsGeometry::boundingBox() const
{
return d->geometry->boundingBox();
}
return QgsRectangle::createNull();
return QgsRectangle();
}

QgsBox3D QgsGeometry::boundingBox3D() const
Expand Down
16 changes: 0 additions & 16 deletions src/core/geometry/qgsrectangle.h
Expand Up @@ -99,22 +99,6 @@ class CORE_EXPORT QgsRectangle
// see https://github.com/qgis/QGIS/pull/4720#issuecomment-308652392
~QgsRectangle() = default;

/**
* Creates a null rectangle.
*
* This is a temporary method to use while the default
* constructor is still not constructing a null rectangle.
*
* \since QGIS 3.34
*/
static QgsRectangle createNull() SIP_SKIP
{
// TODO: remove this method once the default constructor gives a null
QgsRectangle rectNull;
rectNull.setNull(); // TODO: have setNull() return *this ?
return rectNull;
}

/**
* Creates a new rectangle from a \a wkt string.
* The WKT must contain only 5 vertices, representing a rectangle aligned with X and Y axes.
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/geometry/testqgsgeometry.cpp
Expand Up @@ -837,7 +837,7 @@ void TestQgsGeometry::fromPolyline()

void TestQgsGeometry::fromRect()
{
QgsRectangle rectNull = QgsRectangle::createNull();
QgsRectangle rectNull;

QgsGeometry fromRect = QgsGeometry::fromRect( rectNull );
QVERIFY( fromRect.isNull() );
Expand Down Expand Up @@ -2183,7 +2183,7 @@ void TestQgsGeometry::orientedMinimumBoundingBox()
void TestQgsGeometry::boundingBox()
{
QgsGeometry geomTest;
QgsRectangle nullRect = QgsRectangle::createNull();
QgsRectangle nullRect;
QCOMPARE( geomTest.boundingBox(), nullRect );

geomTest = QgsGeometry::fromWkt( QStringLiteral( "LINESTRING(-1 -2, 4 5)" ) );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/providers/testqgsvirtuallayerprovider.cpp
Expand Up @@ -83,7 +83,7 @@ void TestQgsVirtualLayerProvider::testConstructor()
QString uri;
std::unique_ptr<QgsVectorDataProvider> prov( new QgsVirtualLayerProvider( uri, opts ) );

const QgsRectangle rectNull = QgsRectangle::createNull();
const QgsRectangle rectNull;
QCOMPARE( prov->sourceExtent(), rectNull );
}

Expand Down

0 comments on commit f426999

Please sign in to comment.