Skip to content
Permalink
Browse files

Merge pull request #526 from vinayan/pip7414

[fTools] fix Points in Polygon and Delaunay triangulation (closes #7414, #7360)
  • Loading branch information
alexbruy committed Apr 17, 2013
2 parents e6f3b2e + 58737b6 commit 4c05932a565de8fb897520af8186978d3cc64c80
Showing with 7 additions and 3 deletions.
  1. +4 −1 python/plugins/fTools/tools/doGeometry.py
  2. +3 −2 python/plugins/fTools/tools/doPointsInPolygon.py
@@ -655,14 +655,17 @@ def delaunay_triangulation( self ):
indicies = list( triangle )
indicies.append( indicies[ 0 ] )
polygon = []
attrs = []
step = 0
for index in indicies:
vprovider.getFeatures( QgsFeatureRequest().setFilterFid( ptDict[ ids[ index ] ] ) ).nextFeature( inFeat )
geom = QgsGeometry( inFeat.geometry() )
point = QgsPoint( geom.asPoint() )
polygon.append( point )
if step <= 3: feat.setAttribute( step, QVariant( ids[ index ] ) )
if step <= 3:
attrs.append(QVariant( ids[ index ] ) )
step += 1
feat.setAttributes(attrs)
geometry = QgsGeometry().fromPolygon( [ polygon ] )
feat.setGeometry( geometry )
writer.addFeature( feat )
@@ -169,7 +169,7 @@ def run(self):
fieldList = ftools_utils.getFieldList(self.layerPoly)
index = polyProvider.fieldNameIndex(unicode(self.fieldName))
if index == -1:
index = polyProvider.fieldCount()
index = polyProvider.fields().count()
fieldList.append( QgsField(unicode(self.fieldName), QVariant.Double, "real", 24, 15, self.tr("point count field")) )

sRs = polyProvider.crs()
@@ -218,7 +218,8 @@ def run(self):
interrupted = True
break

outFeat.setAttribute(index, QVariant(count))
atMap.append(QVariant(count))
outFeat.setAttributes(atMap)
writer.addFeature(outFeat)

self.emit( SIGNAL( "updateProgress()" ) )

0 comments on commit 4c05932

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