yangyin
2024-08-21 04e1d0a290ff76bf623bd9de075b350b8b77ba25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
 
namespace Yw.WinFrmUI.Phart
{
    public partial class EditCurveExpressDlg : XtraForm
    {
        public EditCurveExpressDlg()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// 回调事件
        /// </summary>
        public event Func<Model.PumpCurveInfo, bool> ReloadDataEvent;
 
        /// <summary>
        /// 初始化数据
        /// </summary> 
        public void SetBindingData(Model.PumpCurveInfo expressGroup)
        {
            if (expressGroup == null)
                return;
            if (expressGroup.CurveQH == null)
                return;
 
            this.curveExpressEditCtrl1.SetBindingData(expressGroup.CurveQH, expressGroup.CurveQE, expressGroup.CurveQP);
 
        }
 
        /// <summary>
        /// 初始化数据
        /// </summary> 
        public void SetBindingData(Yw.Curve.CurveExpress curveQH,
                                   Yw.Curve.CurveExpress curveQE,
                                   Yw.Curve.CurveExpress curveQP)
        {
 
            this.curveExpressEditCtrl1.SetBindingData(curveQH, curveQE, curveQP);
 
        }
 
        /// <summary>
        /// 绑定数据
        /// </summary> 
        public void SetBindingData(List<Yw.Geometry.Point2d> pointsQH,
                                   List<Yw.Geometry.Point2d> pointsQE,
                                   List<Yw.Geometry.Point2d> pointsQP,
                                   Yw.Pump.eFeatType fitTypeQH,
                                   Yw.Pump.eFeatType fitTypeQE,
                                   Yw.Pump.eFeatType fitTypeQP)
        {
            this.curveExpressEditCtrl1.SetBindingData(pointsQH, pointsQE, pointsQP, fitTypeQH, fitTypeQE, fitTypeQP);
        }
 
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            var bol = this.curveExpressEditCtrl1.GetPoints(out List<Yw.Geometry.Point2d> pointsQH,
                                                        out List<Yw.Geometry.Point2d> pointsQE,
                                                        out List<Yw.Geometry.Point2d> pointsQP,
                                                        out Yw.Pump.eFeatType fitTypeQH,
                                                        out Yw.Pump.eFeatType fitTypeQE,
                                                        out Yw.Pump.eFeatType fitTypeQP);
            if (!bol)
            {
                return;
            }
 
            var featCurveExpressGroup = new Model.PumpCurveInfo();
            if (pointsQH != null)
            {
                featCurveExpressGroup.CurveQH = Yw.Curve.FitHelper.BuildCurveExpress(pointsQH, fitTypeQH);
 
            }
            if (pointsQE != null)
            {
                featCurveExpressGroup.CurveQE = Yw.Curve.FitHelper.BuildCurveExpress(pointsQE, fitTypeQE);
 
            }
            if (pointsQP != null)
            {
                featCurveExpressGroup.CurveQP = Yw.Curve.FitHelper.BuildCurveExpress(pointsQP, fitTypeQP);
            }
 
            var result = this.ReloadDataEvent?.Invoke(featCurveExpressGroup);
            if (result == null || !result.Value)
            {
                XtraMessageBox.Show("更新失败!");
                return;
            }
            XtraMessageBox.Show("更新成功!");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 
    }
}