From 9aa8106d88fc3070498493e2819922f7ac31746e Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期三, 09 四月 2025 15:09:05 +0800
Subject: [PATCH] 增加BIMFACE水流动画效果

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  101 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 75 insertions(+), 26 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 94c7f81..a86a496 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -2,10 +2,11 @@
 using DevExpress.Mvvm.Native;
 using DevExpress.Pdf.Native;
 using Mapster;
-using Yw.EPAnet;
+using Yw.Epanet;
 using Yw.Hydro;
 using Yw.Model;
 using Yw.Vmo;
+using Yw.WinFrmUI.Bimface;
 
 namespace HStation.WinFrmUI
 {
@@ -115,7 +116,7 @@
         {
             base.InitialDataSource();
             ShowBimfaceCtrl();
-            ShowQ3dCtrl();
+            ShowL3d2Ctrl();
             ShowPropertyCtrl();
             InitialSvgImages();
         }
@@ -365,42 +366,42 @@
 
         #endregion BIM鎺т欢
 
-        #region Q3d鎺т欢
+        #region L3d2鎺т欢
 
-        //Q3d 鎺т欢
-        private XhsProjectSimulationQ3dCtrl _q3dCtrl = null;
+        //L3d2鎺т欢
+        private XhsProjectSimulationL3d2Ctrl _l3d2ctrl = null;
 
-        //鑾峰彇 Q3d 鎺т欢
-        private XhsProjectSimulationQ3dCtrl GetQ3dCtrl()
+        //鑾峰彇L3d2鎺т欢
+        private XhsProjectSimulationL3d2Ctrl GetL3d2Ctrl()
         {
             if (_hydroInfo == null)
             {
                 return default;
             }
-            if (_q3dCtrl == null)
+            if (_l3d2ctrl == null)
             {
-                _q3dCtrl = new XhsProjectSimulationQ3dCtrl();
-                _q3dCtrl.Dock = DockStyle.Fill;
-                _q3dCtrl.InitialData(() => _hydroInfo);
-                _q3dCtrl.SelectedPartersChangedEvent += (codes) =>
+                _l3d2ctrl = new XhsProjectSimulationL3d2Ctrl();
+                _l3d2ctrl.Dock = DockStyle.Fill;
+                _l3d2ctrl.InitialData(hydroInfoFunc: () => _hydroInfo);
+                _l3d2ctrl.SelectedPartersChangedEvent += (codes) =>
                 {
                     var visualListHelper = GetVisualListHelper();
                     var visuals = visualListHelper.GetVisualList(codes);
                     SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d);
                 };
             }
-            return _q3dCtrl;
+            return _l3d2ctrl;
         }
 
-        //鏄剧ず Q3d 鎺т欢
-        private void ShowQ3dCtrl()
+        //鏄剧ずL3d2鎺т欢
+        private void ShowL3d2Ctrl()
         {
-            var q3dCtrl = GetQ3dCtrl();
+            var l3d2Ctrl = GetL3d2Ctrl();
             this.tabPageQ3d.Controls.Clear();
-            this.tabPageQ3d.Controls.Add(q3dCtrl);
+            this.tabPageQ3d.Controls.Add(l3d2Ctrl);
         }
 
-        #endregion Q3d鎺т欢
+        #endregion
 
         #region 灞炴�ф帶浠�
 
@@ -488,6 +489,13 @@
                     var gradingHelper = await GetGradingHelper();
                     gradingHelper.Set(visual);
                 };
+                _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (visual) =>
+                {
+                    //娴佸悜灞炴�у彂鐢熸敼鍙�
+                    //鍒ゆ柇褰撳墠鏄惁鏈夋祦鍚戝睍绀猴紝鑻ユ湁鍒欐洿鏂版祦鍚戯紝鏈�濂芥槸鏇存柊鍗曚釜娴佸悜
+                    var flowDirectionHelper = await GetFlowEffectHelper();
+                    flowDirectionHelper.Set(visual);
+                };
             }
             return _propertyCtrl;
         }
@@ -512,7 +520,7 @@
         }
 
         //鏄剧ず灞炴�ф帶浠�
-        private async void ShowPropertyCtrl()
+        private async Task ShowPropertyCtrl()
         {
             if (IsPropertyCtrlVisible)
             {
@@ -527,9 +535,9 @@
         }
 
         //璁剧疆灞炴�ф帶浠�
-        private void SetPropertyCtrl(HydroVisualInfo visual)
+        private async void SetPropertyCtrl(HydroVisualInfo visual)
         {
-            ShowPropertyCtrl();
+            await ShowPropertyCtrl();
             var visualVmListHelper = GetVisualVmListHelper();
             var vm = visualVmListHelper.GetVisual(visual);
             _propertyCtrl.SelectedObject = vm;
@@ -542,7 +550,7 @@
             _propertyCtrl?.UpdateRows();
         }
 
-        #endregion 灞炴�ф帶浠�
+        #endregion
 
         #region 閫夋嫨鏋勪欢
 
@@ -1761,7 +1769,42 @@
             markHelper.Set();
         }
 
-        #endregion 妯″瀷鏍囨敞
+        #endregion
+
+        #region 姘存祦鍔ㄧ敾
+
+
+        //姘村姏鍔ㄧ敾杈呭姪绫�
+        private SimulationFlowEffectHelper _flowEffectHelper = null;
+
+        //鑾峰彇姘存祦鍔ㄧ敾杈呭姪绫�
+        private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper()
+        {
+            if (_flowEffectHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var calcuResultHelper = GetCalcuResultHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, calcuResultHelper, bimfaceCtrl);
+            }
+            return _flowEffectHelper;
+        }
+
+
+        //姘存祦鍔ㄧ敾鏄惁鍙
+        private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (this.barCkFlowEffect.Checked)
+            {
+                this.barCkGrading.Checked = false;
+            }
+            var flowEffectHelper = await GetFlowEffectHelper();
+            flowEffectHelper.Visible = this.barCkFlowEffect.Checked;
+            flowEffectHelper.Set();
+
+        }
+
+        #endregion
 
         #region 棰滆壊鍒嗙骇
 
@@ -1838,6 +1881,10 @@
         //棰滆壊鍒嗙骇灞曠ず
         private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            if (this.barCkGrading.Checked)
+            {
+                this.barCkFlowEffect.Checked = false;
+            }
             var gradingHelper = await GetGradingHelper();
             gradingHelper.Visible = this.barCkGrading.Checked;
             gradingHelper.Set();
@@ -2563,7 +2610,7 @@
 
                 WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�...");
                 await Task.Delay(3000);
-                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
+                var calcuResult = _hydroInfo.Calcu(isHead, allEvaluationList);
                 WaitFormHelper.HideWaitForm();
                 workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult);
                 if (calcuResult.Succeed)
@@ -2712,7 +2759,7 @@
             foreach (var working in allWorkingList)
             {
                 baseHydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo);
-                var calcuResult = baseHydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList);
+                var calcuResult = baseHydroInfoRhs.Calcu(_calcuPressModeIsHead, allEvaluationList);
 
                 var printWorking = new SimulationPrintWorkingViewModel(working);
                 vm.WorkingList.Add(printWorking);
@@ -2743,7 +2790,7 @@
                 foreach (var working in allWorkingList)
                 {
                     hydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo);
-                    var calcuResult = hydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList);
+                    var calcuResult = hydroInfoRhs.Calcu(_calcuPressModeIsHead, allEvaluationList);
 
                     var printWorking = new SimulationPrintWorkingViewModel(working);
                     vm.Scheme.WorkingList.Add(printWorking);
@@ -3466,5 +3513,7 @@
         }
 
         #endregion 鏂规绠$悊
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3