Add API to get major nodes and major pipes
This commit is contained in:
19
main.py
19
main.py
@@ -1403,12 +1403,29 @@ async def fastapi_get_network_coords(network: str) -> list[str] | None:
|
||||
result.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
||||
return result
|
||||
|
||||
# DingZQ, 2024-12-08, get all links' start and end node
|
||||
# DingZQ, 2024-12-31, get major node coord
|
||||
# id:type:x:y
|
||||
# type: junction, reservoir, tank
|
||||
@app.get("/getmajornodecoords/")
|
||||
async def fastapi_get_major_node_coords(network: str) -> list[str] | None:
|
||||
coords = get_major_node_coords(network)
|
||||
result = []
|
||||
for node_id, coord in coords.items():
|
||||
result.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
||||
return result
|
||||
|
||||
# DingZQ, 2024-12-08, get all links' start and end node
|
||||
# link_id:link_type:node_id1:node_id2
|
||||
@app.get("/getnetworklinknodes/")
|
||||
async def fastapi_get_network_link_nodes(network: str) -> list[str] | None:
|
||||
return get_network_link_nodes(network)
|
||||
|
||||
# DingZQ 2024-12-31
|
||||
# 获取直径大于800的管道
|
||||
@app.get("/getmajorpipenodes/")
|
||||
async def fastapi_get_major_pipe_nodes(network: str) -> list[str] | None:
|
||||
return get_major_pipe_nodes(network)
|
||||
|
||||
############################################################
|
||||
# vertex 25.[VERTICES]
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user