From e66a3dd7dfb23aa1bd06870b45b4ff82bd37c6dc Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 15 Feb 2025 14:20:07 +0800 Subject: [PATCH] Add scada data to API getnetworkgeometries --- main.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 46eddee..14e3d27 100644 --- a/main.py +++ b/main.py @@ -1561,17 +1561,6 @@ async def fastapi_set_option_properties(network: str, req: Request) -> ChangeSet async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] | None: 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_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, 2025-01-27, get all node coord/links # nodes: id:type:x:y # links: id:type:node1:node2 @@ -1584,8 +1573,13 @@ async def fastapi_get_network_geometries(network: str) -> dict[str, Any] | None: for node_id, coord in coords.items(): nodes.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}") links = get_network_link_nodes(network) + + # return list of scadas. scada : id, x, y + scadas = get_all_scada_elements(network) - return { 'nodes': nodes, 'links': links } + return { 'nodes': nodes, + 'links': links, + 'scadas': scadas } # DingZQ, 2024-12-31, get major node coord # id:type:x:y