mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-18 00:06:00 -04:00
Merge pull request #59092 from nyalldawson/pointxy_equality
Remove duplicate equality operator for QgsPointXY
This commit is contained in:
commit
e1a059b1da
@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
|
|||||||
.. versionadded:: 3.36
|
.. versionadded:: 3.36
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool operator==( const QgsPointXY &other ) /HoldGIL/;
|
bool operator==( const QgsPointXY &other ) const /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 *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
|
@ -220,7 +220,7 @@ Compares this point with another point with a fuzzy tolerance using distance com
|
|||||||
.. versionadded:: 3.36
|
.. versionadded:: 3.36
|
||||||
%End
|
%End
|
||||||
|
|
||||||
bool operator==( const QgsPointXY &other ) /HoldGIL/;
|
bool operator==( const QgsPointXY &other ) const /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 *
|
* This file has been generated automatically from *
|
||||||
* *
|
* *
|
||||||
|
@ -270,7 +270,7 @@ class CORE_EXPORT QgsPointXY
|
|||||||
return QgsGeometryUtilsBase::fuzzyDistanceEqual( epsilon, mX, mY, other.x(), other.y() );
|
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() )
|
if ( isEmpty() && other.isEmpty() )
|
||||||
return true;
|
return true;
|
||||||
@ -399,26 +399,6 @@ class CORE_EXPORT QgsPointXY
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE( 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
|
inline std::ostream &operator << ( std::ostream &os, const QgsPointXY &p ) SIP_SKIP
|
||||||
{
|
{
|
||||||
// Use Local8Bit for printouts
|
// Use Local8Bit for printouts
|
||||||
|
@ -1391,7 +1391,9 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e )
|
|||||||
mSnapMatch = context.snappingUtils->snapToMap( point, nullptr, true );
|
mSnapMatch = context.snappingUtils->snapToMap( point, nullptr, true );
|
||||||
if ( mSnapMatch.layer() )
|
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() ) )
|
|| ( mSnapMatch.hasEdge() && QgsProject::instance()->topologicalEditing() ) )
|
||||||
{
|
{
|
||||||
e->snapPoint();
|
e->snapPoint();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user