Support to get link on boundary

This commit is contained in:
wqy
2023-07-21 18:40:27 +08:00
parent 4c6e257d1d
commit fb347ba03a
5 changed files with 77 additions and 14 deletions

View File

@@ -5680,11 +5680,27 @@ class TestApi:
boundary = calculate_boundary(p, vds[0]['nodes'])
boundary = inflate_boundary(p, boundary)
add_region(p, ChangeSet({'id': 'r', 'boundary': boundary}))
add_region(p, ChangeSet({'id': 'r1', 'boundary': boundary}))
nodes = get_nodes_in_region(p, 'r')
nodes = get_nodes_in_region(p, 'r1')
assert nodes == ['10', '101', '103', '105', '107', '109', '111', '115', '117', '119', '120', '257', '259', '261', '263', 'Lake']
add_district_metering_area(p, ChangeSet({'id': 'r2', 'boundary': boundary, 'nodes': ['10', '101', '103']}))
nodes = get_nodes_in_region(p, 'r2')
assert nodes == ['10', '101', '103']
self.leave(p)
def test_get_links_on_boundary(self):
p = 'get_links_on_boundary'
read_inp(p, f'./inp/net3.inp', '3')
open_project(p)
add_region(p, ChangeSet({'id': 'r', 'boundary': [(24.614,13.087), (24.835,11.069), (26.144,10.747), (27.290,11.543), (25.726,12.987), (24.614,13.087)]}))
links = get_links_on_region_boundary(p, 'r')
assert links == ['183', '185', '229', '313', '315']
self.leave(p)