Return type from getnetworkcoord

This commit is contained in:
DingZQ
2024-12-18 22:41:35 +08:00
parent f8ac46d80d
commit 70afb19184
4 changed files with 21 additions and 7 deletions

View File

@@ -1393,12 +1393,14 @@ async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] |
return get_node_coord(network, node)
# DingZQ, 2024-12-08, get all node coord
# id:type:x:y
# type: junction, reservoir, tank
@app.get("/getnetworkcoords/")
async def fastapi_get_network_coords(network: str) -> list[str] | None:
coords = get_network_coords(network)
result = []
for node_id, coord in coords.items():
result.append(f"{node_id}:{coord['x']}:{coord['y']}")
result.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
return result
# DingZQ, 2024-12-08, get all links' start and end node