duheng
2025-02-17 3720316038d2d2e283d9ef3c4385b76c2b4ada34
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));
                }
            }
        }