doIntersectLines.diff

Daniel Vaz, 2013-07-05 10:46 AM

Download (1.91 KB)

View differences:

doIntersectLines.new 2013-07-05 14:44:28.458890883 -0300
142 142
        tempGeom = QgsGeometry()
143 143
        start = 15.00
144 144
        add = 85.00 / layer1.featureCount()
145
        singlelayer_tempList = []
145 146
        index = ftools_utils.createIndex( provider2 )
147
        allAttrs = provider1.attributeIndexes()
148
        provider1.select(allAttrs)
146 149
        while provider1.nextFeature(inFeat):
147 150
            inGeom = inFeat.geometry()
148 151
            lineList = []
......
170 173
                            else:
171 174
                                tempList.append(tempGeom.asPoint())
172 175
                            for j in tempList:
173
                                outFeat.setGeometry(tempGeom.fromPoint(j))
174
                                outFeat.addAttribute(0, atMap1[index1])
175
                                outFeat.addAttribute(1, atMap2[index2])
176
                                writer.addFeature(outFeat)
176
                                if line1.compare(line2) == 0: # same layer
177
                                    if not j in singlelayer_tempList:
178
                                        singlelayer_tempList.append(j)
179
                                        outFeat.setGeometry(tempGeom.fromPoint(j))
180
                                        outFeat.addAttribute(0, atMap1[index1])
181
                                        outFeat.addAttribute(1, atMap2[index2])
182
                                        writer.addFeature(outFeat)
183
                                else:
184
                                    outFeat.setGeometry(tempGeom.fromPoint(j))
185
                                    outFeat.addAttribute(0, atMap1[index1])
186
                                    outFeat.addAttribute(1, atMap2[index2])
187
                                    writer.addFeature(outFeat)
177 188
            start = start + add
178 189
            progressBar.setValue(start)
179 190
        del writer