Skip to content

Commit 73c0a75

Browse files
author
mhugent
committed
Fix for ticket 1201, invalid split if line ends in polygon
git-svn-id: http://svn.osgeo.org/qgis/trunk@9490 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 44ed7f9 commit 73c0a75

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/core/qgsgeometry.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4882,9 +4882,25 @@ int QgsGeometry::splitPolygonGeometry( GEOSGeometry* splitLine, QList<QgsGeometr
48824882
GEOSGeom_destroy( intersectGeometry );
48834883
}
48844884

4885+
bool splitDone = true;
4886+
int nGeometriesThis = GEOSGetNumGeometries(mGeos); //original number of geometries
4887+
if(testedGeometries.size() == nGeometriesThis)
4888+
{
4889+
splitDone = false;
4890+
}
4891+
48854892
mergeGeometriesMultiTypeSplit( testedGeometries );
48864893

4887-
if ( testedGeometries.size() > 0 )
4894+
//no split done, preserve original geometry
4895+
if(!splitDone)
4896+
{
4897+
for(int i = 0; i < testedGeometries.size(); ++i)
4898+
{
4899+
GEOSGeom_destroy(testedGeometries[i]);
4900+
}
4901+
return 1;
4902+
}
4903+
else if(testedGeometries.size() > 0) //split successfull
48884904
{
48894905
GEOSGeom_destroy( mGeos );
48904906
mGeos = testedGeometries[0];

0 commit comments

Comments
 (0)