From 22e1f3211a078ba498f35069c3db420dc388b164 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 24 九月 2024 13:09:51 +0800
Subject: [PATCH] bimface 优化

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  150 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 91 insertions(+), 59 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 ed1b412..dacb9a8 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
@@ -171,67 +171,9 @@
 
 
 
-        //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);
-                        }
-                    }
-                }
-            }
-        }
+
 
 
 
@@ -339,6 +281,24 @@
             ShowProperty();
         }
 
+        #region Bimface
+
+        //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 姘村姏鏍¢獙
 
         //姘村姏楠岃瘉
@@ -446,5 +406,77 @@
 
         #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)
+                    {
+                        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);
+        }
+
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3