-
Notifications
You must be signed in to change notification settings - Fork 3
/
arch_notes.txt
102 lines (82 loc) · 2.94 KB
/
arch_notes.txt
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Page - elements/widget layout which may contain a viewport
Viewport - impl iced canvas, grid, panning, fit view etc
Schematic - impl schematic functions - selection, cycle, move, copy etc over generic elements
Content - concrete types implmenting specialized functions (Circuit, DeviceDesigner)
DataGraph - impl plot functions - horz/vert markers, etc.
Plot - concrete types containing data
Content <-> Page communication - how to do this?
Content/Plot is a member of Page
Viewport gets a reference
add another layer
viewport <-> schematic/plot <-> content
viewport: zoom, pan, etc.
schematic: translate, copy, delete generic selected
plot: data plots
content: concrete elements which can be selected or moved
Viewport:
CompositeMsg {
viewport Msg
content Msg (schematic msg)
}
schematic:
enum EventMsg {
Event
ContentMsg
SchematicMsg
}
fn update {
match eventmsg {
EventMsg::Event(event) => {
match event {
bla bla => {
bla bla
}
_ => {
schematic_msg = content.update()
self.process_msg(Schematic_msg);
}
}
}
EventMsg::ContentMsg(msg) => {
schematic_msg = content.update(msg)
self.process_msg(schematic_msg)
}
EventMsg::SchematicMsg(msg) => {
self.process_msg(Schematic_msg);
}
}
}
circuit
schematic lvl: either self msg, or pass to content and process results
Wiring Pathfinder
https://docs.rs/pathfinding/latest/pathfinding/directed/astar/fn.astar.html
build a graph from bounding box of circuit, plus border to allow connects around outside
add all vertical/horizontal paths of all lengths to graph
do not add nodes occupied by devices, net labels, existing nets
run Pathfinder
profit???
build a graph from bounding box of net start, current cursor pos
add all vertical/horizontal paths of all lengths, excluding obstacles
run Pathfinder
increase bounding box size and rerun if fail
=====================================================================
Circuit/DeviceDesigner
- Schematic as component
- Viewport as component (later if ever)
selected
get delete event
perform callback to mutate parent
selected
get copy/move event
perform callback to mutate parent
callbacks:
delete element
place element (move if exists, place new if not)
select by intersection
select by contains
-- lots of problems setting up the callbacks with lifetime and whatnot
schematic just keep tabs on tentatives/selected
delete: circuit get selected elements, deletes them
place: circuit pass curpos to schematic, get selected elements, place/copy/move elements
-- downside is that some logic will still be repeated in circuit/designer e.g. place/copy/move
selected