lixiaojun
2024-10-12 f661d7da8be688bfbe5c4977dc68223b5aa63959
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
global using Yw.EPAnet;
using NetTaste;
 
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationCorePage : DocumentPage
    {
        public XhsProjectSimulationCorePage()
        {
            InitializeComponent();
            this.PageTitle.Caption = "水力模拟";
            this.PageTitle.HeaderSvgImage = this.svgImg32[0];
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
 
        }
 
        private HStation.Vmo.XhsProjectVmo _project = null;//项目
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
 
        private Yw.Model.HydroParterInfo _parter = null;
        private Yw.WinFrmUI.HydroCheckResult _checkResult = null;
        private Yw.EPAnet.CalcuResult _calcuResult = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData
            (
                HStation.Vmo.XhsProjectVmo project,
                HStation.Vmo.XhsProjectSiteVmo projectSite,
                Yw.Model.HydroModelInfo hydroInfo
            )
        {
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            _hydroInfo = hydroInfo;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            if (_hydroInfo == null)
            {
                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
            }
        }
 
        /// <summary>
        /// 初始化数据
        /// </summary>
        public override async void InitialDataSource()
        {
            base.InitialDataSource();
            if (_project == null)
            {
                return;
            }
            this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟";
            await this.xhsProjectSimulationBimfaceCtrl1.SetBindingData(_project, _projectSite, () => _hydroInfo);
            this.xhsProjectSimulationQ3dCtrl1.SetBindingData(_hydroInfo);
            this.xhsProjectSimulationPropertyCtrl1.InitialData(() => _hydroInfo);
        }
 
 
 
        #region Bimface
 
        //bimface 加载完成事件
        private async void xhsProjectSimulationBimfaceCtrl1_LoadCompletedEvent()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var elementIds = new List<string>();
            var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.PumpStatus.Open).ToList();
            pumps?.ForEach(x => elementIds.Add(x.Code));
            var valves = _hydroInfo.Valves?.Where(x => x.LinkStatus == Yw.Hydro.ValveStatus.Open).ToList();
            valves?.ForEach(x => elementIds.Add(x.Code));
            await this.xhsProjectSimulationBimfaceCtrl1.SetOpenComponentsColor(elementIds);
        }
 
        //bimface 水力点击事件
        private void xhsProjectSimulationBimfaceCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo obj)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            _parter = obj;
            ShowProperty();
            SetBimfaceLinkColor();
        }
 
        //设置Bimface连接颜色
        private async void SetBimfaceLinkColor()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var elementIds = new List<string>();
            if (_parter != null)
            {
                if (_parter is Yw.Model.HydroLinkInfo linker)
                {
                    var allParterList = _hydroInfo.GetAllParters();
                    var allLinkerList = _hydroInfo.GetAllLinks();
                    var startParter = allParterList?.Find(x => x.Code == linker.StartCode);
                    if (startParter != null)
                    {
                        if (startParter.GetType() == typeof(Yw.Model.HydroJunctionInfo))
                        {
                            var startLinkList = allLinkerList?.Where(x => x.StartCode == startParter.Code || x.EndCode == startParter.Code).ToList();
                            if (startLinkList != null)
                            {
                                elementIds.AddRange(startLinkList.Select(x => x.Code).Where(x => x != _parter.Code));
                            }
                        }
                        else
                        {
                            elementIds.Add(linker.StartCode);
                        }
                    }
                    var endParter = allParterList?.Find(x => x.Code == linker.EndCode);
                    if (endParter != null)
                    {
                        if (endParter.GetType() == typeof(Yw.Model.HydroJunctionInfo))
                        {
                            var endLinkList = allLinkerList?.Where(x => x.StartCode == endParter.Code || x.EndCode == endParter.Code).ToList();
                            if (endLinkList != null)
                            {
                                elementIds.AddRange(endLinkList.Select(x => x.Code).Where(x => x != _parter.Code));
                            }
                        }
                        else
                        {
                            elementIds.Add(linker.EndCode);
                        }
                    }
                }
            }
            await this.xhsProjectSimulationBimfaceCtrl1.SetLinkComponentsColor(elementIds);
        }
 
        #endregion
 
        #region Q3d
 
        //点击事件
        private void xhsProjectSimulationQ3dCtrl1_ClickParterEvent(string code)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var allParterList = _hydroInfo.GetAllParters();
            _parter = allParterList?.Find(x => x.Code == code);
            ShowProperty();
        }
 
        #endregion
 
        #region 属性面板
 
 
 
        #endregion
 
        #region 自动匹配
 
        //获取匹配列表控件
        private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl()
        {
            if (_matchingListCtrl == null)
            {
                _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl();
                _matchingListCtrl.Dock = DockStyle.Fill;
                _matchingListCtrl.HydroClickEvent += async (code) =>
                {
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == code);
                    var elementIds = new List<string>();
                    if (_parter != null)
                    {
                        elementIds.Add(_parter.Code);
                    }
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
                    SetBimfaceLinkColor();
                };
                _matchingListCtrl.ApplyMatchingEvent += (output) =>
                {
                    if (_hydroInfo == null)
                    {
                        return false;
                    }
                    return AssetsMatchingParasHelper.Apply(_hydroInfo, output);
                };
            }
            return _matchingListCtrl;
        }
        //匹配列表控件
        private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null;
 
        //自动匹配
        private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            this.controlContainerBottom.Controls.Clear();
            var matchingListCtrl = GetMatchingListCtrl();
            var input = AssetsMatchingParasHelper.Create(_hydroInfo);
            matchingListCtrl.SetBindingData(input);
            this.controlContainerBottom.Controls.Add(matchingListCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "匹配列表";
            this.docPnlBottom.Height = 350;
        }
 
 
        #endregion
 
        #region 未匹配列表
 
        //获取未匹配列表控件
        private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl()
        {
            if (_unMatchingListCtrl == null)
            {
                _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl();
                _unMatchingListCtrl.Dock = DockStyle.Fill;
                _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击
                {
                    if (parter == null)
                    {
                        return;
                    }
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == parter.Code);
                    var elementIds = new List<string>() { parter.Code };
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
                    SetBimfaceLinkColor();
                };
                _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型
                {
                    var codes = parters?.Select(x => x.Code).Distinct().ToList();
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(codes);
                    _parter = null;
                    ShowProperty();
                };
            }
            return _unMatchingListCtrl;
        }
        private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表
 
        //未匹配列表
        private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            this.controlContainerBottom.Controls.Clear();
            var unMatchingListCtrl = GetUnMatchingListCtrl();
            unMatchingListCtrl.SetBindingData(_hydroInfo);
            this.controlContainerBottom.Controls.Add(unMatchingListCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "未匹配列表";
            this.docPnlBottom.Height = 350;
        }
 
 
 
        #endregion
 
        #region 一键显隐
 
        //显隐编码列表
        private List<string> _fastShowHideCodeList = null;
 
        //触发一键显隐
        private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1)
            {
                return;
            }
            if (_fastShowHideCodeList == null)
            {
                _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList();
                await this.xhsProjectSimulationBimfaceCtrl1.HideComponents(_fastShowHideCodeList);
            }
            else
            {
                await this.xhsProjectSimulationBimfaceCtrl1.ShowComponents(_fastShowHideCodeList);
                _fastShowHideCodeList = null;
            }
        }
 
        #endregion
 
        #region 水力校验
 
        //获取校验结果控件
        private XhsProjectSimulationHydroCheckResultCtrl GetCheckResultCtrl()
        {
            if (_checkResultCtrl == null)
            {
                _checkResultCtrl = new XhsProjectSimulationHydroCheckResultCtrl();
                _checkResultCtrl.Dock = DockStyle.Fill;
                _checkResultCtrl.HydroClickEvent += async (code) =>
                {
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                    var elementIds = new List<string>();
                    if (string.IsNullOrEmpty(code))
                    {
                        _parter = null;
                    }
                    else
                    {
                        var allParterList = _hydroInfo.GetAllParters();
                        _parter = allParterList?.Find(x => x.Code == code);
                        if (_parter != null)
                        {
                            elementIds.Add(_parter.Code);
                        }
                    }
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
                    SetBimfaceLinkColor();
                };
            }
            return _checkResultCtrl;
        }
        //校验结果控件
        private XhsProjectSimulationHydroCheckResultCtrl _checkResultCtrl = null;
 
        //水力验证
        private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            _checkResult = _hydroInfo.Check();
            this.controlContainerBottom.Controls.Clear();
            var checkResultCtrl = GetCheckResultCtrl();
            checkResultCtrl.SetBindingData(_checkResult);
            this.controlContainerBottom.Controls.Add(checkResultCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "校验结果";
            this.docPnlBottom.Height = 350;
        }
 
        #endregion
 
        #region 保存水力信息
 
        //保存
        private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo);
            if (id < 1)
            {
                TipFormHelper.ShowError("保存失败!");
                return;
            }
            _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id);
            TipFormHelper.ShowSucceed("保存成功!");
        }
 
        #endregion
 
        #region 构件明细
 
        //获取构件明细控件
        private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl()
        {
            if (_parterListCtrl == null)
            {
                _parterListCtrl = new HydroParterListCtrl();
                _parterListCtrl.Dock = DockStyle.Fill;
                _parterListCtrl.HydroClickEvent += async (parter) =>
                {
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == parter.Code);
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(new List<string>() { _parter.Code });
                    ShowProperty();
                    SetBimfaceLinkColor();
                };
            }
            return _parterListCtrl;
        }
        //构件明细控件
        private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null;
 
        //水力构件列表
        private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            this.controlContainerBottom.Controls.Clear();
            var parterListCtrl = GetParterListCtrl();
            parterListCtrl.SetBindingData(_hydroInfo);
            this.controlContainerBottom.Controls.Add(parterListCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "构件明细";
            this.docPnlBottom.Height = 350;
        }
 
 
        #endregion
 
        #region INP导出
 
        //导出水力INP文件
        private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("导出Inp文件");
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
            var result = netWork.ToInpString();
            File.WriteAllText(fileName, result);
            TipFormHelper.ShowSucceed("导出成功");
        }
 
        #endregion
 
        #region 业务方法
 
        //显示属性
        private void ShowProperty()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            if (_parter == null)
            {
                this.xhsProjectSimulationPropertyCtrl1.SelectParter(null);
                return;
            }
            this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code);
            if (_calcuResult != null)
            {
                if (_calcuResult.Succeed)
                {
                    var allCalcuParterList = _calcuResult.GetParterList();
                    var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code);
                    if (calcuParter != null)
                    {
                        IHydroCalcuResult calcuProperty = null;
                        if (calcuParter is Yw.EPAnet.CalcuNode calcuNode)
                        {
                            var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeResult();
                            calcuNodeProperty.Code = _parter.Code;
                            calcuNodeProperty.CalcuPress = calcuNode.Press;
                            calcuNodeProperty.CalcuDemand = calcuNode.Demand;
                            calcuNodeProperty.CalcuHead = calcuNode.Head;
                            calcuProperty = calcuNodeProperty;
                        }
                        else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink)
                        {
                            var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkResult();
                            calcuLinkProperty.Code = _parter.Code;
                            calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss;
                            calcuLinkProperty.CalcuFlow = calcuLink.Flow;
                            calcuLinkProperty.CalcuVelocity = calcuLink.Velocity;
                            calcuProperty = calcuLinkProperty;
                        }
 
                        if (calcuProperty != null)
                        {
                            this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty);
                        }
                    }
                }
            }
        }
 
        #endregion
 
        #region 配置
 
        //显示RadialMenu
        private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.rmSet.ShowPopup(MousePosition, true);
        }
 
        #endregion
 
        #region 性能曲线
 
        //性能曲线
        private void barBtnFeatCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            if (_calcuResult == null)
            {
                return;
            }
            if (!_calcuResult.Succeed)
            {
                return;
            }
            var pumps = _hydroInfo.Pumps;
            var vmList = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>();
            foreach (var x in pumps)
            {
                var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel();
                vm.Id = x.Code;
                vm.Name = x.Code;
                //vm.IsBp = ;
                //vm.RatedSpeed = 590;
                //vm.CurrentSpeed = 590;
                //vm.CurrentHz = 50;
                var PointsQH = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQH)?.CurveData?.Select(z => new Yw.Geometry.Point2d() { X = z.X, Y = z.Y }).ToList();
                var PointsQP = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQP)?.CurveData?.Select(z => new Yw.Geometry.Point2d { X = z.X, Y = z.Y }).ToList();
                var PointsQE = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQE)?.CurveData?.Select(z => new Yw.Geometry.Point2d { X = z.X, Y = z.Y }).ToList();
 
                vm.Qh = new Yw.Geometry.CubicSpline2d(PointsQH);
                vm.Qe = new Yw.Geometry.CubicSpline2d(PointsQE);
                vm.Qp = new Yw.Geometry.CubicSpline2d(PointsQP);
                vmList.Add(vm);
            }
            var dlg = new HStation.WinFrmUI.PhartRelation.PumpSerialParallelChartDlg();
            dlg.SetBindingData(vmList, null, true);
            dlg.ShowDialog();
        }
 
        #endregion
 
        #region 水力计算
 
 
        //获取计算控件
        private XhsProjectSimulationCalcuCtrl GetCalcuCtrl()
        {
            if (_calcuCtrl == null)
            {
                _calcuCtrl = new XhsProjectSimulationCalcuCtrl();
                _calcuCtrl.Dock = DockStyle.Fill;
                _calcuCtrl.CancelEvent += () =>
                    {
                        this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
                    };
                _calcuCtrl.OkEvent += async () =>
                    {
                        if (_hydroInfo == null)
                        {
                            return;
                        }
                        var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
                        _calcuResult = netWork.Calcu();
                        if (_calcuResult.Succeed)
                        {
                            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
                            ShowProperty();
                            TipFormHelper.ShowSucceed("计算成功!");
                            await this.xhsProjectSimulationBimfaceCtrl1.ShowCalcuCustomLabels(_calcuResult);
                        }
                        else
                        {
                            _calcuCtrl.SetBindingData(_calcuResult.FailedList);
                            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
                            this.docPnlBottom.Text = "水力计算失败原因";
                            this.docPnlBottom.Height = 350;
                        }
 
                    };
            }
            return _calcuCtrl;
        }
        private XhsProjectSimulationCalcuCtrl _calcuCtrl = null;//计算控件
 
        //水力计算
        private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
 
            this.controlContainerBottom.Controls.Clear();
            var calcuCtrl = GetCalcuCtrl();
            calcuCtrl.SetBindingData(_hydroInfo);
            this.controlContainerBottom.Controls.Add(calcuCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "水力计算前提条件";
            this.docPnlBottom.Height = 350;
        }
 
 
 
        #endregion
 
        #region 构件查询
 
        //获取查询组件
        private XhsProjectSimulationSearchCtrl GetSearchCtrl()
        {
            if (_searchCtrl == null)
            {
                _searchCtrl = new XhsProjectSimulationSearchCtrl();
                _searchCtrl.Dock = DockStyle.Fill;
                _searchCtrl.InitialData(() => _hydroInfo);
                _searchCtrl.ApplySearchEvent += async (list) =>
                {
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                    var elementIds = new List<string>();
                    if (list != null && list.Count > 0)
                    {
                        var first = list.First();
                        var allParterList = _hydroInfo.GetAllParters();
                        _parter = allParterList?.Find(x => x.Code == first.Code);
                        list.ForEach(x => elementIds.Add(x.Code));
                    }
                    else
                    {
                        _parter = null;
                    }
                    await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
                    SetBimfaceLinkColor();
                };
            }
            return _searchCtrl;
        }
        private XhsProjectSimulationSearchCtrl _searchCtrl = null;//查询组件
 
        //查询
        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
 
            this.controlContainerBottom.Controls.Clear();
            var searchCtrl = GetSearchCtrl();
            this.controlContainerBottom.Controls.Add(searchCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "模型构件查询";
            this.docPnlBottom.Height = 350;
        }
 
        #endregion
 
 
 
    }
}