Skip to content

Commit 2f23b1e

Browse files
committedFeb 1, 2013
first take on porting ftools to vector iterator api
1 parent 0d1f3d2 commit 2f23b1e

19 files changed

+365
-456
lines changed
 

‎debian/control.raring

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Build-Depends:
3131
python-qt4-dev (>=4.1.0),
3232
python-sip (>= 4.5.0),
3333
python-sip-dev (>= 4.5.0),
34+
libpython2.7-dev,
3435
libosgearth-dev,
3536
libopenscenegraph-dev,
3637
git,

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
141141
else:
142142
QtGui.QMessageBox.warning(self, self.tr("Eliminate"), self.tr("Could not delete features"))
143143
return None
144-
144+
145145
# ANALYZE
146146
start = 20.00
147147
progressBar.setValue(start)
@@ -160,7 +160,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
160160
for fid2Eliminate in inLayer.selectedFeaturesIds():
161161
feat = QgsFeature()
162162

163-
if inLayer.featureAtId(fid2Eliminate, feat, True, False):
163+
if inLayer.getFeatures( QgsFeatureRequest().setFilterFid( fid2Eliminate ).setSubsetOfAttributes([]) ).nextFeature( feat ):
164164
geom2Eliminate = feat.geometry()
165165
bbox = geom2Eliminate.boundingBox()
166166
outLayer.select(bbox, False) # make a new selection
@@ -171,7 +171,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
171171
for selFid in outLayer.selectedFeaturesIds():
172172
selFeat = QgsFeature()
173173

174-
if outLayer.featureAtId(selFid, selFeat, True, False):
174+
if outLayer.getFeatures( QgsFeatureRequest().setFilterFid( selFid ).setSubsetOfAttributes([]) ).nextFeature( selFeat ):
175175
selGeom = selFeat.geometry()
176176

177177
if geom2Eliminate.intersects(selGeom): # we have a candidate
@@ -190,7 +190,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
190190
max = selValue
191191
mergeWithFid = selFid
192192
mergeWithGeom = QgsGeometry(selGeom) # deep copy of the geometry
193-
193+
194194
if mergeWithFid != None: # a successful candidate
195195
newGeom = mergeWithGeom.combine(geom2Eliminate)
196196

@@ -206,16 +206,16 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
206206
else:
207207
QtGui.QMessageBox.warning(self, self.tr("Eliminate"),
208208
self.tr("Could not replace geometry of feature with id %1").arg( mergeWithFid ))
209-
return None
210-
209+
return None
210+
211211
start = start + add
212212
progressBar.setValue(start)
213213
# end for fid2Eliminate
214214

215215
# deselect features that are already eliminated in inLayer
216216
for aFid in fidsToDeselect:
217217
inLayer.deselect(aFid, False)
218-
218+
219219
#end while
220220

221221
if inLayer.selectedFeatureCount() > 0:
@@ -232,7 +232,7 @@ def eliminate(self, inLayer, boundary, progressBar, outFileName):
232232

233233
QtGui.QMessageBox.information(self, self.tr("Eliminate"),
234234
self.tr("Could not eliminate features with these ids:\n%1").arg(fidList))
235-
else:
235+
else:
236236
QtGui.QMessageBox.warning(self, self.tr("Eliminate"), self.tr("Could not add features"))
237237

238238
# stop editing outLayer and commit any pending changes

0 commit comments

Comments
 (0)
Please sign in to comment.