namespace HStation.WinFrmUI.PhartRelation
|
{
|
public partial class SelXhsPumpMainPhartDlg : XtraForm
|
{
|
public SelXhsPumpMainPhartDlg()
|
{
|
InitializeComponent();
|
this.xhsPumpMainPhartListCtrl1.FocusedChangedEvent += XhsPumpMainPhartListCtrl1_FocusedChangedEvent;
|
}
|
|
public event Func<Vmo.XhsPumpMainPhartMappingExtensions, Task<bool>> ReloadDataEvent;
|
|
private long _pump_main_id;
|
private Vmo.XhsPumpMainPhartMappingExtensions _xhs_phart_diagram_ex_std_dto = null;
|
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBandingData(long pump_main_id)
|
{
|
_pump_main_id = pump_main_id;
|
if (_pump_main_id < 1)
|
{
|
this.xhsPumpMainPhartListCtrl1.Clear();
|
return;
|
}
|
this.xhsPumpMainPhartListCtrl1.SetBindingData(pump_main_id);
|
}
|
|
//选择曲线变换事件
|
private void XhsPumpMainPhartListCtrl1_FocusedChangedEvent(Vmo.XhsPumpMainPhartMappingExtensions obj)
|
{
|
_xhs_phart_diagram_ex_std_dto = obj;
|
InitChart(_xhs_phart_diagram_ex_std_dto);
|
}
|
|
#region 图表
|
|
//初始化图表数据
|
private void InitChart(Vmo.XhsPumpMainPhartMappingExtensions dto)
|
{
|
if (dto == null)
|
{
|
return;
|
}
|
var diagram = dto.Diagram;
|
if (diagram == null)
|
{
|
return;
|
}
|
var graph_list = diagram.GraphList;
|
if (graph_list == null || !graph_list.Any())
|
{
|
return;
|
}
|
|
var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
|
var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
|
var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
|
|
if (graph_qp == null)
|
{
|
return;
|
}
|
|
List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null;
|
points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null);
|
if (graph_qe != null)
|
points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null);
|
if (graph_qp != null)
|
points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null);
|
|
var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh);
|
var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe);
|
var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp);
|
|
var disp_paras = diagram.DispParas;
|
var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
|
this.xtrPerform2dChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras);
|
}
|
#endregion
|
|
|
//验证
|
private bool Verify()
|
{
|
if (_xhs_phart_diagram_ex_std_dto == null)
|
{
|
XtraMessageBox.Show("请选择曲线!");
|
return false;
|
}
|
if (this.ReloadDataEvent == null)
|
{
|
XtraMessageBox.Show("请注册事件!");
|
return false;
|
}
|
|
return true;
|
}
|
|
//确认
|
private async void btnOk_Click(object sender, EventArgs e)
|
{
|
if (!Verify())
|
return;
|
var bol = await this.ReloadDataEvent(_xhs_phart_diagram_ex_std_dto);
|
if (!bol)
|
{
|
XtraMessageBox.Show("操作失败!");
|
return;
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
|
}
|
}
|
}
|