Skip to content

Commit 7f2b541

Browse files
author
jef
committed
fix r14462
git-svn-id: http://svn.osgeo.org/qgis/trunk@14465 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 40b7172 commit 7f2b541

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

python/core/qgsgeometry.sip

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,17 @@ not disjoint with existing polygons of the feature*/
378378

379379
class Error
380380
{
381-
Error( QString m );
382-
Error( QString m, QgsPoint p );
383-
QString what();
384-
QgsPoint where();
385-
bool hasWhere();
381+
public:
382+
Error( QString m );
383+
Error( QString m, QgsPoint p );
384+
QString what();
385+
QgsPoint where();
386+
bool hasWhere();
386387
};
387388

388389
/** Validate geometry and produce a list of geometry errors
389390
* @note python binding added in 1.6
390391
**/
391-
void validateGeometry( QList<QgsGeometry::Error> &errors );
392+
void validateGeometry( QList<QgsGeometry::Error> &errors /Out/ );
392393
}; // class QgsGeometry
393394

python/plugins/fTools/tools/doVisual.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -441,36 +441,16 @@ def check_geometry( self, vlayer ):
441441
geom = QgsGeometry( feat.geometry() )
442442
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
443443
nElement += 1
444-
if geom.isMultipart():
445-
polygons = geom.asMultiPolygon()
446-
for polygon in polygons:
447-
if not self.isHoleNested( polygon ):
448-
lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
449-
count += 1
450-
if not self.isPolygonClosed( polygon ):
451-
lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
452-
count += 1
453-
if self.isSelfIntersecting( polygon ):
454-
lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
455-
count += 1
456-
if not self.isCorrectOrientation( polygon ):
457-
lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
458-
count += 1
459-
460-
else:
461-
geom = geom.asPolygon()
462-
if not self.isHoleNested( geom ):
463-
lstErrors.append( self.tr( "Feature %1 contains an unnested hole" ).arg( unicode( feat.id() ) ) )
464-
count += 1
465-
if not self.isPolygonClosed( geom ):
466-
lstErrors.append( self.tr( "Feature %1 is not closed" ).arg( unicode( feat.id() ) ) )
467-
count += 1
468-
if self.isSelfIntersecting( geom ):
469-
lstErrors.append( self.tr( "Feature %1 is self intersecting" ).arg( unicode( feat.id() ) ) )
470-
count += 1
471-
if not self.isCorrectOrientation( geom ):
472-
lstErrors.append( self.tr( "Feature %1 has incorrect node ordering" ).arg( unicode( feat.id() ) ) )
473-
count += 1
444+
445+
errors = geom.validateGeometry()
446+
if len(errors) > 0:
447+
lstErrors.append( self.tr( "Feature %1 has %2 errors:" ).arg( feat.id() ).arg( uni
448+
for e in errors:
449+
if e.hasWhere():
450+
lstErrors.append( self.tr( "Feature %1: %2 [%3]" ).arg( feat.id() ).arg( e.what() ).arg( e.where() ) )
451+
else:
452+
lstErrors.append( self.tr( "Feature %1: %2 [%3]" ).arg( feat.id() ).arg( e.what() ).arg( e.where() ) )
453+
474454
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nFeat )
475455
return ( lstErrors, count )
476456

0 commit comments

Comments
 (0)