Skip to content
Permalink
Browse files

Merge pull request #577 from vinayan/sliverFix

[Fix #7714] ftools - Eliminate - improve performance with new vector api calls
  • Loading branch information
vinayan committed May 6, 2013
2 parents 85a3a67 + 5e41382 commit 83dc4cb914c3e0f3612f190633191aea94e52c88
Showing with 6 additions and 9 deletions.
  1. +6 −9 python/plugins/fTools/tools/doEliminate.py
@@ -163,15 +163,13 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
if inLayer.getFeatures( QgsFeatureRequest().setFilterFid( fid2Eliminate ).setSubsetOfAttributes([]) ).nextFeature( feat ):
geom2Eliminate = feat.geometry()
bbox = geom2Eliminate.boundingBox()
outLayer.select(bbox, False) # make a new selection
fit = outLayer.getFeatures( QgsFeatureRequest().setFilterRect( bbox ) )
mergeWithFid = None
mergeWithGeom = None
max = 0

for selFid in outLayer.selectedFeaturesIds():
selFeat = QgsFeature()

if outLayer.getFeatures( QgsFeatureRequest().setFilterFid( selFid ).setSubsetOfAttributes([]) ).nextFeature( selFeat ):

selFeat = QgsFeature()
while fit.nextFeature(selFeat):
selGeom = selFeat.geometry()

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

if selValue > max:
max = selValue
mergeWithFid = selFid
mergeWithFid = selFeat.id()
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry

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

# deselect features that are already eliminated in inLayer
for aFid in fidsToDeselect:
inLayer.deselect(aFid, False)
inLayer.deselect(fidsToDeselect)

#end while

0 comments on commit 83dc4cb

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