forked from CIDARLAB/pyFluigi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·78 lines (51 loc) · 1.4 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
from pnr.hola import adaptagrams as ag
router = ag.Router(ag.PolyLineRouting)
p1 = ag.Point(20,35)
p2 = ag.Point(40,12)
rect1 = ag.AvoidRectangle(p1,p2)
shaperef = ag.ShapeRef(router, rect1)
position = shaperef.position()
print("x: {}, y: {}".format(position.x, position.y))
graph = ag.Graph()
print(graph)
node1 = graph.addNode(5,5)
node2 = graph.addNode(5,5)
node3 = graph.addNode(5,5)
node4 = graph.addNode(5,5)
print('Printing Positions:')
print(node1.id())
bb = node1.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node2.id())
bb = node2.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node3.id())
bb = node3.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node4.id())
bb = node4.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
edge1 = graph.addEdge(node1.id(), node2.id())
edge2 = graph.addEdge(node3, node4)
edge3 = graph.addEdge(node2, node3)
print(edge2)
# print(edge2.id)
print("isTREE ?: ", graph.isTree())
print("#nodes: ", graph.getNumNodes())
print("#edges: ", graph.getNumEdges())
# acalayout = ag.ACALayout(graph)
# acalayout.layout()
ag.doHOLA(graph)
print(node1.id())
bb = node1.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node2.id())
bb = node2.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node3.id())
bb = node3.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)
print(node4.id())
bb = node4.getBoundingBox()
print(bb.x, bb.y, bb.X, bb.Y)