using DevExpress.XtraEditors;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
public partial class XtrPerform2dEditDlg : XtraForm
|
{
|
public XtrPerform2dEditDlg()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 回调事件
|
/// </summary>
|
public event Func<Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Task<bool>> ReloadDataEvent;
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(
|
Yw.Pump.CurveQH qh,
|
Yw.Pump.CurveQE qe,
|
Yw.Pump.CurveQP qp)
|
{
|
if (qh == null)
|
{
|
return;
|
}
|
Yw.Geometry.CubicSpline2d cubic_spline_qh = null, cubic_spline_qe = null, cubic_spline_qp = null;
|
|
cubic_spline_qh = new Yw.Geometry.CubicSpline2d(qh.FeatCurve.GetPointList());
|
if (qe != null)
|
cubic_spline_qe = new Yw.Geometry.CubicSpline2d(qe.FeatCurve.GetPointList());
|
if (qp != null)
|
cubic_spline_qp = new Yw.Geometry.CubicSpline2d(qp.FeatCurve.GetPointList());
|
|
this.curveExpressEditCtrl1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp);
|
}
|
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(Yw.Geometry.CubicSpline2d cubic_spline_qh,
|
Yw.Geometry.CubicSpline2d cubic_spline_qe,
|
Yw.Geometry.CubicSpline2d cubic_spline_qp)
|
{
|
|
this.curveExpressEditCtrl1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp);
|
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<Yw.Geometry.Point2d> pt_qh_list,
|
List<Yw.Geometry.Point2d> pt_qe_list,
|
List<Yw.Geometry.Point2d> pt_qp_list,
|
List<Yw.Geometry.Point2d> def_pt_qh_list,
|
List<Yw.Geometry.Point2d> def_pt_qe_list,
|
List<Yw.Geometry.Point2d> def_pt_qp_list)
|
{
|
this.curveExpressEditCtrl1.SetBindingData(pt_qh_list, pt_qe_list, pt_qp_list, def_pt_qh_list,def_pt_qe_list,def_pt_qp_list);
|
}
|
|
//确定
|
private async void btnOk_Click(object sender, EventArgs e)
|
{
|
var bol = this.curveExpressEditCtrl1.GetPoints(
|
out List<Yw.Geometry.Point2d> pt_qh_list,
|
out List<Yw.Geometry.Point2d> pt_qe_list,
|
out List<Yw.Geometry.Point2d> pt_qp_list);
|
if (!bol)
|
{
|
return;
|
}
|
|
var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(pt_qh_list);
|
var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(pt_qe_list);
|
var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(pt_qp_list);
|
var result = await this.ReloadDataEvent?.Invoke(cubic_spline_qh,cubic_spline_qe,cubic_spline_qp);
|
if (!result)
|
{
|
XtraMessageBox.Show("更新失败!");
|
return;
|
}
|
XtraMessageBox.Show("更新成功!");
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
}
|
}
|