Skip to content
Permalink
Browse files

Compare Z and M values in QgsPoint::operator== only when required

  • Loading branch information
m-kuhn committed Jun 14, 2017
1 parent 1808dc9 commit bd82ca316be5a4e3e6c801e7e474b73dbc0f3bce
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/core/geometry/qgspoint.cpp
@@ -95,11 +95,17 @@ QgsPoint::QgsPoint( QgsWkbTypes::Type wkbType, double x, double y, double z, dou

bool QgsPoint::operator==( const QgsPoint &pt ) const
{
return ( pt.wkbType() == wkbType() &&
qgsDoubleNear( pt.x(), mX, 1E-8 ) &&
qgsDoubleNear( pt.y(), mY, 1E-8 ) &&
qgsDoubleNear( pt.z(), mZ, 1E-8 ) &&
qgsDoubleNear( pt.m(), mM, 1E-8 ) );
const QgsWkbTypes::Type type = wkbType();

bool equal = pt.wkbType() == type;
equal &= qgsDoubleNear( pt.x(), mX, 1E-8 );
equal &= qgsDoubleNear( pt.y(), mY, 1E-8 );
if ( QgsWkbTypes::hasZ( type ) )
equal &= qgsDoubleNear( pt.z(), mZ, 1E-8 );
if ( QgsWkbTypes::hasM( type ) )
equal &= qgsDoubleNear( pt.m(), mM, 1E-8 );

return equal;
}

bool QgsPoint::operator!=( const QgsPoint &pt ) const

0 comments on commit bd82ca3

Please sign in to comment.
You can’t perform that action at this time.