From cfe5793ec364b38ef9d775a5fdc769a56383d18b Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 24 九月 2024 15:48:40 +0800
Subject: [PATCH] 标签调试

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  315 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 195 insertions(+), 120 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 8f94a57..a783f69 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -4,6 +4,7 @@
 using HStation.WinFrmUI.Xhs.Core;
 using NPOI.SS.Formula.Functions;
 using Yw.WinFrmUI.HydroL2d;
+using Yw.WinFrmUI.HydroL3d;
 
 namespace HStation.WinFrmUI
 {
@@ -105,32 +106,10 @@
             }
         }
 
-        //姘村姏楠岃瘉
-        private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
-            this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
-            this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
-            this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
 
-            var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
-            _checkResult = netWork.Check();
-            if (_checkResult.Succeed)
-            {
-                TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�");
-                return;
-            }
-            this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList);
-            this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlHydroCheck.Height = 350;
-        }
 
         //姘村姏璁$畻
-        private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        private async void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             if (_hydroInfo == null)
             {
@@ -147,11 +126,14 @@
             {
                 ShowProperty();
                 TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�");
-                return;
             }
-            this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList);
-            this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlHydroCalcu.Height = 350;
+            else
+            {
+                this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList);
+                this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlHydroCalcu.Height = 350;
+            }
+            await this.xhsProjectSimulationBimfaceCtrl1.ShowCalcuCustomLabels(_calcuResult);
         }
 
         //姘村姏鏋勪欢鍒楄〃
@@ -192,85 +174,11 @@
 
 
 
-        //bimface 鏋勪欢鐐瑰嚮
-        private void xhsProjectSimulationBimfaceCtrl1_ClickParterEvent(string objectId)
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var allParterList = _hydroInfo.GetAllParters();
-            _parter = allParterList.Find(x => x.Code == objectId);
-            ShowProperty();
-        }
 
-        //鏄剧ず灞炴��
-        private void ShowProperty()
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            if (_parter == null)
-            {
-                return;
-            }
-            var allParterList = _hydroInfo.GetAllParters();
-            this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter, allParterList);
-            if (_calcuResult != null)
-            {
-                if (_calcuResult.Succeed)
-                {
-                    var allCalcuParterList = _calcuResult.GetParterList();
-                    var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code);
-                    if (calcuParter != null)
-                    {
-                        IHydroCalcuProperty calcuProperty = null;
-                        if (calcuParter is Yw.EPAnet.CalcuNode calcuNode)
-                        {
-                            var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeProperty();
-                            calcuNodeProperty.ID = _parter.ID;
-                            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.HydroCalcuLinkProperty();
-                            calcuLinkProperty.ID = _parter.ID;
-                            calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss;
-                            calcuLinkProperty.CalcuFlow = calcuLink.Flow;
-                            calcuLinkProperty.CalcuVelocity = calcuLink.Velocity;
-                            calcuProperty = calcuLinkProperty;
-                        }
 
-                        if (calcuProperty != null)
-                        {
-                            this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty);
-                        }
-                    }
-                }
-            }
-        }
 
-        //淇濆瓨
-        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);
-            //this.xhsProjectSimulationPropertyCtrl1.SetMatching(_hydroInfo);
-            TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�");
-        }
+
+
 
         //鑷姩鍖归厤
         private void barBtnAllAutoMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -365,24 +273,7 @@
                  };
         }
 
-        private void BtnPerformChart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            var dlg = new PerformChart();
-            dlg.ShowDialog();
-        }
 
-        //姘村姏鏍¢獙鐐瑰嚮
-        private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string obj)
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { obj });
-            var allParterList = _hydroInfo.GetAllParters();
-            _parter = allParterList.Find(x => x.Code == obj);
-            ShowProperty();
-        }
 
         //姘村姏鏋勪欢鏄庣粏闈㈡澘鐐瑰嚮浜嬩欢
         private async void hydroParterListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter)
@@ -392,6 +283,73 @@
             await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { _parter.Code });
             ShowProperty();
         }
+
+        #region Bimface
+
+        //鑾峰彇姘村姏淇℃伅
+        private Yw.Model.HydroModelInfo xhsProjectSimulationBimfaceCtrl1_GetHydroInfoEvent()
+        {
+            return _hydroInfo;
+        }
+
+        //bimface 鏋勪欢鐐瑰嚮
+        private void xhsProjectSimulationBimfaceCtrl1_ClickParterEvent(string objectId)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            var allParterList = _hydroInfo.GetAllParters();
+            _parter = allParterList.Find(x => x.Code == objectId);
+            ShowProperty();
+            SetBimfaceLinkColor();
+        }
+
+
+        #endregion
+
+        #region 姘村姏鏍¢獙
+
+        //姘村姏楠岃瘉
+        private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+            this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+            this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+            this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+            this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
+
+            var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
+            _checkResult = netWork.Check();
+            if (_checkResult.Succeed)
+            {
+                TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�");
+                return;
+            }
+            this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList);
+            this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+            this.docPnlHydroCheck.Height = 350;
+        }
+
+        //姘村姏鏍¢獙鐐瑰嚮
+        private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string code)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            var allParterList = _hydroInfo.GetAllParters();
+            _parter = allParterList.Find(x => x.Code == code);
+            var elementIds = new List<string>() { _parter.Code };
+            await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds);
+            ShowProperty();
+        }
+
+        #endregion
 
         #region 鏈尮閰嶅垪琛�
 
@@ -435,5 +393,122 @@
 
         #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
+
+        private void barBtnOpenView_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            SetBimfaceOpenColor();
+        }
+
+        #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)
+                    {
+                        IHydroCalcuProperty calcuProperty = null;
+                        if (calcuParter is Yw.EPAnet.CalcuNode calcuNode)
+                        {
+                            var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeProperty();
+                            calcuNodeProperty.ID = _parter.ID;
+                            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.HydroCalcuLinkProperty();
+                            calcuLinkProperty.ID = _parter.ID;
+                            calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss;
+                            calcuLinkProperty.CalcuFlow = calcuLink.Flow;
+                            calcuLinkProperty.CalcuVelocity = calcuLink.Velocity;
+                            calcuProperty = calcuLinkProperty;
+                        }
+
+                        if (calcuProperty != null)
+                        {
+                            this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty);
+                        }
+                    }
+                }
+            }
+        }
+
+        //璁剧疆Bimface杩炴帴棰滆壊
+        private async void SetBimfaceLinkColor()
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            List<string> elementIds = null;
+            if (_parter != null)
+            {
+                if (_parter is Yw.Model.HydroLinkInfo linker)
+                {
+                    elementIds = new List<string>() { linker.StartCode, linker.EndCode };
+                }
+            }
+            await this.xhsProjectSimulationBimfaceCtrl1.SetLinkComponentsColor(elementIds);
+        }
+
+        //璁剧疆Bimface Open 棰滆壊
+        private async void SetBimfaceOpenColor()
+        {
+            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);
+        }
+
+        #endregion
+
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3