[QGIS Commit] r9490 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Oct 17 09:29:18 EDT 2008


Author: mhugent
Date: 2008-10-17 09:29:17 -0400 (Fri, 17 Oct 2008)
New Revision: 9490

Modified:
   trunk/qgis/src/core/qgsgeometry.cpp
Log:
Fix for ticket 1201, invalid split if line ends in polygon

Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp	2008-10-17 12:10:11 UTC (rev 9489)
+++ trunk/qgis/src/core/qgsgeometry.cpp	2008-10-17 13:29:17 UTC (rev 9490)
@@ -4882,9 +4882,25 @@
     GEOSGeom_destroy( intersectGeometry );
   }
 
+  bool splitDone = true;
+  int nGeometriesThis = GEOSGetNumGeometries(mGeos); //original number of geometries
+  if(testedGeometries.size() == nGeometriesThis)
+    {
+      splitDone = false;
+    }
+
   mergeGeometriesMultiTypeSplit( testedGeometries );
 
-  if ( testedGeometries.size() > 0 )
+  //no split done, preserve original geometry
+  if(!splitDone)
+    {
+      for(int i = 0; i < testedGeometries.size(); ++i)
+	{
+	  GEOSGeom_destroy(testedGeometries[i]);
+	}
+      return 1;
+    }
+  else if(testedGeometries.size() > 0) //split successfull
   {
     GEOSGeom_destroy( mGeos );
     mGeos = testedGeometries[0];



More information about the QGIS-commit mailing list