-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml
244 lines (227 loc) · 5.2 KB
/
MainWindow.xaml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<Window
x:Class="Graph.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Graph Algorithms Visualizer"
WindowStyle="ThreeDBorderWindow"
WindowStartupLocation="CenterScreen"
ResizeMode="CanResize"
Width="1024"
Height="768">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="1*" />
<ColumnDefinition
Width="4*" />
</Grid.ColumnDefinitions>
<Border
BorderBrush="Gray"
BorderThickness="3"
Grid.Column="0"
Grid.Row="0">
<Grid
Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition
Height="15" />
<RowDefinition
Height="30" />
<RowDefinition
Height="30" />
<RowDefinition
Height="30" />
<RowDefinition
Height="15" />
<RowDefinition
Height="30" />
<RowDefinition
Height="15" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="*" />
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
TextAlignment="Center"
Text="Controlls"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2" />
<Button
Grid.Column="0"
Grid.Row="1"
Command="{Binding DFSClick}"
>
<Viewbox>
<Label
Content="Depth-First Search" />
</Viewbox>
</Button>
<Button
Grid.Column="1"
Grid.Row="1"
Command="{Binding BFSClick}"
>
<Viewbox>
<Label
Content="Breadth-First Search" />
</Viewbox>
</Button>
<Button
Grid.Column="0"
Grid.Row="2"
Command="{Binding DijkstraClick}"
>
<Viewbox>
<Label
Content="最短経路探索(Dijkstra)" />
</Viewbox>
</Button>
<Button
Grid.Column="1"
Grid.Row="2"
Command="{Binding KruskalClick}">
<Viewbox>
<Label
Content="最小全域木 (Kruskal)" />
</Viewbox>
</Button>
<Button
Grid.Column="0"
Grid.Row="3"
Command="{Binding StopClick}">
<Viewbox>
<Label
Content="アニメーション終了" />
</Viewbox>
</Button>
<Button
Grid.Column="1"
Grid.Row="3"
Command="{Binding EraseClick}">
<Viewbox>
<Label
Content="全消去" />
</Viewbox>
</Button>
<TextBlock
TextAlignment="Center"
Text="始点"
Grid.Row="4"
Grid.Column="0"
/>
<TextBlock
TextAlignment="Center"
Text="終点"
Grid.Row="4"
Grid.Column="1" />
<ComboBox
Grid.Row="5"
Grid.Column="0"
ItemsSource="{Binding Nodes}"
DisplayMemberPath="Key"
SelectedItem="{Binding From}"
/>
<ComboBox
Grid.Row="5"
Grid.Column="1"
ItemsSource="{Binding Nodes}"
DisplayMemberPath="Key"
SelectedItem="{Binding To}"
/>
<TextBlock
TextAlignment="Center"
Text="Log Viewer"
Grid.Row="6"
Grid.Column="0"
Grid.ColumnSpan="2" />
<ListBox
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ItemsSource="{Binding Logs}"
DisplayMemberPath="Log"
FontSize="8"
Grid.Row="7"
Grid.Column="0"
Grid.ColumnSpan="2">
</ListBox>
</Grid>
</Border>
<Border
BorderBrush="Gray"
BorderThickness="3"
Grid.Column="1"
Grid.Row="0">
<Canvas
Name="GraphCanvas"
Background="White">
<Canvas.InputBindings>
<MouseBinding
Gesture="LeftClick"
Command="{Binding GraphBackGroundClick}"
CommandParameter="{Binding ElementName=GraphCanvas}" />
</Canvas.InputBindings>
<ItemsControl
ItemsSource="{Binding Edges}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Canvas>
<Grid
Canvas.Left="{Binding OriginX}"
Canvas.Top="{Binding OriginY}">
<Line
X1="{Binding FirstX}"
Y1="{Binding FirstY}"
X2="{Binding SecondX}"
Y2="{Binding SecondY}"
Stroke="{Binding Color}"
StrokeThickness="5" />
<TextBox
Text="{
Binding Weight,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged
}"
Background="White"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</Canvas>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl
ItemsSource="{Binding Nodes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Canvas>
<Grid
Canvas.Left="{Binding xPos, Mode=TwoWay}"
Canvas.Top="{Binding yPos, Mode=TwoWay}"
MouseLeftButtonDown="Node_MouseLeftButtonDown"
MouseLeftButtonUp="Node_MouseLeftButtonUp"
MouseMove="Node_MouseMove">
<Ellipse
Stroke="{Binding Color}"
Fill="White"
StrokeThickness="3"
Width="{Binding Size}"
Height="{Binding Size}" />
<TextBlock
Text="{Binding Key}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</Canvas>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Canvas>
</Border>
</Grid>
</Window>