Add scada data to API getnetworkgeometries
This commit is contained in:
18
main.py
18
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:
|
async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] | None:
|
||||||
return get_node_coord(network, node)
|
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
|
# DingZQ, 2025-01-27, get all node coord/links
|
||||||
# nodes: id:type:x:y
|
# nodes: id:type:x:y
|
||||||
# links: id:type:node1:node2
|
# 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():
|
for node_id, coord in coords.items():
|
||||||
nodes.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
nodes.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
||||||
links = get_network_link_nodes(network)
|
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
|
# DingZQ, 2024-12-31, get major node coord
|
||||||
# id:type:x:y
|
# id:type:x:y
|
||||||
|
|||||||
Reference in New Issue
Block a user