Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Extra simple fast check of types in equality methods of geometry
(cherry picked from commit 3dadc22)
  • Loading branch information
ahuarte47 authored and nirvn committed Dec 6, 2019
1 parent 1f818ad commit ff905ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -1230,6 +1230,10 @@ bool QgsGeometry::equals( const QgsGeometry &geometry ) const
if ( d == geometry.d )
return true;

// fast check - distinct geometry types?
if ( type() != geometry.type() )
return false;

// slower check - actually test the geometries
return *d->geometry == *geometry.d->geometry;
}
Expand Down Expand Up @@ -2604,6 +2608,10 @@ bool QgsGeometry::isGeosEqual( const QgsGeometry &g ) const
if ( d == g.d )
return true;

// fast check - distinct geometry types?
if ( type() != g.type() )
return false;

// avoid calling geos for trivial point case
if ( QgsWkbTypes::flatType( d->geometry->wkbType() ) == QgsWkbTypes::Point
&& QgsWkbTypes::flatType( g.d->geometry->wkbType() ) == QgsWkbTypes::Point )
Expand Down

0 comments on commit ff905ff

Please sign in to comment.