Skip to content

Commit

Permalink
replace old select calls with getFeatures method
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayan committed May 5, 2013
1 parent d3f9dd5 commit 5e41382
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions python/plugins/fTools/tools/doEliminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 5e41382

Please sign in to comment.