using Mapster;
|
|
namespace HStation.WinFrmUI
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class SimulationPrintMonitorAnalyHelper
|
{
|
/// <summary>
|
/// 创建
|
/// </summary>
|
public static SimulationPrintMonitorAnalyViewModel Create
|
(
|
Yw.Model.HydroModelInfo hydroInfo,
|
List<Yw.Vmo.HydroMonitorVmo> allMonitorList,
|
Yw.Vmo.HydroWorkingVmo working,
|
HydroCalcuResult calcuResult = null,
|
bool isHead = false,
|
List<Yw.Vmo.HydroEvaluationVmo> allEvaluationList = null
|
)
|
{
|
var vm = new SimulationPrintMonitorAnalyViewModel();
|
|
//验证
|
if (hydroInfo == null)
|
{
|
return vm;
|
}
|
if (allMonitorList == null || allMonitorList.Count < 1)
|
{
|
return vm;
|
}
|
if (working == null)
|
{
|
return vm;
|
}
|
|
//过滤测点,仅需要分析测点
|
var monitorList = allMonitorList?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Analyse).ToList();
|
if (monitorList == null || monitorList.Count < 1)
|
{
|
return vm;
|
}
|
|
//赋值模型信息,避免干扰
|
//var newHydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
|
var allVisualDict = hydroInfo.GetVisualDict();
|
if (allVisualDict == null || allVisualDict.Count < 1)
|
{
|
return vm;
|
}
|
|
//计算结果
|
if (calcuResult == null)
|
{
|
calcuResult = hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
|
if (!calcuResult.Succeed)
|
{
|
return vm;
|
}
|
}
|
var allCalcuVisualDict = calcuResult.GetVisualDict();
|
|
//遍历测点
|
vm.Items = new List<SimulationPrintMonitorAnalyItemViewModel>();
|
foreach (var monitor in monitorList)
|
{
|
var item = new SimulationPrintMonitorAnalyItemViewModel(monitor, allVisualDict, allCalcuVisualDict);
|
vm.Items.Add(item);
|
}
|
|
return vm;
|
}
|
|
}
|
}
|