Shuxia Ning
2025-01-14 0f99d4d12f2eae29bbe343f4b3131f2faeccda5d
WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/03-import/03-point/PumpChartPointImportCtrl.cs
@@ -1,4 +1,5 @@
using DevExpress.XtraEditors;
using Yw.Ahart;
namespace Yw.WinFrmUI.Phart
{
@@ -10,12 +11,12 @@
        public PumpChartPointImportCtrl()
        {
            InitializeComponent();
            this.repTxtk0.AllowNullInput =  DevExpress.Utils.DefaultBoolean.True;
            this.repTxtFlow.AllowNullInput =  DevExpress.Utils.DefaultBoolean.True;
            this.repTxtk0.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
            this.repTxtFlow.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
        }
        private List<Yw.Geometry.Point2d> _def_qh_pt_list = null;
        private List<Yw.Geometry.Point2d> _def_qe_pt_list = null;
@@ -24,7 +25,7 @@
        private Ahart.eFeatType _feat_type_qh = Ahart.eFeatType.Cubic;
        private Ahart.eFeatType _feat_type_qe = Ahart.eFeatType.Cubic;
        private Ahart.eFeatType _feat_type_qp = Ahart.eFeatType.Cubic;
        /// <summary>
@@ -142,7 +143,7 @@
            this.barTxtEff.EditValue = eff;
            this.barTxtNPSH.EditValue = npsh_r;
        }
        //计算转速比
        private void CalcNs()
        {
@@ -153,7 +154,7 @@
            var head = Convert.ToDouble(this.barTxtHead.EditValue);
            var n = Convert.ToDouble(this.barTxtN.EditValue);
            var stage_number = Convert.ToInt32(this.barSpinLevel.EditValue);
            if (this.barCekIsSxp.Checked)
                flow /= 2;
            var ns = Yw.Pump.CalculationHelper.CalcuNs(flow, head / stage_number, n);
@@ -201,7 +202,7 @@
            else if (power < 10)
                digits = 2;
            else if (power < 100)
                digits = 1;
                digits = 1;
            power = Math.Round(power, digits);
            this.barTxtPower.EditValue = power;
        }
@@ -308,7 +309,7 @@
                        var y2 = qe_pt_list[index2].Y;
                        var x = qre * flow;
                        var max_powert_E = Yw.Geometry.LineHelper.GetLineInsert(x1, x2, y1, y2, x);
                        qe_pt_list.Add(new Yw.Geometry.Point2d(qre * flow, max_powert_E));
@@ -341,16 +342,33 @@
            if (!bol)
            {
                this.pumpViewChart1.ClearBindingData();
                this.pumpViewChart1.Clear();
            }
            else
            {
                var vm = new PumpCurveViewModel();
                vm.CurveQH = _def_qh_pt_list;
                vm.CurveQE = _def_qe_pt_list;
                vm.CurveQP = _def_qp_pt_list;
                this.pumpViewChart1.SetBindingData(vm);
                var list = new List<Yw.WinFrmUI.Phart.PumpViewChartViewModel>();
                list.Add(GetViewModel(_def_qh_pt_list, Yw.Ahart.eCurveType.QH));
                if (_def_qe_pt_list != null && _def_qe_pt_list.Any())
                    list.Add(GetViewModel(_def_qe_pt_list, Yw.Ahart.eCurveType.QE));
                if (_def_qp_pt_list != null && _def_qp_pt_list.Any())
                    list.Add(GetViewModel(_def_qp_pt_list, Yw.Ahart.eCurveType.QP));
                this.pumpViewChart1.SetBindingData(list);
            }
        }
        private Yw.WinFrmUI.Phart.PumpViewChartViewModel GetViewModel(List<Yw.Geometry.Point2d> pt_list,Yw.Ahart.eCurveType curve_type)
        {
            var last_pt = pt_list.Last();
            var vm = new Yw.WinFrmUI.Phart.PumpViewChartViewModel();
            vm.Id = Guid.NewGuid().ToString();
            vm.Hz = 50;
            vm.N =  Convert.ToDouble(this.barTxtN.EditValue);
            vm.CurveType = curve_type;
            vm.FeatType =  eFeatType.Cubic;
            vm.DefPointList = pt_list;
            vm.FitPointList = pt_list;
            vm.GraphParas = "";
            return vm;
        }
@@ -375,7 +393,7 @@
            def_qh_pt_list = _def_qh_pt_list;
            def_qe_pt_list = _def_qe_pt_list;
            def_qp_pt_list = _def_qp_pt_list;
            feat_type_qh =  _feat_type_qh;
            feat_type_qh = _feat_type_qh;
            feat_type_qe = _feat_type_qe;
            feat_type_qp = _feat_type_qp;
            if (def_qh_pt_list == null || !def_qh_pt_list.Any())