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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 26 03:52:46 EDT 2009


Author: mhugent
Date: 2009-08-26 03:52:46 -0400 (Wed, 26 Aug 2009)
New Revision: 11505

Modified:
   trunk/qgis/src/core/qgsgeometry.cpp
Log:
Fix for reshape of multilines

Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp	2009-08-26 00:43:54 UTC (rev 11504)
+++ trunk/qgis/src/core/qgsgeometry.cpp	2009-08-26 07:52:46 UTC (rev 11505)
@@ -3243,7 +3243,13 @@
     return 1;
   }
 
-  bool isMultiGeom = ( numGeoms > 1 );
+  bool isMultiGeom = false;
+  int geosTypeId = GEOSGeomTypeId( mGeos );
+  if ( geosTypeId == GEOS_MULTILINESTRING || geosTypeId == GEOS_MULTIPOLYGON )
+  {
+    isMultiGeom = true;
+  }
+
   bool isLine = ( type() == QGis::Line );
 
   //polygon or multipolygon?
@@ -3303,7 +3309,16 @@
     }
     GEOSGeom_destroy( reshapeLineGeos );
 
-    GEOSGeometry* newMultiGeom = GEOSGeom_createCollection( GEOS_MULTIPOLYGON, newGeoms, numGeoms );
+    GEOSGeometry* newMultiGeom = 0;
+    if ( isLine )
+    {
+      newMultiGeom = GEOSGeom_createCollection( GEOS_MULTILINESTRING, newGeoms, numGeoms );
+    }
+    else //multipolygon
+    {
+      newMultiGeom = GEOSGeom_createCollection( GEOS_MULTIPOLYGON, newGeoms, numGeoms );
+    }
+
     delete[] newGeoms;
     if ( ! newMultiGeom )
     {



More information about the QGIS-commit mailing list