From cec8d92bdca1da0b2eafe6eb3130f4bf6f03028b Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期三, 12 三月 2025 10:21:09 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs |   82 ++++++++++++++++++++++++----------------
 1 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs
index adc013c..29bec79 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs
@@ -82,31 +82,31 @@
                         item.Id = pipe.Code;
                         item.Rotation = 90;
                         item.SpeedX = 0.1;
-                        if (pipe.FlowDirectionX == Yw.Hydro.FlowDirection.None)
-                        {
-                            item.SpeedX = 0;
-                        }
-                        else if (pipe.FlowDirectionX == Yw.Hydro.FlowDirection.Positive)
-                        {
-                            item.SpeedX = 0.1;
-                        }
-                        else
-                        {
-                            item.SpeedX = -0.1;
-                        }
+                        //if (pipe.FlowDirectionX == Yw.Hydro.FlowDirection.None)
+                        //{
+                        //    item.SpeedX = 0;
+                        //}
+                        //else if (pipe.FlowDirectionX == Yw.Hydro.FlowDirection.Positive)
+                        //{
+                        //    item.SpeedX = 0.1;
+                        //}
+                        //else
+                        //{
+                        //    item.SpeedX = -0.1;
+                        //}
 
-                        if (pipe.FlowDirectionY == Yw.Hydro.FlowDirection.None)
-                        {
-                            item.SpeedY = 0;
-                        }
-                        else if (pipe.FlowDirectionY == Yw.Hydro.FlowDirection.Positive)
-                        {
-                            item.SpeedY = 0.1;
-                        }
-                        else
-                        {
-                            item.SpeedY = -0.1;
-                        }
+                        //if (pipe.FlowDirectionY == Yw.Hydro.FlowDirection.None)
+                        //{
+                        //    item.SpeedY = 0;
+                        //}
+                        //else if (pipe.FlowDirectionY == Yw.Hydro.FlowDirection.Positive)
+                        //{
+                        //    item.SpeedY = 0.1;
+                        //}
+                        //else
+                        //{
+                        //    item.SpeedY = -0.1;
+                        //}
 
                         var calcuLinkResult = allCalcuResultVisualDict?.GetValue(pipe.Code) as HydroCalcuLinkResult;
                         if (calcuLinkResult != null)
@@ -139,24 +139,40 @@
         }
 
         /// <summary>
-        /// 鏇存柊
+        /// 璁剧疆
         /// </summary>
-        public void Update(HydroVisualInfo visual)
+        public void Set(HydroVisualInfo visual)
         {
             if (visual == null)
             {
                 return;
             }
-            var item = this.Items?.Find(x => x.Id == visual.Code);
-            if (item == null)
+            var oldItem = this.Items?.Find(x => x.Id == visual.Code);
+            if (oldItem != null)
             {
-                return;
+                if (this.Items != null)
+                {
+                    this.Items.Remove(oldItem);
+                }
+                this.Items?.Remove(oldItem);
             }
-            this.Items.Remove(item);
             var allCalcuResultVisualDict = _calcuResult?.GetVisualDict();
-            item = CreateItem(visual, allCalcuResultVisualDict);
-            this.Items.Add(item);
-            _views?.ForEach(async x => await x.UpdateFlowEffect(item));
+            var newItem = CreateItem(visual, allCalcuResultVisualDict);
+            if (newItem != null)
+            {
+                if (this.Items != null)
+                {
+                    this.Items.Add(newItem);
+                }
+            }
+            if (this.Visible)
+            {
+                if (newItem != null)
+                {
+                    _views?.ForEach(async x => await x.UpdateFlowEffect(newItem));
+                }
+            }
+
         }
 
 

--
Gitblit v1.9.3