Skip to content
Permalink
Browse files

Avoid unneeded geometry cloning in QgsGeometry::nodeGeometries

Affects splitGeometry and reshapeGeometry public functions
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Oct 29, 2014
1 parent 8d7eb7d commit 4cf08c5c112278ab4f50cf21b735a4a58d6a98aa
Showing with 9 additions and 10 deletions.
  1. +9 −10 src/core/qgsgeometry.cpp
@@ -5221,18 +5221,17 @@ GEOSGeometry *QgsGeometry::nodeGeometries( const GEOSGeometry *splitLine, const
if ( !splitLine || !geom )
return 0;

GEOSGeometry *geometryBoundary = 0;
if ( GEOSGeomTypeId_r( geosinit.ctxt, geom ) == GEOS_POLYGON || GEOSGeomTypeId_r( geosinit.ctxt, geom ) == GEOS_MULTIPOLYGON )
geometryBoundary = GEOSBoundary_r( geosinit.ctxt, geom );
{
GEOSGeometry *geometryBoundary = GEOSBoundary_r( geosinit.ctxt, geom );
GEOSGeometry *unionGeometry = GEOSUnion_r( geosinit.ctxt, splitLine, geometryBoundary );
GEOSGeom_destroy_r( geosinit.ctxt, geometryBoundary );
return unionGeometry;
}
else
geometryBoundary = GEOSGeom_clone_r( geosinit.ctxt, geom );

GEOSGeometry *splitLineClone = GEOSGeom_clone_r( geosinit.ctxt, splitLine );
GEOSGeometry *unionGeometry = GEOSUnion_r( geosinit.ctxt, splitLineClone, geometryBoundary );
GEOSGeom_destroy_r( geosinit.ctxt, splitLineClone );

GEOSGeom_destroy_r( geosinit.ctxt, geometryBoundary );
return unionGeometry;
{
return GEOSUnion_r( geosinit.ctxt, splitLine, geom );
}
}

int QgsGeometry::lineContainedInLine( const GEOSGeometry* line1, const GEOSGeometry* line2 )

0 comments on commit 4cf08c5

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