/
MovableBedForm.cs
1044 lines (880 loc) · 43.4 KB
/
MovableBedForm.cs
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RiverSimulationApplication
{
public partial class MovableBedForm : Form
{
public MovableBedForm()
{
InitializeComponent();
}
RiverSimulationProfile p = RiverSimulationProfile.profile;
private SliderPanel sp = new SliderPanel();
public void SetForm(RiverSimulationProfile profile)
{
p = profile;
}
private void MovableBedForm_Load(object sender, EventArgs e)
{
valueParamPanel.Visible = false;
physicalParamPanel.Visible = false;
seabedCompositionPanel.Visible = false;
rockStablePanel.Visible = false;
rockbedPanel.Visible = false;
transSandMethodPanel.Visible = false;
ControllerUtility.SetHtmlUrl(comment, "Logo.html");
ControllerUtility.InitialGridPictureBoxByProfile(ref mapPicBox, p);
mapPicBox.Visible = true;
previewSedimentCompositionPanel.Size = mapPicBox.Size;
previewSedimentCompositionPanel.Top = mapPicBox.Top;
previewSedimentCompositionPanel.Left = mapPicBox.Left;
InitPreviewCombo();
previewCombo.SelectedIndex = (int)(PreviewType.GridMap) - 1;
LoadStatus();
UpdateStatus();
}
private void InitPreviewCombo()
{
previewCombo.Items.Add("格網預覽圖");
//if (p.Is3DMode())
//{ //3D Mode才有垂向格網分布圖
previewCombo.Items.Add("泥砂組成比例圖");
//}
//else
// {
// previewCombo.Enabled = false;
//}
}
private void LoadStatus()
{
//動床參數
//2.1 數值參數 =========================================
waterTimeSpanTxt.Text = p.waterTimeSpan.ToString();
waterOutputFrequencyTxt.Text = p.waterOutputFrequency.ToString();
//2.1.3 輸出控制
//2D
outputControlBottomElevationChk.Checked = p.outputControlBottomElevation;
outputControlAverageDepthDensityChk.Checked = p.outputControlAverageDepthDensity;
outputControlErosionDepthChk.Checked = p.outputControlErosionDepth;
//3D
outputControlDensityInformation3DChk.Checked = p.outputControlDensityInformation3D;
//2.1.4 選擇擴散公式
diffusionFormulaUseChk.Checked = p.diffusionFormulaUse;
diffusionFormulaCombo.SelectedIndex = (int)p.diffusionFormula - 1;
diffusionBonusProportionalInMainstreamTxt.Text = p.diffusionBonusProportionalInMainstream.ToString();
diffusionBonusProportionalInSideflowTxt.Text = p.diffusionBonusProportionalInSideflow.ToString();
diffusionBonusProportionalInSurfaceTxt.Text = p.diffusionBonusProportionalInSurface.ToString();
diffusionBonusProportionalInBottomTxt.Text = p.diffusionBonusProportionalInBottom.ToString();
//2.2 物理參數
kinematicViscosityCoefficientTxt.Text = p.kinematicViscosityCoefficient.ToString();
sedimentPoreRatioTxt.Text = p.sedimentPoreRatio.ToString();
sedimentDensityTxt.Text = p.sedimentDensity.ToString();
sedimentParticlesNumberTxt.Text = p.sedimentParticlesNumber.ToString();
//2.3 底床組成
bottomLevelNumberTxt.Text = p.bottomLevelNumber.ToString(); //2.3.1 底床分層數目單一數值 整數(>0) a. 使用者輸入底床分層數目後
shenCohesiveSedimentChk.Checked = p.shenCohesiveSediment;
surfaceErosionChk.Checked = p.surfaceErosion;
surfaceErosionCoefficientTxt.Text = p.surfaceErosionCoefficient.ToString();
surfaceErosionCriticalShearStressTxt.Text = p.surfaceErosionCriticalShearStress.ToString();
massiveErosionChk.Checked = p.massiveErosion;
massiveErosionCriticalShearStressTxt.Text = p.massiveErosionCriticalShearStress.ToString();
noErosionElevationChk.Checked = p.noErosionElevationUse;
//2.4 輸砂公式
switch(p.sandTransportEquation)
{
case RiverSimulationProfile.SandTransportEquationType.SandTransportEquation1:
sandTransportEquation1Rdo.Checked = true;
highSandTransportEquation1Rdo.Checked = true;
break;
case RiverSimulationProfile.SandTransportEquationType.SandTransportEquation2:
sandTransportEquation2Rdo.Checked = true;
highSandTransportEquation2Rdo.Checked = true;
break;
case RiverSimulationProfile.SandTransportEquationType.SandTransportEquation3:
sandTransportEquation3Rdo.Checked = true;
highSandTransportEquation3Rdo.Checked = true;
break;
case RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation4:
highSandTransportEquation4Rdo.Checked = true;
break;
case RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation5:
highSandTransportEquation5Rdo.Checked = true;
break;
case RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation6:
highSandTransportEquation6Rdo.Checked = true;
break;
default:
sandTransportEquation1Rdo.Checked = false;
sandTransportEquation2Rdo.Checked = false;
sandTransportEquation3Rdo.Checked = false;
highSandTransportEquation1Rdo.Checked = false;
highSandTransportEquation2Rdo.Checked = false;
highSandTransportEquation3Rdo.Checked = false;
highSandTransportEquation4Rdo.Checked = false;
highSandTransportEquation5Rdo.Checked = false;
highSandTransportEquation6Rdo.Checked = false;
break;
}
//BR_0 岸壁穩定
rockStableTimeSpacingTxt.Text = p.rockStableTimeSpacing.ToString();
//BR_1 岸壁幾何條件
analysisLeftBankStableChk.Checked = p.analysisLeftBankStable;
leftSlopeToePosiotionTxt.Text = p.leftSlopeToePosiotion.ToString();
leftBankHeightTxt.Text = p.leftBankHeight.ToString();
leftInitBankSlopeTxt.Text = p.leftInitBankSlope.ToString();
leftDikeToBankLengthTxt.Text = p.leftDikeToBankLength.ToString();
analysisRightBankStableChk.Checked = p.analysisRightBankStable;
rightSlopeToePosiotionTxt.Text = p.rightSlopeToePosiotion.ToString();
rightBankHeightTxt.Text = p.rightBankHeight.ToString();
rightInitBankSlopeTxt.Text = p.rightInitBankSlope.ToString();
rightDikeToBankLengthTxt.Text = p.rightDikeToBankLength.ToString();
//bankSoilPropertiesChk.Checked = p.bankSoilProperties;
bankSoilInternalFrictionAngleTxt.Text = p.bankSoilInternalFrictionAngle.ToString();
bankSoilConductCoefficientTxt.Text = p.bankSoilConductCoefficient.ToString();
bankSoilBankScourCriticalStressTxt.Text = p.bankSoilBankScourCriticalStress.ToString();
bankSoilCohesionTxt.Text = p.bankSoilCohesion.ToString();
bankSoilAngleOfReposeTxt.Text = p.bankSoilAngleOfRepose.ToString();
bankSoilSpecificYieldTxt.Text = p.bankSoilSpecificYield.ToString();
}
private void UpdateStatus()
{
//RiverSimulationProfile p = RiverSimulationProfile.profile;
//sedimentParticlesNumTxt.Text = p.sedimentParticlesNum.ToString();
//seabedLevelNumTxt.Text = p.seabedLevelNum.ToString();
diffusionFormulaCombo.Enabled = p.diffusionFormulaUse;
//DrawPreview();
UpdateActiveFunctions();
}
private void UpdateActiveFunctions()
{
//數值參數 輸出控制3D 面板
outputCtrl3DGrp.Enabled = p.Is3DMode();
//擴散公式是3D Only, 20150121
diffusionFormulaUseChk.Enabled = p.Is3DMode();
diffusionFormulaCombo.Enabled = p.Is3DMode();
bedrockGrp.Enabled = RiverSimulationProfile.profile.bedrockFunction;
quayStableAnalysisGrp.Enabled = RiverSimulationProfile.profile.quayStableAnalysisFunction;
highSandContentFlowGrp.Enabled = p.waterHighSandContentEffectFunction;
if (p.waterHighSandContentEffectFunction)
{
this.normalSandMethodText.Visible = false;
this.normalSandMethodPanel.Visible = false;
this.highSandMethodText.Visible = true;
this.highSandMethodPanel.Visible = true;
this.highSandMethodText.Top = this.normalSandMethodText.Location.Y;
this.highSandMethodPanel.Top = this.normalSandMethodPanel.Location.Y;
this.highSandMethodPanel.Enabled = true;
}
else
{
this.normalSandMethodText.Visible = true;
this.normalSandMethodPanel.Visible = true;
this.highSandMethodText.Visible = false;
this.highSandMethodPanel.Visible = false;
}
if (Program.programVersion.LiteVersion)
{
fullPanel.Visible = false;
}
//20150731介面測試問題 6. 再度改為disable
if (Program.programVersion.DemoVersion)
{
diffusionFormulaUseChk.Enabled = false;
diffusionFormulaCombo.Enabled = false;
}
}
private enum PreviewType
{
None,
GridMap, //格網地圖
SedimentComposition, //垂向格網分布圖
}
private void SwitchPreivewCombo(PreviewType n)
{
previewCombo.SelectedIndex = (int)(n) - 1;
}
private void ok_Click(object sender, EventArgs e)
{
if (!DoConvert())
{
return;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
private bool DoConvert()
{
if(!ConvertValueParam())
{
return false;
}
if (!ConvertPhysicalParam())
{
return false;
}
if (!ConvertSeabedComposition())
{
return false;
}
if(!ConvertTransSandMethod())
{
return false;
}
if (rockbedBtn.Enabled && !ConvertBedrock())
{
return false;
}
if (rockStableBtn.Enabled && !ConvertQuayStable())
{
return false;
}
return true;
}
private bool ConvertValueParam()
{
if (!ControllerUtility.CheckConvertDouble(ref p.waterTimeSpan, waterTimeSpanTxt, "請輸入正確的時間間距!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertInt32(ref p.waterOutputFrequency, waterOutputFrequencyTxt, "請輸入正確的輸出頻率!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (diffusionFormulaUseChk.Enabled && p.diffusionFormulaUse)
{
if(p.diffusionFormula == RiverSimulationProfile.DiffusionFormulaType.None)
{
MessageBox.Show("請選擇數值參數-擴散公式 !", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInMainstream, diffusionBonusProportionalInMainstreamTxt, "請輸入正確的主流方向擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInSideflow, diffusionBonusProportionalInSideflowTxt, "請輸入正確的側方向擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInSurface, diffusionBonusProportionalInSurfaceTxt, "請輸入正確的水面擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.diffusionBonusProportionalInBottom, diffusionBonusProportionalInBottomTxt, "請輸入正確的底床擴散係數加成比例!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
return true;
}
private bool ConvertPhysicalParam()
{
if (!ControllerUtility.CheckConvertDouble(ref p.kinematicViscosityCoefficient, kinematicViscosityCoefficientTxt, "請輸入正確的動力黏滯係數!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.sedimentPoreRatio, sedimentPoreRatioTxt, "請輸入正確的泥砂孔隙比!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.sedimentDensity, sedimentDensityTxt, "請輸入正確的泥砂密度!", ControllerUtility.CheckType.NotNegative))
{
return false;
}
if (!ConvertSedimentParticlesNumber()) //讀取泥砂顆粒數目
{
return false;
}
return true;
}
private bool ConvertSedimentParticlesNumber()
{
if (!ControllerUtility.CheckConvertInt32(ref p.sedimentParticlesNumber, sedimentParticlesNumberTxt, "請輸入正確的泥砂顆粒數目!", ControllerUtility.CheckType.GreaterThanTwo))
{
return false;
}
if (p.sedimentCompositionArray != null && p.sedimentCompositionArray.GetLength(0) != p.sedimentParticlesNumber)
{
MessageBox.Show("修改過泥砂顆粒數目,需重新輸入泥砂組成比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
p.sedimentCompositionArray = null;
}
if (p.sedimentParticleSize != null && p.sedimentParticleSize.GetLength(1) != p.sedimentParticlesNumber)
{
MessageBox.Show("修改過泥砂顆粒數目,需重新輸入泥砂粒徑!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
p.sedimentParticleSize = null;
}
if (!p.suspendedLoadDepthAvgConcentration.ArrayNull() && p.suspendedLoadDepthAvgConcentration.Array3D().GetLength(0) != p.sedimentParticlesNumber)
{
MessageBox.Show("修改過泥砂顆粒數目,需重新輸入懸浮載水深平均濃度!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
p.suspendedLoadDepthAvgConcentration.Clear();
}
return true;
}
private bool ConvertBottomLevelNumber()
{
if (!ControllerUtility.CheckConvertInt32(ref p.bottomLevelNumber, bottomLevelNumberTxt, "請輸入正確的底床分層數目!", ControllerUtility.CheckType.GreaterThanThree))
{
return false;
}
if ((p.bottomLevelArray != null && p.bottomLevelArray.Length != p.bottomLevelNumber) ||
(p.sedimentCompositionArray != null && p.sedimentCompositionArray.GetLength(1) != p.bottomLevelNumber))
{
MessageBox.Show("修改過底床分層數目,需重新輸入底床分層厚度和泥砂組成比例!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
p.bottomLevelArray = null;
p.sedimentCompositionArray = null;
}
return true;
}
private bool ConvertSeabedComposition()
{
if (!ConvertBottomLevelNumber())
{
return false;
}
if (p.shenCohesiveSediment)
{ //凝聚性沉滓
if (p.surfaceErosion)
{ //表層沖刷
if (!ControllerUtility.CheckConvertDouble(ref p.surfaceErosionCoefficient, surfaceErosionCoefficientTxt, "請輸入正確的表層沖刷係數!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.surfaceErosionCriticalShearStress, surfaceErosionCriticalShearStressTxt, "請輸入正確的表層沖刷臨界剪應力!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
}
if (p.massiveErosion)
{ //塊狀沖蝕
if (!ControllerUtility.CheckConvertDouble(ref p.massiveErosionCriticalShearStress, massiveErosionCriticalShearStressTxt, "請輸入正確的塊狀沖蝕臨界剪應力!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
}
if (p.noErosionElevationUse)
{
//Check p.noErosionElevation
}
}
return true;
}
private bool ConvertTransSandMethod()
{
if (transSandMethodBtn.Enabled && p.sandTransportEquation == RiverSimulationProfile.SandTransportEquationType.None)
{
MessageBox.Show("請輸入正確的輸砂公式-一般輸砂公式 !", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
return true;
}
private bool ConvertBedrock()
{
if (!ControllerUtility.CheckConvertDouble(ref p.waterJettingAlpha, waterJettingAlphaTxt, "請輸入正確的水力沖刷常數α", ControllerUtility.CheckType.NoCheck))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.waterJettingBeta, waterJettingBetaTxt, "請輸入正確的水力沖刷常數β", ControllerUtility.CheckType.NoCheck))
{
return false;
}
return true;
}
private bool ConvertQuayStable()
{
if (!ControllerUtility.CheckConvertDouble(ref p.rockStableTimeSpacing, rockStableTimeSpacingTxt, "請輸入正確的岸壁穩定-時間間距", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if(!(p.analysisLeftBankStable || p.analysisRightBankStable))
{
MessageBox.Show("請至少選取一側岸壁穩定分析!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.leftSlopeToePosiotion, leftSlopeToePosiotionTxt, "請輸入正確的岸壁穩定-分析左岸岸壁穩定-坡腳位置!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.leftBankHeight, leftBankHeightTxt, "請輸入正確的岸壁穩定-分析左岸岸壁穩定-岸壁高度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.leftInitBankSlope, leftInitBankSlopeTxt, "請輸入正確的岸壁穩定-分析左岸岸壁穩定-初始岸壁坡度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.leftDikeToBankLength, leftDikeToBankLengthTxt, "請輸入正確的岸壁穩定-分析左岸岸壁穩定-堤防到岸壁的長度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.rightSlopeToePosiotion, rightSlopeToePosiotionTxt, "請輸入正確的岸壁穩定-分析右岸岸壁穩定-坡腳位置!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.rightBankHeight, rightBankHeightTxt, "請輸入正確的岸壁穩定-分析右岸岸壁穩定-岸壁高度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.rightInitBankSlope, rightInitBankSlopeTxt, "請輸入正確的岸壁穩定-分析右岸岸壁穩定-初始岸壁坡度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.rightDikeToBankLength, rightDikeToBankLengthTxt, "請輸入正確的岸壁穩定-分析右岸岸壁穩定-堤防到岸壁的長度!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilInternalFrictionAngle, bankSoilInternalFrictionAngleTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-內摩擦角!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilConductCoefficient, bankSoilConductCoefficientTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-傳導係數!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilBankScourCriticalStress, bankSoilBankScourCriticalStressTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-岸壁沖刷臨界剪應力!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilCohesion, bankSoilCohesionTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-凝聚力!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilAngleOfRepose, bankSoilAngleOfReposeTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-安息角!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
if (!ControllerUtility.CheckConvertDouble(ref p.bankSoilSpecificYield, bankSoilSpecificYieldTxt, "請輸入正確的岸壁穩定-岸壁土壤性質-比流率!", ControllerUtility.CheckType.GreaterThanZero))
{
return false;
}
return true;
}
private void SettingButton_Click(object sender, EventArgs e)
{
Button orgBtn = sender as Button;
if (orgBtn == valueParamBtn)
{
sp.SlidePanel(valueParamPanel, SliderPanel.Direction.ToRight, this.Size);
}
else if (orgBtn == physicalParamBtn)
{
sp.SlidePanel(physicalParamPanel, SliderPanel.Direction.ToRight, this.Size);
}
else if (orgBtn == transSandMethodBtn)
{
ControllerUtility.SetHtmlUrl(comment, "D2-4.html");
sp.SlidePanel(transSandMethodPanel, SliderPanel.Direction.ToRight, this.Size);
}
else if (orgBtn == seabedCompositionBtn)
{
sp.SlidePanel(seabedCompositionPanel, SliderPanel.Direction.ToRight, this.Size);
}
else if (orgBtn == rockbedBtn)
{
sp.SlidePanel(rockbedPanel, SliderPanel.Direction.ToRight, this.Size);
}
else if (orgBtn == rockStableBtn)
{
sp.SlidePanel(rockStablePanel, SliderPanel.Direction.ToRight, this.Size);
}
//else if (orgBtn == immersionBtn)
//{
// sp.SlidePanel(immersionPanel, SliderPanel.Direction.ToRight);
//}
}
private void Back_Click(object sender, EventArgs e)
{
//if (DoConvert())
//{
sp.SlidePanel(null, SliderPanel.Direction.Back, this.Size);
//}
ControllerUtility.SetHtmlUrl(comment, "Logo.html");
}
private void normalSandyFlowRdo_CheckedChanged(object sender, EventArgs e)
{
}
private void highSandyFlowRdo_CheckedChanged(object sender, EventArgs e)
{
}
private void selTranSandEquChk_CheckedChanged(object sender, EventArgs e)
{
}
private void selExpandEquChk_CheckedChanged(object sender, EventArgs e)
{
}
private void sedimentParticleSizeBtn_Click(object sender, EventArgs e)
{
RiverSimulationProfile p = RiverSimulationProfile.profile;
int n = 0;
try
{
n = Convert.ToInt32(sedimentParticlesNumberTxt.Text);
}
catch
{
n = -1;
}
if(n < 1)
{
MessageBox.Show("請輸入正確的泥砂顆粒數目", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
TableInputForm form = new TableInputForm();
form.SetFormMode(sedimentParticlesNumberBtn.Text, true, 1, n);
if (DialogResult.OK == form.ShowDialog())
{
}
}
private void DrawPreview()
{
//RiverSimulationProfile p = RiverSimulationProfile.profile;
if (p.bottomLevelArray == null)
{
return;
}
const int SedimentParticlesWidth = 215; //右方顯示泥砂顆粒狀態欄位寬度
const int SeabedLevelWidth = 215; //左方顯示底床分層狀態欄位寬度
const int SedimentParticlesLineHeight = 12; //右方顯示泥砂顆粒狀態文字高度
const int SeabedLevelLineHeight = 12; //左方顯示底床分層狀態文字高度
const int SeabedLevelGap = 8; //左方顯示底床分層狀態文字垂直間隔
const int SedimentParticlesGap = 8; //右方顯示泥砂顆粒狀態文字垂直間隔
Font leftFont = Control.DefaultFont;
Font rightFont = Control.DefaultFont;
//Font leftFont = new Font("微軟正黑體", SeabedLevelLineHeight, FontStyle.Regular, GraphicsUnit.Point);
//Font rightFont = new Font("微軟正黑體", SedimentParticlesLineHeight, FontStyle.Regular, GraphicsUnit.Point);
int cellH = (p.bottomLevelNumber * SedimentParticlesLineHeight) + (p.sedimentParticlesNumber + 1) * SedimentParticlesGap;
int w = SedimentParticlesWidth + SeabedLevelWidth;
int h = cellH * p.bottomLevelNumber;
Bitmap picBoxBmp = new Bitmap(w, h);
Graphics g = Graphics.FromImage(picBoxBmp);
Pen pen = new Pen(Color.Black, 1.0f);
SolidBrush leftBrush = new SolidBrush(Color.Black);
SolidBrush rightBrush = new SolidBrush(Color.Black);
Point pt1 = new Point(SeabedLevelWidth, 0);
Point pt2 = new Point(SeabedLevelWidth, h);
g.DrawLine(pen, pt1, pt2);
float startY = (cellH - SeabedLevelGap * 3 - SeabedLevelLineHeight * 2) / 2.0f;
for (int i = 0; i < p.bottomLevelArray.Length; ++i)
{
pt1 = new Point(0, cellH * (i + 1));
pt2 = new Point(w, cellH * (i + 1));
g.DrawLine(pen, pt1, pt2);
RectangleF rcLeftCell = new RectangleF(0, cellH * i, SeabedLevelWidth, cellH);
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
RectangleF rcLeftTxt1 = new RectangleF(0, startY, SeabedLevelWidth, SeabedLevelLineHeight + SeabedLevelGap);
string txt = "底床分層" + " " + (p.bottomLevelArray.Length - i).ToString();
if(i == 0)
{
txt = "作用層";
}
g.DrawString(txt, leftFont, leftBrush, rcLeftTxt1, stringFormat);
RectangleF rcLeftTxt2 = new RectangleF(0, startY + SeabedLevelGap + SeabedLevelLineHeight, SeabedLevelWidth, SeabedLevelLineHeight + SeabedLevelGap);
txt = "厚度 :" + " " + p.bottomLevelArray[p.bottomLevelArray.Length - i - 1].ToString() + "m";
g.DrawString(txt, leftFont, leftBrush, rcLeftTxt2, stringFormat);
startY += cellH;
if (p.sedimentCompositionArray == null)
{
continue;
}
//g.DrawRectangle(pen, rcLeftCell.X, rcLeftCell.Y, rcLeftCell.Width, SeabedLevelLineHeight);
int sedimentCount = p.sedimentCompositionArray.GetLength(0);
float startRY = cellH * i + SedimentParticlesGap / 2.0f;
StringFormat stringFormatR = new StringFormat();
stringFormatR.Alignment = StringAlignment.Near;
stringFormatR.LineAlignment = StringAlignment.Near;
for (int j = 0; j < p.sedimentCompositionArray.GetLength(0); ++j)
{
RectangleF rcRightText = new RectangleF(SeabedLevelWidth + 40, startRY, SedimentParticlesWidth, SeabedLevelLineHeight + SedimentParticlesGap);
txt = "泥砂顆粒 " + (j + 1).ToString() + " : " + p.sedimentCompositionArray[j, p.bottomLevelArray.Length - i - 1].ToString() + "%";
g.DrawString(txt, rightFont, rightBrush, rcRightText, stringFormatR);
startRY += SeabedLevelLineHeight + SedimentParticlesGap;
//g.DrawRectangle(pen, rcLeftCell.X, rcLeftCell.Y, rcLeftCell.Width, SeabedLevelLineHeight);
}
}
g.Dispose();
this.previewSedimentCompositionPicBox.Image = picBoxBmp;
int picW = (previewSedimentCompositionPicBox.Width > w) ? previewSedimentCompositionPicBox.Width : w;
int picH = (previewSedimentCompositionPicBox.Height > h) ? previewSedimentCompositionPicBox.Height : h;
previewSedimentCompositionPicBox.Width = picW;
previewSedimentCompositionPicBox.Height = picH;
previewSedimentCompositionPanel.AutoScrollMinSize = new Size(w, h);
}
private void noScourElevationBtn_Click(object sender, EventArgs e)
{
TableInputForm form = new TableInputForm();
form.SetFormMode(noErosionElevationChk.Text, p.inputGrid.GetJ, p.inputGrid.GetI, "", "", "",
TableInputForm.InputFormType.TwoInOneDouble, 90, 120, false, false, false, p.noErosionElevation);
DialogResult r = form.ShowDialog();
if (DialogResult.OK == r)
{
p.noErosionElevation = new RiverSimulationProfile.TwoInOne(form.GenericTwoInOneData());
}
}
//private void selTransSandMethodChk_CheckedChanged(object sender, EventArgs e)
//{
// bool chk = (sender as CheckBox).Checked;
// selTransSandMethodCombo.Enabled = chk;
//}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void alluviumChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
//cohesiveSedimentPanel.Enabled = chk;
}
private void alluviumPanel_EnabledChanged(object sender, EventArgs e)
{
// bool eab = (sender as Panel).Enabled;
// seabedCompositionChk.Enabled = eab;
// noScourElevationBtn.Enabled = eab;
}
private void analysisPositionChk_CheckedChanged(object sender, EventArgs e)
{
}
private void infiltrationEffectChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
analysisLeftBankStablePanel.Enabled = chk;
}
private void quaySoilPropertiesChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
bankSoilPropertiesPanel.Enabled = chk;
}
private void sedimentParticlesNumTxt_MouseHover(object sender, EventArgs e)
{
ControllerUtility.SetHtmlUrl(comment, "D1-2-1-3.html");
}
//============================================================================================================================
private void outputControlBottomElevationChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.outputControlBottomElevation = chk;
}
private void outputControlAverageDepthDensityChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.outputControlAverageDepthDensity = chk;
}
private void outputControlErosionDepthChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.outputControlErosionDepth = chk;
}
private void outputControlDensityInformation3DChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.outputControlDensityInformation3D = chk;
}
private void diffusionFormulaChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.diffusionFormulaUse = chk;
UpdateStatus();
}
private void diffusionFormulaCombo_SelectedIndexChanged(object sender, EventArgs e)
{
p.diffusionFormula = (RiverSimulationProfile.DiffusionFormulaType)((sender as ComboBox).SelectedIndex + 1);
}
private void sedimentParticlesNumberBtn_Click(object sender, EventArgs e)
{
if (!ConvertSedimentParticlesNumber())
{
return;
}
TableInputForm form = new TableInputForm();
form.SetFormMode(sedimentParticlesNumberBtn.Text, 1, p.sedimentParticlesNumber, "", "泥砂粒徑", "",
TableInputForm.InputFormType.GenericDouble, 90, 120, true, true, false, p.sedimentParticleSize);
DialogResult r = form.ShowDialog();
if (DialogResult.OK == r)
{
p.sedimentParticleSize = (double[,])form.GenericDoubleData().Clone();
}
}
private void seabedThicknessBtn_Click(object sender, EventArgs e)
{
if (!ConvertBottomLevelNumber())
{
return;
}
TableInputForm form = new TableInputForm();
form.SetFormMode(bottomLevelBtn.Text, 1, p.bottomLevelNumber, bottomLevelBtn.Text, "底床分層厚度", "底床分層",
TableInputForm.InputFormType.SeabedThicknessForm, 90, 120, true, true, false, p.bottomLevelArray);
DialogResult r = form.ShowDialog();
if (DialogResult.OK == r)
{
p.bottomLevelArray = (double[])form.SeabedThicknessData().Clone();
SwitchPreivewCombo(PreviewType.SedimentComposition);
DrawPreview();
}
}
private void sedimentCompositionRatioBtn_Click(object sender, EventArgs e)
{
if(!ConvertSedimentParticlesNumber())
{
return;
}
if (!ConvertBottomLevelNumber())
{
return;
}
TableInputForm form = new TableInputForm();
form.SetFormMode(sedimentCompositionBtn.Text, p.sedimentParticlesNumber, p.bottomLevelNumber, sedimentCompositionBtn.Text, "泥砂顆粒", "底床分層",
TableInputForm.InputFormType.SedimentCompositionRatioForm, 90, 120, true, false, false, p.sedimentCompositionArray);
DialogResult r = form.ShowDialog();
if (DialogResult.OK == r)
{
p.sedimentCompositionArray = (double[,])form.SedimentCompositionRatioData().Clone();
DrawPreview();
}
}
private void shenCohesiveSedimentChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.shenCohesiveSediment = chk;
shenCohesiveSedimentPanel.Enabled = chk;
}
private void surfaceErosionChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.surfaceErosion = chk;
surfaceErosionCoefficientTxt.Enabled = chk;
surfaceErosionCriticalShearStressTxt.Enabled = chk;
}
private void massiveErosionChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.massiveErosion = chk;
massiveErosionCriticalShearStressTxt.Enabled = chk;
}
private void noErosionElevationChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.noErosionElevationUse = chk;
noErosionElevationBtn.Enabled = chk;
}
private void sandTransportEquationRdo_CheckedChanged(object sender, EventArgs e)
{
RadioButton rdo = sender as RadioButton;
if(rdo == sandTransportEquation1Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation1;
}
else if (rdo == sandTransportEquation2Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation2;
}
else if (rdo == sandTransportEquation3Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation3;
}
else if (rdo == highSandTransportEquation1Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation1;
}
else if (rdo == highSandTransportEquation2Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation2;
}
else if (rdo == highSandTransportEquation3Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.SandTransportEquation3;
}
else if (rdo == highSandTransportEquation4Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation4;
}
else if (rdo == highSandTransportEquation5Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation5;
}
else if (rdo == highSandTransportEquation6Rdo)
{
p.sandTransportEquation = RiverSimulationProfile.SandTransportEquationType.HighSandTransportEquation6;
}
}
//岩床===========================================================================================================
private void waterJettingChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.waterJetting = chk;
waterJettingAlphaTxt.Enabled = chk;
waterJettingBetaTxt.Enabled = chk;
}
private void sedimentErosionChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.sedimentErosion = chk;
sedimentErosionElasticModulusValueBtn.Enabled = chk;
sedimentErosionTensileStrengthValueBtn.Enabled = chk;
}
private void bedrockElevationChk_CheckedChanged(object sender, EventArgs e)
{
bool chk = (sender as CheckBox).Checked;
p.bedrockElevation = chk;
bedrockElevationValueBtn.Enabled = chk;
}
private void elasticityBtn_Click(object sender, EventArgs e)
{
TableInputForm form = new TableInputForm();
form.SetFormMode(sedimentErosionElasticModulusValueBtn.Text, false, p.inputGrid.GetJ, p.inputGrid.GetI); //二選一
if (DialogResult.OK == form.ShowDialog())
{
}
}
private void tensileStrengthBtn_Click(object sender, EventArgs e)
{
TableInputForm form = new TableInputForm();
form.SetFormMode(sedimentErosionTensileStrengthValueBtn.Text, false, p.inputGrid.GetJ, p.inputGrid.GetI); //二選一
if (DialogResult.OK == form.ShowDialog())
{
}
}
private void bedrockElevationBtn_Click(object sender, EventArgs e)