增加统一接口get_node_properties get_link_properties获取所有类型的属性值
This commit is contained in:
16
tjnetwork.py
16
tjnetwork.py
@@ -392,6 +392,22 @@ def get_patterns(name: str) -> list[str]:
|
||||
def get_node_links(name: str, node_id: str) -> list[str]:
|
||||
return api.get_node_links(name, node_id)
|
||||
|
||||
# DingZQ, 2025-02-05
|
||||
def get_node_properties(name: str, node_id: str) -> dict[str, Any]:
|
||||
if api.is_junction(name, node_id):
|
||||
return api.get_junction(name, node_id)
|
||||
elif api.is_reservoir(name, node_id):
|
||||
return api.get_reservoir(name, node_id)
|
||||
elif api.is_tank(name, node_id):
|
||||
return api.get_tank(name, node_id)
|
||||
|
||||
def get_link_properties(name: str, link_id: str) -> dict[str, Any]:
|
||||
if api.is_pipe(name, link_id):
|
||||
return api.get_pipe(name, link_id)
|
||||
elif api.is_pump(name, link_id):
|
||||
return api.get_pump(name, link_id)
|
||||
elif api.is_valve(name, link_id):
|
||||
return api.get_valve(name, link_id)
|
||||
|
||||
############################################################
|
||||
# title 1.[TITLE]
|
||||
|
||||
Reference in New Issue
Block a user