Skip to content

Commit 83dc4cb

Browse files
committedMay 6, 2013
Merge pull request #577 from vinayan/sliverFix
[Fix #7714] ftools - Eliminate - improve performance with new vector api calls
2 parents 85a3a67 + 5e41382 commit 83dc4cb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed
 

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,13 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
163163
if inLayer.getFeatures( QgsFeatureRequest().setFilterFid( fid2Eliminate ).setSubsetOfAttributes([]) ).nextFeature( feat ):
164164
geom2Eliminate = feat.geometry()
165165
bbox = geom2Eliminate.boundingBox()
166-
outLayer.select(bbox, False) # make a new selection
166+
fit = outLayer.getFeatures( QgsFeatureRequest().setFilterRect( bbox ) )
167167
mergeWithFid = None
168168
mergeWithGeom = None
169169
max = 0
170-
171-
for selFid in outLayer.selectedFeaturesIds():
172-
selFeat = QgsFeature()
173-
174-
if outLayer.getFeatures( QgsFeatureRequest().setFilterFid( selFid ).setSubsetOfAttributes([]) ).nextFeature( selFeat ):
170+
171+
selFeat = QgsFeature()
172+
while fit.nextFeature(selFeat):
175173
selGeom = selFeat.geometry()
176174

177175
if geom2Eliminate.intersects(selGeom): # we have a candidate
@@ -188,7 +186,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
188186

189187
if selValue > max:
190188
max = selValue
191-
mergeWithFid = selFid
189+
mergeWithFid = selFeat.id()
192190
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry
193191

194192
if mergeWithFid != None: # a successful candidate
@@ -213,8 +211,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
213211
# end for fid2Eliminate
214212

215213
# deselect features that are already eliminated in inLayer
216-
for aFid in fidsToDeselect:
217-
inLayer.deselect(aFid, False)
214+
inLayer.deselect(fidsToDeselect)
218215

219216
#end while
220217

0 commit comments

Comments
 (0)
Please sign in to comment.