Skip to content

Commit 3dadc22

Browse files
ahuarte47nyalldawson
authored andcommitted
Extra simple fast check of types in equality methods of geometry
1 parent d182cf2 commit 3dadc22

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/core/geometry/qgsgeometry.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,10 @@ bool QgsGeometry::equals( const QgsGeometry &geometry ) const
12301230
if ( d == geometry.d )
12311231
return true;
12321232

1233+
// fast check - distinct geometry types?
1234+
if ( type() != geometry.type() )
1235+
return false;
1236+
12331237
// slower check - actually test the geometries
12341238
return *d->geometry == *geometry.d->geometry;
12351239
}
@@ -2604,6 +2608,10 @@ bool QgsGeometry::isGeosEqual( const QgsGeometry &g ) const
26042608
if ( d == g.d )
26052609
return true;
26062610

2611+
// fast check - distinct geometry types?
2612+
if ( type() != g.type() )
2613+
return false;
2614+
26072615
// avoid calling geos for trivial point case
26082616
if ( QgsWkbTypes::flatType( d->geometry->wkbType() ) == QgsWkbTypes::Point
26092617
&& QgsWkbTypes::flatType( g.d->geometry->wkbType() ) == QgsWkbTypes::Point )

0 commit comments

Comments
 (0)