Skip to content

Commit

Permalink
Fix #7073
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanielvaz committed Jul 10, 2013
1 parent 1ebdb69 commit 1a95297
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions python/plugins/fTools/tools/doIntersectLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def compute(self, line1, line2, field1, field2, outPath, progressBar):

index = ftools_utils.createIndex( provider2 )

singlelayer_tempList = []
fit1 = provider1.getFeatures( QgsFeatureRequest().setSubsetOfAttributes([index1]) )
while fit1.nextFeature(inFeat):
inGeom = inFeat.geometry()
Expand All @@ -169,10 +170,19 @@ def compute(self, line1, line2, field1, field2, outPath, progressBar):
tempList.append(tempGeom.asPoint())

for j in tempList:
outFeat.setGeometry(tempGeom.fromPoint(j))
outFeat.setAttribute(0, v1)
outFeat.setAttribute(1, v2)
writer.addFeature(outFeat)
# if same layer, avoid insert duplicated points
if line1 == line2:
if not j in singlelayer_tempList:
singlelayer_tempList.append(j)
outFeat.setGeometry(tempGeom.fromPoint(j))
outFeat.setAttribute(0, v1)
outFeat.setAttribute(1, v2)
writer.addFeature(outFeat)
else:
outFeat.setGeometry(tempGeom.fromPoint(j))
outFeat.setAttribute(0, v1)
outFeat.setAttribute(1, v2)
writer.addFeature(outFeat)

start = start + add
progressBar.setValue(start)
Expand Down

0 comments on commit 1a95297

Please sign in to comment.