-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
380 lines (374 loc) · 24.6 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<Window x:Class="_3D_viewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="3D-Viewer" Height="720" Width="1080">
<Window.Resources>
<sys:String xml:space="preserve" x:Key="Rule">1. 三行分别表示了三个顶点 2. x 轴和 y 轴坐标应当被限定在 -1 至 1 之间 3. z轴坐标应为负数</sys:String>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<!-- Set the width of the first column to 3 times the width of the second column -->
<ColumnDefinition Width="*" />
<!-- Set the width of the second column to 2 times the width of the first column -->
</Grid.ColumnDefinitions>
<Border Background="#efefef">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="12*" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10" x:Name="ButtonRefresh"
Click="refresh_button_click"
Background="#409EFF">
<!-- 刷新按钮的图标 -->
<Button.Content>
<Grid Width="10" Height="10">
<Path
Data="M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"
Fill="White" Stretch="Uniform" />
</Grid>
</Button.Content>
</Button>
<Button Grid.Column="1" x:Name="ReportButton" VerticalAlignment="Top" Margin="10" HorizontalAlignment="Left"
Background="#409EFF"
Click="ReportButton_OnClick"
>
<Button.Content>
<Grid Width="10" Height="10">
<Path
Data="M288 384h448v64H288v-64zm96-128h256v64H384v-64zM131.456 512H384v128h256V512h252.544L721.856 192H302.144L131.456 512zM896 576H704v128H320V576H128v256h768V576zM275.776 128h472.448a32 32 0 0 1 28.608 17.664l179.84 359.552A32 32 0 0 1 960 519.552V864a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V519.552a32 32 0 0 1 3.392-14.336l179.776-359.552A32 32 0 0 1 275.776 128z"
Fill="White" Stretch="Uniform"
></Path>
</Grid>
</Button.Content>
</Button>
</Grid>
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1, 0, 1, 1" Background="#efefef"
HorizontalAlignment="Left" VerticalAlignment="Top">
<Image x:Name="PathTracingImage" Height="675" Width="720"/>
</Border>
</Grid>
</Border>
<!-- Input fields column -->
<Grid Grid.Column="1">
<!-- Define three rows for input fields -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border BorderBrush="Gray" BorderThickness="1" Background="#efefef">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="浏览..." VerticalAlignment="Center"></TextBlock>
<ComboBox x:Name="ObjectSelectRenderedComboBox"
Margin="5 5 5 10"
Width="108"
FontSize="16"
BorderBrush="#409EFF"
BorderThickness="2"
VerticalAlignment="Center"
IsTextSearchEnabled="True"
IsEditable="False"
ItemsSource="{Binding ObjectList}"
SelectionChanged="ObjectSelectComboBox_OnSelectionChanged"
>
</ComboBox>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Background="#efefef">
<Grid HorizontalAlignment="Center">
<Grid Height="Auto" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Left" Margin="5" Text="添加三角形"
Style="{StaticResource TextBlockLargeBold}" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint1XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint1YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint1ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint2XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint2YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint2ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
</StackPanel>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint3XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint3YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="TrianglePoint3ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" />
</StackPanel>
</Grid>
<Grid Grid.Row="4" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal">
<TextBlock Text="物体名:" VerticalAlignment="Center"></TextBlock>
<ComboBox x:Name="ObjectSelectAddComboBox"
Margin="5 5 5 10"
Width="108"
FontSize="16"
BorderBrush="#409EFF"
BorderThickness="2"
VerticalAlignment="Center"
IsEditable="False"
ItemsSource="{Binding ObjectList}"
SelectionChanged="ObjectSelectComboBox_OnSelectionChanged"
>
</ComboBox>
</StackPanel>
</Grid>
<Grid Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Right">
<Button Content="添加" Style="{StaticResource ButtonPrimary}"
Width="80px"
Click="button_increase_click" Margin="0 0 0 5"
Name="AddButton"
Background="#409EFF"
/>
</Grid>
<Grid Column="1">
<ToggleButton hc:Poptip.HitMode="None"
hc:Poptip.IsOpen="{Binding IsChecked,RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{StaticResource Rule}"
hc:Poptip.Placement="Bottom"
HorizontalAlignment="Left"
Margin="10 0 0 0"
Content="规则" />
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
<Border Grid.Row="2" Background="#efefef" BorderBrush="Gray" BorderThickness="1">
<Grid HorizontalAlignment="Center">
<Grid Height="Auto" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Left" Margin="5" Text="修改/删除三角形"
Style="{StaticResource TextBlockLargeBold}" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint1XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint1YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint1ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint2XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint2YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint2ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
</StackPanel>
</Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="5">
<TextBlock Text="X:" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint3XTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Y:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint3YTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
<TextBlock Text="Z:" Margin="5 0 5 0" VerticalAlignment="Center" />
<TextBox Name="UpdateTrianglePoint3ZTextBox" Margin="5 0 5 0" Width="48"
FontSize="16"
BorderBrush="#409EFF" BorderThickness="2" VerticalAlignment="Center"
PreviewTextInput="float_text_input_handler" IsEnabled="False"/>
</StackPanel>
</Grid>
<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid HorizontalAlignment="Right">
<Button Content="修改" Style="{StaticResource ButtonWarning}"
Width="80px"
Click="button_update_click" Margin="0 0 5 5"
Name="UpdateButton"
Background="#E6A23C"
/>
</Grid>
<Grid Column="1">
<Button Content="删除" Style="{StaticResource ButtonDanger}" HorizontalAlignment="Left"
Width="80px"
Click="button_delete_click" Margin="5 0 0 5"
Name="DeleteButton"
/>
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
<Border Grid.Row="3" Background="#efefef" BorderBrush="Gray" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Width="180" Height="180" HorizontalAlignment="Right" Margin="0 0 20 0"
Name="ColorDetailPicker" MouseDown="ColorDetailPicker_OnMouseDown"
MouseUp="ColorDetailPicker_OnMouseUp">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0, 0.5" EndPoint="1, 0.5">
<GradientStop Color="Black" />
<GradientStop Color="{Binding general_color, Mode=TwoWay}" Offset="0.5" />
<GradientStop Color="White" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Grid.Column="1" Width="25" Height="180" HorizontalAlignment="Left"
Name="ColorGeneralPicker" MouseDown="ColorGeneralPicker_OnMouseDown"
MouseUp="ColorGeneralPicker_OnMouseUp">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#000000" Offset="0" />
<GradientStop Color="#ff0000" Offset="0.142" />
<GradientStop Color="#ffff00" Offset="0.285" />
<GradientStop Color="#00ff00" Offset="0.428" />
<GradientStop Color="#00ffff" Offset="0.571" />
<GradientStop Color="#0000ff" Offset="0.714" />
<GradientStop Color="#ff00ff" Offset="0.857" />
<GradientStop Color="#ffffff" Offset="1" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Border Grid.Column="2">
<Border Width="30" Height="30" VerticalAlignment="Top" Name="ColorPickerShow">
</Border>
</Border>
</Grid>
</Border>
</Grid>
</Grid>
</Window>