Accept Merge Request #261: (region -> master)
Merge Request: Enhance boundary algorithm Created By: @王琼钰 Accepted By: @王琼钰 URL: https://tjwater.coding.net/p/tjwatercloud/d/TJWaterServer/git/merge/261?initial=true
This commit is contained in:
@@ -150,8 +150,16 @@ def calculate_boundary(name: str, nodes: list[str]) -> list[tuple[float, float]]
|
||||
|
||||
paths: list[str] = []
|
||||
while True:
|
||||
#print(cursor)
|
||||
# prevent duplicated node
|
||||
if len(paths) > 0 and cursor == paths[-1]:
|
||||
break
|
||||
|
||||
# prevent duplicated path
|
||||
if len(paths) >= 3 and paths[0] == paths[-1] and paths[1] == cursor:
|
||||
break
|
||||
|
||||
paths.append(cursor)
|
||||
|
||||
sorted_links = []
|
||||
overlapped_link = ''
|
||||
for link in t_nodes[cursor]['links']:
|
||||
@@ -164,10 +172,7 @@ def calculate_boundary(name: str, nodes: list[str]) -> list[tuple[float, float]]
|
||||
# work into a branch, return
|
||||
if len(sorted_links) == 0:
|
||||
cursor = paths[-2]
|
||||
if cursor == topology.max_x_node():
|
||||
paths.append(cursor)
|
||||
break
|
||||
in_angle = in_angle = _angle_of_node_link(cursor, overlapped_link, t_nodes, t_links)
|
||||
in_angle = _angle_of_node_link(cursor, overlapped_link, t_nodes, t_links)
|
||||
continue
|
||||
|
||||
sorted_links = sorted(sorted_links, key=lambda s:s[0])
|
||||
@@ -178,11 +183,6 @@ def calculate_boundary(name: str, nodes: list[str]) -> list[tuple[float, float]]
|
||||
break
|
||||
|
||||
cursor = t_links[out_link]['node1'] if cursor == t_links[out_link]['node2'] else t_links[out_link]['node2']
|
||||
# end up trip :)
|
||||
if cursor == topology.max_x_node():
|
||||
paths.append(cursor)
|
||||
break
|
||||
|
||||
in_angle = _angle_of_node_link(cursor, out_link, t_nodes, t_links)
|
||||
|
||||
boundary: list[tuple[float, float]] = []
|
||||
|
||||
Reference in New Issue
Block a user