Skip to content
Permalink
Browse files

fix r14462

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14465 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Oct 31, 2010
1 parent 2bb0aa8 commit 3f1cc0df3170030f3188228e6472d9a3c406429a
Showing with 17 additions and 36 deletions.
  1. +7 −6 python/core/qgsgeometry.sip
  2. +10 −30 python/plugins/fTools/tools/doVisual.py
@@ -378,16 +378,17 @@ not disjoint with existing polygons of the feature*/

class Error
{
Error( QString m );
Error( QString m, QgsPoint p );
QString what();
QgsPoint where();
bool hasWhere();
public:
Error( QString m );
Error( QString m, QgsPoint p );
QString what();
QgsPoint where();
bool hasWhere();
};

/** Validate geometry and produce a list of geometry errors
* @note python binding added in 1.6
**/
void validateGeometry( QList<QgsGeometry::Error> &errors );
void validateGeometry( QList<QgsGeometry::Error> &errors /Out/ );
}; // class QgsGeometry

@@ -441,36 +441,16 @@ def check_geometry( self, vlayer ):
geom = QgsGeometry( feat.geometry() )
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
nElement += 1
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

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() ) )

self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nFeat )
return ( lstErrors, count )

0 comments on commit 3f1cc0d

Please sign in to comment.
You can’t perform that action at this time.