[QGIS Commit] r14466 - trunk/qgis/python/plugins/fTools/tools

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Oct 31 14:04:50 EDT 2010


Author: jef
Date: 2010-10-31 11:04:50 -0700 (Sun, 31 Oct 2010)
New Revision: 14466

Modified:
   trunk/qgis/python/plugins/fTools/tools/doVisual.py
Log:
rollback accidentally commit file of r14465

Modified: trunk/qgis/python/plugins/fTools/tools/doVisual.py
===================================================================
--- trunk/qgis/python/plugins/fTools/tools/doVisual.py	2010-10-31 17:56:42 UTC (rev 14465)
+++ trunk/qgis/python/plugins/fTools/tools/doVisual.py	2010-10-31 18:04:50 UTC (rev 14466)
@@ -441,16 +441,36 @@
       geom = QgsGeometry( feat.geometry() )
       self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
       nElement += 1
-
-      errors = geom.validateGeometry()
-      if len(errors) > 0:
-        lstErrors.append( self.tr( "Feature %1 has %2 errors:" ).arg( feat.id() ).arg( uni
-	for e in errors:
-	  if e.hasWhere():
-	    lstErrors.append( self.tr( "Feature %1: %2 [%3]" ).arg( feat.id() ).arg( e.what() ).arg( e.where() ) )
-          else:
-	    lstErrors.append( self.tr( "Feature %1: %2 [%3]" ).arg( feat.id() ).arg( e.what() ).arg( e.where() ) )
-
+      if geom.isMultipart():
+        polygons = geom.asMultiPolygon()
+        for polygon in polygons:
+          if not self.isHoleNested( polygon ):
+            lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
+            count += 1
+          if not self.isPolygonClosed( polygon ):
+            lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
+            count += 1
+          if self.isSelfIntersecting( polygon ):
+            lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
+            count += 1
+          if not self.isCorrectOrientation( polygon ):
+            lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
+            count += 1
+          
+      else:
+        geom = geom.asPolygon()
+        if not self.isHoleNested( geom ):
+          lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
+          count += 1
+        if not self.isPolygonClosed( geom ):
+          lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
+          count += 1
+        if self.isSelfIntersecting( geom ):
+          lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
+          count += 1
+        if not self.isCorrectOrientation( geom ):
+          lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
+          count += 1
     self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nFeat )
     return ( lstErrors, count )
 



More information about the QGIS-commit mailing list