Skip to content
Permalink
Browse files
is2DClosed -> isClosed2D and fix a typo
  • Loading branch information
lbartoletti authored and nyalldawson committed Jun 19, 2021
1 parent f3541e7 commit 6c85256ad613cbd3ef75e6a8034976b30bcb30f7
@@ -61,10 +61,10 @@ Returns the end point of the curve.
%Docstring
Returns ``True`` if the curve is closed.

.. seealso:: :py:func:`is2DClosed`
.. seealso:: :py:func:`isClosed2D`
%End

virtual bool is2DClosed() const /HoldGIL/;
virtual bool isClosed2D() const /HoldGIL/;
%Docstring
Returns true if the curve is closed.

@@ -422,7 +422,7 @@ segment in the line.

virtual bool isClosed() const /HoldGIL/;

virtual bool is2DClosed() const /HoldGIL/;
virtual bool isClosed2D() const /HoldGIL/;

virtual bool boundingBoxIntersects( const QgsRectangle &rectangle ) const /HoldGIL/;

@@ -37,7 +37,7 @@ bool QgsCurve::operator!=( const QgsAbstractGeometry &other ) const
return !operator==( other );
}

bool QgsCurve::is2DClosed() const
bool QgsCurve::isClosed2D() const
{
if ( numPoints() == 0 )
return false;
@@ -51,7 +51,7 @@ bool QgsCurve::is2DClosed() const
}
bool QgsCurve::isClosed() const
{
bool closed = is2DClosed();
bool closed = isClosed2D();
if ( is3D() && closed )
{
QgsPoint start = startPoint();
@@ -67,7 +67,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry
/**
* Returns TRUE if the curve is closed.
*
* \see is2DClosed()
* \see isClosed2D()
*/
virtual bool isClosed() const SIP_HOLDGIL;

@@ -80,7 +80,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry
*
* \since QGIS 3.20
*/
virtual bool is2DClosed() const SIP_HOLDGIL;
virtual bool isClosed2D() const SIP_HOLDGIL;

/**
* Returns TRUE if the curve is a ring.
@@ -363,7 +363,7 @@ bool QgsLineString::removeDuplicateNodes( double epsilon, bool useZValues )
return result;
}

bool QgsLineString::is2DClosed() const
bool QgsLineString::isClosed2D() const
{
if ( mX.empty() )
return false;
@@ -374,7 +374,7 @@ bool QgsLineString::is2DClosed() const

bool QgsLineString::isClosed() const
{
bool closed = is2DClosed();
bool closed = isClosed2D();

if ( is3D() && closed )
closed &= qgsDoubleNear( mZ.first(), mZ.last() ) || ( std::isnan( mZ.first() ) && std::isnan( mZ.last() ) );
@@ -589,7 +589,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
QgsLineString *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const override SIP_FACTORY;
bool removeDuplicateNodes( double epsilon = 4 * std::numeric_limits<double>::epsilon(), bool useZValues = false ) override;
bool isClosed() const override SIP_HOLDGIL;
bool is2DClosed() const override SIP_HOLDGIL;
bool isClosed2D() const override SIP_HOLDGIL;
bool boundingBoxIntersects( const QgsRectangle &rectangle ) const override SIP_HOLDGIL;

/**
@@ -102,7 +102,7 @@ void QgsGeometryValidator::validatePolyline( int i, const QgsLineString *line, b
QgsPoint startPoint = line->startPoint();
QgsPoint endPoint = line->endPoint();
QString msg;
if ( line->is3D() && line->is2DClosed() )
if ( line->is3D() && line->isClosed2D() )
{
msg = QObject::tr( "ring %1 not closed, Z mismatch: %2 vs %3" ).arg( i ).arg( startPoint.z() ).arg( endPoint.z() );
}
@@ -1694,13 +1694,13 @@ void TestQgsGeometry::circularString()

//isClosed
QgsCircularString l11;
QVERIFY( !l11.is2DClosed() );
QVERIFY( !l11.isClosed2D() );
QVERIFY( !l11.isClosed() );
l11.setPoints( QgsPointSequence() << QgsPoint( 1, 2 )
<< QgsPoint( 11, 2 )
<< QgsPoint( 11, 22 )
<< QgsPoint( 1, 22 ) );
QVERIFY( !l11.is2DClosed() );
QVERIFY( !l11.isClosed2D() );
QVERIFY( !l11.isClosed() );
QCOMPARE( l11.numPoints(), 4 );
QCOMPARE( l11.area(), 0.0 );
@@ -1711,17 +1711,17 @@ void TestQgsGeometry::circularString()
<< QgsPoint( QgsWkbTypes::PointM, 11, 2, 0, 4 )
<< QgsPoint( QgsWkbTypes::PointM, 11, 22, 0, 5 )
<< QgsPoint( QgsWkbTypes::PointM, 1, 2, 0, 6 ) );
QVERIFY( l11.is2DClosed() );
QVERIFY( l11.isClosed2D() );
QVERIFY( l11.isClosed() );

// test with z
l11.addZValue( 123.0 );
QVERIFY( l11.is2DClosed() );
QVERIFY( l11.isClosed2D() );
QVERIFY( l11.isClosed() );
QgsPoint pEnd = l11.endPoint();
pEnd.setZ( 234.0 );
l11.moveVertex( QgsVertexId( 0, 0, l11.numPoints() - 1 ), pEnd );
QVERIFY( l11.is2DClosed() );
QVERIFY( l11.isClosed2D() );
QVERIFY( !l11.isClosed() );

//polygonf
@@ -262,7 +262,7 @@ def test_ring_closed(self):
self.assertEqual(spy[0][0].where(), QgsPointXY(3, 3))
self.assertEqual(spy[0][0].what(), 'ring 2 not closed')

# not closed but 2d close
# not closed but 2d closed
g = QgsGeometry.fromWkt("POLYGONZ((1 1 0, 1 2 1, 2 2 2, 2 1 3, 1 1 4))")

validator = QgsGeometryValidator(g)

0 comments on commit 6c85256

Please sign in to comment.