Skip to content

Commit 7b1b51a

Browse files
committed
Remove duplicate equality operator for QgsPointXY
We had two different(!!!!) implementations for equality operator for QgsPointXY, with different logic (one handled empty points, the other didn't). This compiled only because one was not marked as const. So we'd get a DIFFERENT equality check logic depending on whether or not the first point was const... eeek! Remove the duplicate one, mark the better one as const
1 parent 89d8343 commit 7b1b51a

File tree

3 files changed

+3
-25
lines changed

3 files changed

+3
-25
lines changed

python/PyQt6/core/auto_generated/qgspointxy.sip.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
220220
.. versionadded:: 3.36
221221
%End
222222

223-
bool operator==( const QgsPointXY &other ) /HoldGIL/;
223+
bool operator==( const QgsPointXY &other ) const /HoldGIL/;
224224

225225
bool operator!=( const QgsPointXY &other ) const /HoldGIL/;
226226

@@ -290,7 +290,6 @@ Multiply x and y by the given value
290290

291291

292292

293-
294293
/************************************************************************
295294
* This file has been generated automatically from *
296295
* *

python/core/auto_generated/qgspointxy.sip.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
220220
.. versionadded:: 3.36
221221
%End
222222

223-
bool operator==( const QgsPointXY &other ) /HoldGIL/;
223+
bool operator==( const QgsPointXY &other ) const /HoldGIL/;
224224

225225
bool operator!=( const QgsPointXY &other ) const /HoldGIL/;
226226

@@ -290,7 +290,6 @@ Multiply x and y by the given value
290290

291291

292292

293-
294293
/************************************************************************
295294
* This file has been generated automatically from *
296295
* *

src/core/qgspointxy.h

+1-21
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class CORE_EXPORT QgsPointXY
270270
return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, mX, mY, other.x(), other.y() );
271271
}
272272

273-
bool operator==( const QgsPointXY &other ) SIP_HOLDGIL
273+
bool operator==( const QgsPointXY &other ) const SIP_HOLDGIL
274274
{
275275
if ( isEmpty() && other.isEmpty() )
276276
return true;
@@ -399,26 +399,6 @@ class CORE_EXPORT QgsPointXY
399399

400400
Q_DECLARE_METATYPE( QgsPointXY )
401401

402-
inline bool operator==( const QgsPointXY &p1, const QgsPointXY &p2 ) SIP_SKIP
403-
{
404-
const bool nan1X = std::isnan( p1.x() );
405-
const bool nan2X = std::isnan( p2.x() );
406-
if ( nan1X != nan2X )
407-
return false;
408-
if ( !nan1X && !qgsDoubleNear( p1.x(), p2.x(), 1E-8 ) )
409-
return false;
410-
411-
const bool nan1Y = std::isnan( p1.y() );
412-
const bool nan2Y = std::isnan( p2.y() );
413-
if ( nan1Y != nan2Y )
414-
return false;
415-
416-
if ( !nan1Y && !qgsDoubleNear( p1.y(), p2.y(), 1E-8 ) )
417-
return false;
418-
419-
return true;
420-
}
421-
422402
inline std::ostream &operator << ( std::ostream &os, const QgsPointXY &p ) SIP_SKIP
423403
{
424404
// Use Local8Bit for printouts

0 commit comments

Comments
 (0)