Skip to content

Commit

Permalink
No need to save connection index
Browse files Browse the repository at this point in the history
  • Loading branch information
SandSnip3r committed Dec 6, 2023
1 parent 383d4b6 commit 77d193d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/translate_qgis_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,22 @@ def printAsPoly(polylines, output_file):
connections = []
# 0 0 1 3
for polyline in polylines:
connections.append([[x, x, x+1, 3] for x in range(len(polyline)-1)])
connections.append([[x, x+1, 3] for x in range(len(polyline)-1)])
connectionCount = 0
index = 1
while index < len(polylines):
connectionCount += len(polylines[index-1])
for connection in connections[index]:
connection[0] += connectionCount
connection[1] += connectionCount
connection[2] += connectionCount
index += 1

print(f'{sum(len(connectionList) for connectionList in connections)} 1', file=f)
index = 0
for connectionList in connections:
for connection in connectionList:
print(f'{connection[0]} {connection[1]} {connection[2]} {connection[3]}', file=f)
print(f'{index} {connection[0]} {connection[1]} {connection[2]}', file=f)
index += 1

print('0\n', file=f)

Expand Down

0 comments on commit 77d193d

Please sign in to comment.