mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
replace old select calls with getFeatures method
This commit is contained in:
parent
d3f9dd5dc4
commit
5e4138261c
@ -163,15 +163,13 @@ class Dialog(QtGui.QDialog, Ui_Dialog):
|
|||||||
if inLayer.getFeatures( QgsFeatureRequest().setFilterFid( fid2Eliminate ).setSubsetOfAttributes([]) ).nextFeature( feat ):
|
if inLayer.getFeatures( QgsFeatureRequest().setFilterFid( fid2Eliminate ).setSubsetOfAttributes([]) ).nextFeature( feat ):
|
||||||
geom2Eliminate = feat.geometry()
|
geom2Eliminate = feat.geometry()
|
||||||
bbox = geom2Eliminate.boundingBox()
|
bbox = geom2Eliminate.boundingBox()
|
||||||
outLayer.select(bbox, False) # make a new selection
|
fit = outLayer.getFeatures( QgsFeatureRequest().setFilterRect( bbox ) )
|
||||||
mergeWithFid = None
|
mergeWithFid = None
|
||||||
mergeWithGeom = None
|
mergeWithGeom = None
|
||||||
max = 0
|
max = 0
|
||||||
|
|
||||||
for selFid in outLayer.selectedFeaturesIds():
|
selFeat = QgsFeature()
|
||||||
selFeat = QgsFeature()
|
while fit.nextFeature(selFeat):
|
||||||
|
|
||||||
if outLayer.getFeatures( QgsFeatureRequest().setFilterFid( selFid ).setSubsetOfAttributes([]) ).nextFeature( selFeat ):
|
|
||||||
selGeom = selFeat.geometry()
|
selGeom = selFeat.geometry()
|
||||||
|
|
||||||
if geom2Eliminate.intersects(selGeom): # we have a candidate
|
if geom2Eliminate.intersects(selGeom): # we have a candidate
|
||||||
@ -188,7 +186,7 @@ class Dialog(QtGui.QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
if selValue > max:
|
if selValue > max:
|
||||||
max = selValue
|
max = selValue
|
||||||
mergeWithFid = selFid
|
mergeWithFid = selFeat.id()
|
||||||
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry
|
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry
|
||||||
|
|
||||||
if mergeWithFid != None: # a successful candidate
|
if mergeWithFid != None: # a successful candidate
|
||||||
@ -213,8 +211,7 @@ class Dialog(QtGui.QDialog, Ui_Dialog):
|
|||||||
# end for fid2Eliminate
|
# end for fid2Eliminate
|
||||||
|
|
||||||
# deselect features that are already eliminated in inLayer
|
# deselect features that are already eliminated in inLayer
|
||||||
for aFid in fidsToDeselect:
|
inLayer.deselect(fidsToDeselect)
|
||||||
inLayer.deselect(aFid, False)
|
|
||||||
|
|
||||||
#end while
|
#end while
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user