Skip to content

Commit a87033d

Browse files
author
jef
committedJun 30, 2010

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

‎python/plugins/fTools/tools/doVisual.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def visual( self, myLayer, myField, mySelection ):
112112
self.tblUnique.setRowCount( 0 )
113113
self.lstCount.clear()
114114
self.buttonOk.setEnabled( False )
115+
115116
self.testThread = visualThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myField, mySelection )
116117
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
117118
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
@@ -120,15 +121,20 @@ def visual( self, myLayer, myField, mySelection ):
120121
QObject.connect( self.testThread, SIGNAL( "runPartStatus(PyQt_PyObject)" ), self.runPartStatusFromThread )
121122
self.cancel_close.setText( self.tr("Cancel") )
122123
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
124+
125+
QApplication.setOverrideCursor( Qt.WaitCursor )
123126
self.testThread.start()
124127
return True
125128

126129
def cancelThread( self ):
127130
self.testThread.stop()
131+
QApplication.restoreOverrideCursor()
128132
self.buttonOk.setEnabled( True )
133+
QApplication.restoreOverrideCursor()
129134

130135
def runFinishedFromThread( self, output ):
131136
self.testThread.stop()
137+
QApplication.restoreOverrideCursor()
132138
self.buttonOk.setEnabled( True )
133139
result = output[ 0 ]
134140
numRows = len( result )
@@ -429,8 +435,8 @@ def check_geometry( self, vlayer ):
429435

430436
while vprovider.nextFeature( feat ):
431437
geom = QgsGeometry( feat.geometry() )
432-
nElement += 1
433438
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
439+
nElement += 1
434440
if geom.isMultipart():
435441
polygons = geom.asMultiPolygon()
436442
for polygon in polygons:
@@ -502,10 +508,11 @@ def isSelfIntersecting( self, polygon ):
502508
self.emit( SIGNAL( "runPartStatus(PyQt_PyObject)" ), nPart )
503509

504510
count = 0
505-
for j in range( i, len(h)-1 ):
511+
for j in range( i+1, len(h)-1 ):
506512
if QgsGeometry().fromPolyline( [ h[ i ], h[ i + 1 ] ] ).intersects( QgsGeometry().fromPolyline( [ h[ j ], h[ j + 1 ] ] ) ):
507513
count += 1
508-
if count > 2:
514+
515+
if (i==0 and count>2) or (i>0 and count>1):
509516
self.emit( SIGNAL( "runPartStatus(PyQt_PyObject)" ), cPart )
510517
return True
511518

0 commit comments

Comments
 (0)
Please sign in to comment.