This commit is contained in:
DingZQ
2024-12-08 18:42:57 +08:00
parent 41fa93cace
commit fa26c46d7d

10
main.py
View File

@@ -1391,9 +1391,13 @@ 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)
@app.get("/getnetworkcoords/", response_class = PlainTextResponse)
async def fastapi_get_network_coords(network: str) -> dict[str, dict[str, float]] | None:
return json.dumps(get_network_coords(network))
@app.get("/getnetworkcoords/")
async def fastapi_get_network_coords(network: str) -> dict[str, str] | None:
coords = get_network_coords(network)
result = {}
for node_id, coord in coords.items():
result[node_id] = f"{coord['x']}:{coord['y']}"
return result
############################################################
# vertex 25.[VERTICES]