From 0a1bf56909464e938a68c29b26ab88ff51380fad Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 08 一月 2025 13:56:17 +0800 Subject: [PATCH] 能效分析水力图表 装置点显示文字 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs | 122 +++++++++++++++++++++++++++++++--------- 1 files changed, 93 insertions(+), 29 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs index f8d17fa..6a2765e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs @@ -12,17 +12,14 @@ /// </summary> public SimulationCalcuResultLabelHelper ( - SimulationVisualListHelper visualListHelper, SimulationCalcuResultHelper calcuResultHelper, ISimulationCalcuResultLabelView view ) { - _visualListHelper = visualListHelper; _calcuResultHelper = calcuResultHelper; _views = new List<ISimulationCalcuResultLabelView>() { view }; } - private SimulationVisualListHelper _visualListHelper = null;//鍙鍒楄〃杈呭姪绫� private SimulationCalcuResultHelper _calcuResultHelper = null;//璁$畻缁撴灉杈呭姪绫� private List<ISimulationCalcuResultLabelView> _views = null;//瑙嗗浘鍒楄〃 @@ -44,62 +41,129 @@ if (this.Visible) { var labels = GetLabels(); - _views.ForEach(x => x.SetLogicCalcuCustomLabels(labels)); + if (labels != null && labels.Count > 0) + { + _views.ForEach(async x => await x.SetLogicCalcuCustomLabels(labels)); + return; + } } - else - { - _views.ForEach(x => x.ClearLogicCalcuCustomLabels()); - } + _views.ForEach(async x => await x.ClearLogicCalcuCustomLabels()); } - //鑾峰彇璁$畻鏍囩 private List<LogicCalcuCustomLabel> GetLabels() { - var hydroInfo = _visualListHelper.HydroInfo; - if (hydroInfo == null) + if (!_calcuResultHelper.Initialized) { return default; } - var allCalcuResultVisualDict = _calcuResultHelper.GetVisualResultDict(); + var allCalcuResultVisualDict = _calcuResultHelper.GetVisualDict(); + var allCalcuLabels = new List<LogicCalcuCustomLabel>(); - hydroInfo.Pumps?.ForEach(x => + + #region 姘存睜 + + _calcuResultHelper.HydroInfo.GetAllTanks()?.ForEach(x => + { + var calcuTankResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuTankResult; + var customLabel = new LogicCalcuCustomLabel(); + customLabel.Id = x.Code; + customLabel.Distance = 50000; + customLabel.Data = new List<LogicCalcuCustomLabelItem>() + { + new LogicCalcuCustomLabelItem(){ Name="姘翠綅",Value=Math.Round(calcuTankResult.CalcuL.Value,2).ToString(),Unit="m"}, + }; + allCalcuLabels.Add(customLabel); + }); + + #endregion + + #region 姘存车 + + _calcuResultHelper.HydroInfo.Pumps?.ForEach(x => { var hz = Math.Round(x.RatedHz * x.SpeedRatio); - var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuLinkResult; + var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuPumpResult; if (calcuPumpResult != null) { - var calcuPumpStartResult = allCalcuResultVisualDict.GetValue(x.StartCode) as HydroCalcuNodeResult; - var calcuPumpEndResult = allCalcuResultVisualDict.GetValue(x.EndCode) as HydroCalcuNodeResult; var pumpCustomLabel = new LogicCalcuCustomLabel(); pumpCustomLabel.Id = x.Code; - pumpCustomLabel.Distance = 20000; + pumpCustomLabel.Distance = 50000; pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() - { - new LogicCalcuCustomLabelItem(){ Name="鐘舵��",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty}, - new LogicCalcuCustomLabelItem(){ Name="棰戠巼",Value=hz.ToString(),Unit=string.Empty}, - new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuPumpResult.CalcuFlow.Value,1).ToString(),Unit="m鲁/h"}, - new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpStartResult.CalcuHead.Value,4).ToString(),Unit="m"}, - new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpEndResult.CalcuHead.Value,4).ToString(),Unit="m"}, - }; + { + new LogicCalcuCustomLabelItem(){ Name="鐘舵��",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty}, + new LogicCalcuCustomLabelItem(){ Name="棰戠巼",Value=x.LinkStatus==Yw.Hydro.PumpStatus.Open?hz.ToString():"0",Unit="hz"}, + new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuPumpResult.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpResult.CalcuPr2.Value,2).ToString(),Unit="m"}, + }; allCalcuLabels.Add(pumpCustomLabel); } }); - hydroInfo.GetAllEmitters()?.ForEach(x => + #endregion + + #region 闃�闂� + + //_calcuResultHelper.HydroInfo.Valves?.ForEach(x => + //{ + // var calcuResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuValveResult; + // var customLabel = new LogicCalcuCustomLabel(); + // customLabel.Id = x.Code; + // customLabel.Distance = 50000; + // customLabel.Data = new List<LogicCalcuCustomLabelItem>() + // { + // new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuResult.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + // new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuResult.CalcuPr2.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="闃�闂ㄥ紑搴�",Value=Math.Round(x.OpeningDegree,0).ToString(),Unit="掳"} + // }; + // allCalcuLabels.Add(customLabel); + //}); + + #endregion + + #region 鎵╂暎鍣� + + _calcuResultHelper.HydroInfo.GetAllEmitters()?.ForEach(x => { - var calcuEmitter = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuNodeResult; + var calcuEmitter = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuEmitterResult; var emitterCustomLabel = new LogicCalcuCustomLabel(); emitterCustomLabel.Id = x.Code; - emitterCustomLabel.Distance = 30000; + emitterCustomLabel.Distance = 50000; emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() { - new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuEmitter.CalcuDemand.Value,1).ToString(),Unit="m鲁/h"}, - new LogicCalcuCustomLabelItem(){ Name="鍘嬪姏",Value=Math.Round(calcuEmitter.CalcuDemand.Value,4).ToString(),Unit="m"} + new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuEmitter.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + new LogicCalcuCustomLabelItem(){ Name="鍘嬪姏",Value=Math.Round(calcuEmitter.CalcuPr.Value,2).ToString(),Unit="m"} }; allCalcuLabels.Add(emitterCustomLabel); }); + + #endregion + + #region 姘村姏闃讳欢 + + //_calcuResultHelper.HydroInfo.GetAllResistances()?.ForEach(x => + //{ + // var calcuResistanceResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuResistanceResult; + // var resistanceCustomLabel = new LogicCalcuCustomLabel(); + // resistanceCustomLabel.Id = x.Code; + // resistanceCustomLabel.Distance = 50000; + // resistanceCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() + // { + // new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuResistanceResult.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + // new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuResistanceResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuResistanceResult.CalcuPr2.Value,2).ToString(),Unit="m"} + // }; + // allCalcuLabels.Add(resistanceCustomLabel); + //}); + + #endregion + + return allCalcuLabels; + + } -- Gitblit v1.9.3