Add default coordinate

This commit is contained in:
WQY\qiong
2023-03-24 20:54:16 +08:00
parent 7446f89a34
commit 069e9ac4c5
3 changed files with 9 additions and 0 deletions

View File

@@ -16,6 +16,9 @@ def get_junction(name: str, id: str) -> dict[str, Any]:
if j == None:
return {}
xy = get_node_coord(name, id)
if xy == {}:
write(name, f"insert into coordinates (node, coord) values ('{id}', '(0,0)');")
xy = get_node_coord(name, id)
d = {}
d['id'] = str(j['id'])
d['x'] = float(xy['x'])

View File

@@ -17,6 +17,9 @@ def get_reservoir(name: str, id: str) -> dict[str, Any]:
if r == None:
return {}
xy = get_node_coord(name, id)
if xy == {}:
write(name, f"insert into coordinates (node, coord) values ('{id}', '(0,0)');")
xy = get_node_coord(name, id)
d = {}
d['id'] = str(r['id'])
d['x'] = float(xy['x'])

View File

@@ -27,6 +27,9 @@ def get_tank(name: str, id: str) -> dict[str, Any]:
if t == None:
return {}
xy = get_node_coord(name, id)
if xy == {}:
write(name, f"insert into coordinates (node, coord) values ('{id}', '(0,0)');")
xy = get_node_coord(name, id)
d = {}
d['id'] = str(t['id'])
d['x'] = float(xy['x'])