Merge pull request #59092 from nyalldawson/pointxy_equality

Remove duplicate equality operator for QgsPointXY
This commit is contained in:
Denis Rouzaud 2024-10-15 14:32:46 +02:00 committed by GitHub
commit e1a059b1da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 26 deletions

View File

@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
.. versionadded:: 3.36
%End
bool operator==( const QgsPointXY &other ) /HoldGIL/;
bool operator==( const QgsPointXY &other ) const /HoldGIL/;
bool operator!=( const QgsPointXY &other ) const /HoldGIL/;
@ -290,7 +290,6 @@ Multiply x and y by the given value
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
.. versionadded:: 3.36
%End
bool operator==( const QgsPointXY &other ) /HoldGIL/;
bool operator==( const QgsPointXY &other ) const /HoldGIL/;
bool operator!=( const QgsPointXY &other ) const /HoldGIL/;
@ -290,7 +290,6 @@ Multiply x and y by the given value
/************************************************************************
* This file has been generated automatically from *
* *

View File

@ -270,7 +270,7 @@ class CORE_EXPORT QgsPointXY
return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, mX, mY, other.x(), other.y() );
}
bool operator==( const QgsPointXY &other ) SIP_HOLDGIL
bool operator==( const QgsPointXY &other ) const SIP_HOLDGIL
{
if ( isEmpty() && other.isEmpty() )
return true;
@ -399,26 +399,6 @@ class CORE_EXPORT QgsPointXY
Q_DECLARE_METATYPE( QgsPointXY )
inline bool operator==( const QgsPointXY &p1, const QgsPointXY &p2 ) SIP_SKIP
{
const bool nan1X = std::isnan( p1.x() );
const bool nan2X = std::isnan( p2.x() );
if ( nan1X != nan2X )
return false;
if ( !nan1X && !qgsDoubleNear( p1.x(), p2.x(), 1E-8 ) )
return false;
const bool nan1Y = std::isnan( p1.y() );
const bool nan2Y = std::isnan( p2.y() );
if ( nan1Y != nan2Y )
return false;
if ( !nan1Y && !qgsDoubleNear( p1.y(), p2.y(), 1E-8 ) )
return false;
return true;
}
inline std::ostream &operator << ( std::ostream &os, const QgsPointXY &p ) SIP_SKIP
{
// Use Local8Bit for printouts

View File

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