duheng
2024-12-24 b826e3716742abba49ab2a851b943ea8328db66e
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/06-mark/SimulationMarkHelper.cs
@@ -4,20 +4,22 @@
namespace HStation.WinFrmUI
{
    /// <summary>
    ///
    /// 水力模拟标注辅助类
    /// </summary>
    public class SimulationMarkHelper
    {
        /// <summary>
        /// 
        /// </summary>
        public SimulationMarkHelper(SimulationVisualListHelper visualListHelper, ISimulationMarkView view)
        public SimulationMarkHelper(SimulationVisualListHelper visualListHelper, SimulationCalcuResultHelper calcuResultHelper, ISimulationMarkView view)
        {
            _visualListHelper = visualListHelper;
            _calcuResultHelper = calcuResultHelper;
            _views = new List<ISimulationMarkView>() { view };
        }
        private SimulationVisualListHelper _visualListHelper = null;//可见列表辅助类
        private SimulationCalcuResultHelper _calcuResultHelper = null;//计算结果辅助类
        private List<ISimulationMarkView> _views = null;//视图列表
        /// <summary>
@@ -69,7 +71,7 @@
            {
                if (_results == null)
                {
                    _results = HydroMarkHelper.GetResultList(_visualListHelper.HydroInfo, this.Sets);
                    _results = HydroMarkHelper.GetResultList(_visualListHelper.HydroInfo, this.Sets, _calcuResultHelper.GetVisualDict());
                    if (_results == null)
                    {
                        _results = new List<HydroMarkResultViewModel>();
@@ -98,15 +100,31 @@
        }
        /// <summary>
        /// 更新
        /// 设置
        /// </summary>
        public void Update(HydroVisualInfo visual)
        public void Set()
        {
            if (this.Visible)
            {
                var leadLabels = this.Results?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, null)).ToList();
                _views?.ForEach(x => x.SetLogicMarkLeadLabels(leadLabels));
            }
            else
            {
                _views?.ForEach(x => x.ClearLogicMarkLeadLabels());
            }
        }
        /// <summary>
        /// 设置
        /// </summary>
        public void Set(HydroVisualInfo visual)
        {
            if (visual == null)
            {
                return;
            }
            var result = HydroMarkHelper.GetResult(visual, this.Sets);
            var result = HydroMarkHelper.GetResult(visual, this.Sets, _calcuResultHelper.GetVisualDict());
            if (result == null)
            {
                return;
@@ -121,31 +139,15 @@
        }
        /// <summary>
        /// 更新
        /// 设置
        /// </summary>
        public void Update(List<HydroVisualInfo> visuals)
        public void Set(List<HydroVisualInfo> visuals)
        {
            if (visuals == null || visuals.Count < 1)
            {
                return;
            }
            visuals.ForEach(x => Update(x));
        }
        /// <summary>
        /// 设置
        /// </summary>
        public void Set()
        {
            if (this.Visible)
            {
                var leadLabels = this.Results?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, null)).ToList();
                _views?.ForEach(x => x.SetLogicMarkLeadLabels(leadLabels));
            }
            else
            {
                _views?.ForEach(x => x.ClearLogicMarkLeadLabels());
            }
            visuals.ForEach(x => Set(x));
        }