Add demo for new api
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
from operation import execute_undo
|
||||
from project import *
|
||||
from s1_title import *
|
||||
|
||||
p = "test_s1_title"
|
||||
|
||||
if is_project_open(p):
|
||||
close_project(p)
|
||||
|
||||
if have_project(p):
|
||||
delete_project(p)
|
||||
|
||||
create_project(p)
|
||||
open_project(p)
|
||||
|
||||
print(get_title(p))
|
||||
|
||||
set_title(p, "title")
|
||||
print(get_title(p))
|
||||
|
||||
set_title(p, "test")
|
||||
print(get_title(p))
|
||||
|
||||
execute_undo(p)
|
||||
print(get_title(p))
|
||||
|
||||
execute_undo(p)
|
||||
print(get_title(p))
|
||||
|
||||
close_project(p)
|
||||
delete_project(p)
|
||||
@@ -1,52 +0,0 @@
|
||||
from project import *
|
||||
from s2_junctions import *
|
||||
|
||||
p = "test_s2_junctions"
|
||||
|
||||
if is_project_open(p):
|
||||
close_project(p)
|
||||
|
||||
if have_project(p):
|
||||
delete_project(p)
|
||||
|
||||
create_project(p)
|
||||
open_project(p)
|
||||
|
||||
j = 'j-1'
|
||||
print(get_junction_coord(p, j)) # None
|
||||
print(get_junction_elevation(p, j)) # None
|
||||
print(get_junction_demand(p, j)) # None
|
||||
print(get_junction_pattern(p, j)) # None
|
||||
|
||||
add_junction(p, j, 10.0, 20.0, 30.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
print(get_junction_elevation(p, j)) # 30.0
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
print(get_junction_pattern(p, j)) # NULL
|
||||
|
||||
set_junction_demand(p, j, 100.0)
|
||||
print(get_junction_demand(p, j)) # 100.0
|
||||
|
||||
execute_undo(p)
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
|
||||
execute_undo(p)
|
||||
print(get_junction_coord(p, j)) # None
|
||||
print(get_junction_elevation(p, j)) # None
|
||||
print(get_junction_demand(p, j)) # None
|
||||
print(get_junction_pattern(p, j)) # None
|
||||
|
||||
add_junction(p, j, 10.0, 20.0, 30.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
print(get_junction_elevation(p, j)) # 30.0
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
print(get_junction_pattern(p, j)) # NULL
|
||||
|
||||
set_junction_coord(p, j, 100.0, 200.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 100.0, 'y': 200.0}
|
||||
|
||||
execute_undo(p)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
|
||||
close_project(p)
|
||||
# delete_project(p)
|
||||
85
new_demo.py
Normal file
85
new_demo.py
Normal file
@@ -0,0 +1,85 @@
|
||||
from tjnetwork_new import *
|
||||
|
||||
def demo_1_title():
|
||||
p = "demo_1_title"
|
||||
|
||||
if is_project_open(p):
|
||||
close_project(p)
|
||||
|
||||
if have_project(p):
|
||||
delete_project(p)
|
||||
|
||||
create_project(p)
|
||||
open_project(p)
|
||||
|
||||
print(get_title(p)) #
|
||||
|
||||
set_title(p, "title")
|
||||
print(get_title(p)) # title
|
||||
|
||||
set_title(p, "test")
|
||||
print(get_title(p)) # test
|
||||
|
||||
undo(p)
|
||||
print(get_title(p)) # title
|
||||
|
||||
undo(p)
|
||||
print(get_title(p)) #
|
||||
|
||||
close_project(p)
|
||||
delete_project(p)
|
||||
|
||||
def demo_2_junctions():
|
||||
p = "demo_2_junctions"
|
||||
|
||||
if is_project_open(p):
|
||||
close_project(p)
|
||||
|
||||
if have_project(p):
|
||||
delete_project(p)
|
||||
|
||||
create_project(p)
|
||||
open_project(p)
|
||||
|
||||
j = 'j-1'
|
||||
print(get_junction_coord(p, j)) # None
|
||||
print(get_junction_elevation(p, j)) # None
|
||||
print(get_junction_demand(p, j)) # None
|
||||
print(get_junction_pattern(p, j)) # None
|
||||
|
||||
add_junction(p, j, 10.0, 20.0, 30.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
print(get_junction_elevation(p, j)) # 30.0
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
print(get_junction_pattern(p, j)) # NULL
|
||||
|
||||
set_junction_demand(p, j, 100.0)
|
||||
print(get_junction_demand(p, j)) # 100.0
|
||||
|
||||
undo(p)
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
|
||||
undo(p)
|
||||
print(get_junction_coord(p, j)) # None
|
||||
print(get_junction_elevation(p, j)) # None
|
||||
print(get_junction_demand(p, j)) # None
|
||||
print(get_junction_pattern(p, j)) # None
|
||||
|
||||
add_junction(p, j, 10.0, 20.0, 30.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
print(get_junction_elevation(p, j)) # 30.0
|
||||
print(get_junction_demand(p, j)) # NULL
|
||||
print(get_junction_pattern(p, j)) # NULL
|
||||
|
||||
set_junction_coord(p, j, 100.0, 200.0)
|
||||
print(get_junction_coord(p, j)) # {'x': 100.0, 'y': 200.0}
|
||||
|
||||
undo(p)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
|
||||
close_project(p)
|
||||
delete_project(p)
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo_1_title()
|
||||
demo_2_junctions()
|
||||
Reference in New Issue
Block a user