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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Apr 17 01:30:55 EDT 2008


Author: mhugent
Date: 2008-04-17 01:30:54 -0400 (Thu, 17 Apr 2008)
New Revision: 8357

Modified:
   trunk/qgis/src/core/qgsgeometry.cpp
Log:
Fix problem where multipolyons changed to polygons in QgsGeometry::makeDifference (bug 968)

Modified: trunk/qgis/src/core/qgsgeometry.cpp
===================================================================
--- trunk/qgis/src/core/qgsgeometry.cpp	2008-04-17 02:18:54 UTC (rev 8356)
+++ trunk/qgis/src/core/qgsgeometry.cpp	2008-04-17 05:30:54 UTC (rev 8357)
@@ -525,6 +525,12 @@
 
 QGis::VectorType QgsGeometry::vectorType()
 {
+  if (mDirtyWkb)
+    {
+      // convert from GEOS
+      exportGeosToWkb();
+    }
+
   QGis::WKBTYPE type = wkbType();
   if (type == QGis::WKBPoint || type == QGis::WKBPoint25D ||
       type == QGis::WKBMultiPoint || type == QGis::WKBMultiPoint25D)
@@ -541,6 +547,12 @@
 
 bool QgsGeometry::isMultipart()
 {
+  if (mDirtyWkb)
+    {
+      // convert from GEOS
+      exportGeosToWkb();
+    }
+
   QGis::WKBTYPE type = wkbType();
   if (type == QGis::WKBMultiPoint ||
       type == QGis::WKBMultiPoint25D ||
@@ -3020,7 +3032,17 @@
   {
     if(mGeos->intersects(other->mGeos))
     {
+      //check if multitype before and after
+      bool multiType = isMultipart();
+ 
       mGeos = mGeos->difference(other->mGeos);
+      mDirtyWkb = true;
+
+      if(multiType && !isMultipart())
+	{
+	  convertToMultiType();
+	  exportWkbToGeos();
+	}
     }
     else
     {
@@ -3035,8 +3057,6 @@
     return 6;
   }
 
-  //set wkb dirty to true
-  mDirtyWkb = true;
   return 0;
 }
 



More information about the QGIS-commit mailing list