Skip to content

Commit e1a059b

Browse files
authored
Merge pull request qgis#59092 from nyalldawson/pointxy_equality
Remove duplicate equality operator for QgsPointXY
2 parents 1431d2c + d651383 commit e1a059b

File tree

4 files changed

+6
-26
lines changed

4 files changed

+6
-26
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

src/gui/qgsadvanceddigitizingdockwidget.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,9 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
13911391
mSnapMatch = context.snappingUtils->snapToMap( point, nullptr, true );
13921392
if ( mSnapMatch.layer() )
13931393
{
1394-
if ( ( ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) && ( point == mSnapMatch.point() ) )
1394+
// note ND: I'm not 100% sure if the point == mSnapMatch.point() comparison was intended be done using QgsPointXY or QgsPoint objects here!
1395+
// I'm using QgsPointXY here to keep the behavior the same from before a duplicate QgsPointXY == operator was removed...
1396+
if ( ( ( mSnapMatch.hasVertex() || mSnapMatch.hasLineEndpoint() ) && ( QgsPointXY( point ) == mSnapMatch.point() ) )
13951397
|| ( mSnapMatch.hasEdge() && QgsProject::instance()->topologicalEditing() ) )
13961398
{
13971399
e->snapPoint();

0 commit comments

Comments
 (0)