Shuxia Ning
2025-02-13 2f1cbec203dcff25df7a5c2b51b13ec558f2c3db
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
using DevExpress.XtraCharts;
using DevExpress.XtraEditors;
using IStation.WinFrmUI.Curve;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.Monitor
{
    public partial class CurveAnalyzePacketEasyMgrPage : DocumentPage
    {
        public CurveAnalyzePacketEasyMgrPage()
        {
            InitializeComponent();
            this.PageTitle.Caption = "曲线分析(简易)";
 
            this.repCmbCurveFitType.Items.Add("二次拟合", 1, -1);
            this.repCmbCurveFitType.Items.Add("三次拟合", 0, -1);
            this.repCmbCurveFitType.Items.Add("四次拟合", 4, -1);
 
            this.repCmbCurveType.Items.Add("流量扬程", 1, -1);
            this.repCmbCurveType.Items.Add("流量功率", 3, -1);
            this.repCmbCurveType.Items.Add("流量效率", 2, -1);
 
            _boxSelHelper = new ChartBoxSelHelper(this.chartControl1);
            _boxSelHelper.BoxSelCompletedEvent += _boxSelHelper_BoxSelCompletedEvent;
 
            this.chartControl1.RuntimeHitTesting = true;
           
        }
 
 
        #region ViewModel 暂时无用
        private class FeatCurveExpressGroupEx : Model.FeatCurveExpressGroup
        {
            public FeatCurveExpressGroupEx() { }
 
            public FeatCurveExpressGroupEx(string dsString) : base(dsString)
            {
                this.IsEmpty = string.IsNullOrEmpty(dsString);
                if (this.IsEmpty)
                    return;
                if (this.CurveQH != null)
                    FitTypeQH = this.CurveQH.FitType;
                if (this.CurveQE != null)
                    FitTypeQE = this.CurveQE.FitType;
                if (this.CurveQP != null)
                    FitTypeQP = this.CurveQP.FitType;
            }
 
            public bool IsEmpty { get; set; }
            public IStation.Model.eCurveFitType FitTypeQH = Model.eCurveFitType.CubicCurve;
            public IStation.Model.eCurveFitType FitTypeQE = Model.eCurveFitType.CubicCurve;
            public IStation.Model.eCurveFitType FitTypeQP = Model.eCurveFitType.CubicCurve;
 
            public void SetPickSelPoint(Model.eFeatCurveType currentCurveType, List<IStation.Model.CurvePoint> points)
            {
                if (currentCurveType == Model.eFeatCurveType.QH)
                {
                    this.CurveQH = new Model.CurveExpress(points, FitTypeQH, true);
                    this.PointMethodQH = Model.eCurveFitPointMethod.ManuPick;
                }
                if (currentCurveType == Model.eFeatCurveType.QE)
                {
                    this.CurveQE = new Model.CurveExpress(points, FitTypeQE, true);
                    this.PointMethodQE = Model.eCurveFitPointMethod.ManuPick;
                }
                if (currentCurveType == Model.eFeatCurveType.QP)
                {
                    this.CurveQP = new Model.CurveExpress(points, FitTypeQP, true);
                    this.PointMethodQP = Model.eCurveFitPointMethod.ManuPick;
                }
            }
            public void SetBoxSelPoint(Model.eFeatCurveType currentCurveType, List<IStation.Model.CurvePoint> points)
            {
                if (currentCurveType == Model.eFeatCurveType.QH)
                {
                    this.CurveQH = new Model.CurveExpress(points, FitTypeQH, true);
                    this.PointMethodQH = Model.eCurveFitPointMethod.ManuBox;
                }
                if (currentCurveType == Model.eFeatCurveType.QE)
                {
                    this.CurveQE = new Model.CurveExpress(points, FitTypeQE, true);
                    this.PointMethodQE = Model.eCurveFitPointMethod.ManuBox;
                }
                if (currentCurveType == Model.eFeatCurveType.QP)
                {
                    this.CurveQP = new Model.CurveExpress(points, FitTypeQP, true);
                    this.PointMethodQP = Model.eCurveFitPointMethod.ManuBox;
                }
            }
 
            //拟合线  
            public List<IStation.Model.CurvePoint> GetFitCurvePointInfo(Model.eFeatCurveType currentCurveType, List<Model.CurveAnalyzePoint> _allAnaPoints)
            {
                if (_allAnaPoints == null || _allAnaPoints.Count < 4)
                    return null;
 
                switch (currentCurveType)
                {
                    case Model.eFeatCurveType.QH:
                        {
                            if (this.CurveQH != null && this.CurveQH.DefinePoints != null)
                            {
                                if (this.PointMethodQH == Model.eCurveFitPointMethod.ManuPick || this.PointMethodQH == Model.eCurveFitPointMethod.ManuBox)
                                    return Model.FitCurveHelper.GetFitPoints(this.CurveQH.DefinePoints, this.FitTypeQH, 10);
                            }
                            var allPoints = _allAnaPoints.Select(x => new Model.CurvePoint(x.Q, x.H)).ToList();
                            var points = Model.FitCurveHelper.GetFitPoints(allPoints, this.FitTypeQH, 10);
                            this.CurveQH = new Model.CurveExpress(points, this.FitTypeQH);
                            return points;
                        }
 
                    case Model.eFeatCurveType.QE:
                        {
                            if (this.CurveQE != null && this.CurveQE.DefinePoints != null)
                            {
                                if (this.PointMethodQE == Model.eCurveFitPointMethod.ManuPick || this.PointMethodQE == Model.eCurveFitPointMethod.ManuBox)
                                    return Model.FitCurveHelper.GetFitPoints(this.CurveQE.DefinePoints, this.FitTypeQE, 10);
                                if (this.PointMethodQE == Model.eCurveFitPointMethod.QHEP)
                                    return Model.FitCurveHelper.GetFitPoints(this.CurveQE.DefinePoints, this.FitTypeQE, 10);
                            }
                            var allPoints = _allAnaPoints.Select(x => new Model.CurvePoint(x.Q, x.E)).ToList();
                            var points = Model.FitCurveHelper.GetFitPoints(allPoints, this.FitTypeQE, 10);
                            this.CurveQE = new Model.CurveExpress(points, this.FitTypeQE);
                            return points;
                        }
                    case Model.eFeatCurveType.QP:
                        {
                            if (this.CurveQP != null && this.CurveQP.DefinePoints != null)
                            {
                                if (this.PointMethodQP == Model.eCurveFitPointMethod.ManuPick || this.PointMethodQP == Model.eCurveFitPointMethod.ManuBox)
                                    return Model.FitCurveHelper.GetFitPoints(this.CurveQP.DefinePoints, this.FitTypeQP, 10);
                                if (this.PointMethodQP == Model.eCurveFitPointMethod.QHEP)
                                    return Model.FitCurveHelper.GetFitPoints(this.CurveQP.DefinePoints, this.FitTypeQP, 10);
                            }
                            var allPoints = _allAnaPoints.Select(x => new Model.CurvePoint(x.Q, x.P)).ToList();
                            var points = Model.FitCurveHelper.GetFitPoints(allPoints, this.FitTypeQP, 10);
                            this.CurveQP = new Model.CurveExpress(points, this.FitTypeQP);
                            return points;
                        }
                }
                return null;
            }
        }
        #endregion
 
        public event Action UpdatePacketEvent;
         
        private List<Model.CurveAnalyzePoint> _allValidBindingList = null;
           
        private Model.eFeatCurveType _curveType = Model.eFeatCurveType.QH;
        private List<Model.CurvePoint> _fitCurvePoints = null;
 
        private FeatCurveExpressGroupEx _curveInfo = new FeatCurveExpressGroupEx(); 
 
        //图
        #region Chart
        private XYDiagram _diagram = null;
        private Series _seriesCurve, _seriesCurvePoint;
        private AxisX _axisX = null;
        private AxisY _axisY = null;
        #endregion
 
        private ChartBoxSelHelper _boxSelHelper = null;//框选辅助类 
         
 
        /// <summary>
        /// 初始化
        /// </summary> 
        public void Initial()
        {
          
     
            _diagram = this.chartControl1.Diagram as XYDiagram;
            _axisX = _diagram.AxisX;
            _axisY = _diagram.AxisY;
             
 
            _seriesCurve = this.chartControl1.GetSeriesByName("SeriesCurve");
            _seriesCurve.Visible = this.barCekFitCurve.Checked;
            _seriesCurvePoint = this.chartControl1.GetSeriesByName("SeriesCurvePoint"); 
 
            this.barEditCurveType.EditValue = (int)Model.eFeatCurveType.QH;
            this.barEditCurveFitType.EditValue = _curveInfo.IsEmpty ? (int)Model.eCurveFitType.CubicCurve : (int)_curveInfo.FitTypeQH;
              
        }
 
 
        /// <summary>
        /// 初始化数据
        /// </summary>
        public override void InitialDataSource()
        {
            Initial();
            LoadCurvePoints(_curveType, _allValidBindingList);
        }
 
 
        //导入数据
        private void barBtnImportExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "EXCEL 文件(*.xls)|*.xls";
            dlg.CheckFileExists = true;
            if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;
 
            //var lays = this.chartControl1.ShowOverlay();
            _allValidBindingList = PhartExcelHelper.ParsePumpExcel(dlg.FileName);
            if (_allValidBindingList == null)
                _allValidBindingList = new List<Model.CurveAnalyzePoint>();
 
            LoadCurvePoints(_curveType, _allValidBindingList);
            //lays.Close(); 
 
        }
 
 
 
        //曲线类型变换
        private void barEditCurveType_EditValueChanged(object sender, EventArgs e)
        {
            _curveType = (Model.eFeatCurveType)this.barEditCurveType.EditValue;
            LoadCurvePoints(_curveType, _allValidBindingList);
        }
 
 
        //拟合方式变换
        private void barEditCurveFitType_EditValueChanged(object sender, EventArgs e)
        {
            var curveFitType = (Model.eCurveFitType)this.barEditCurveFitType.EditValue;
            LoadFeatCurve(_curveType, curveFitType, _allValidBindingList);
        }
 
        // 验证点
        private bool Verify(List<Model.CurveAnalyzePoint> analyzePoints)
        {
            if (analyzePoints == null || !analyzePoints.Any())
            {
                _seriesCurvePoint.Points.BeginUpdate();
                _seriesCurvePoint.Points.Clear();
                _seriesCurvePoint.Points.EndUpdate();
 
                _fitCurvePoints = null;
                _seriesCurve.Points.BeginUpdate();
                _seriesCurve.Points.Clear();
                _seriesCurve.Points.EndUpdate();
                return false;
            }
 
            return true;
        }
 
        // 加载点
        private void LoadCurvePoints(Model.eFeatCurveType curveType, List<Model.CurveAnalyzePoint> analyzePoints)
        {
            if (!Verify(analyzePoints))
                return;
 
            Model.eCurveFitType curveFitType = Model.eCurveFitType.CubicCurve;
 
            double minX = analyzePoints.Min(x => x.Q);
            double maxX = analyzePoints.Max(x => x.Q);
            double minY = 0, maxY = 100;
 
            string axisYTitle = "扬程(m)";
 
            _seriesCurvePoint.Points.BeginUpdate();
            switch (curveType)
            {
                case Model.eFeatCurveType.QH:
                    {
                        _seriesCurvePoint.BindToData(analyzePoints, "Q", "H");
                        _seriesCurvePoint.CrosshairLabelPattern = "流量:{A:N0}  扬程:{V:N1}";
                        _seriesCurvePoint.View.Color = CurveChartDisplay.PointColorQH;
 
                        minY = analyzePoints.Min(x => x.H);
                        maxY = analyzePoints.Max(x => x.H);
 
                        curveFitType = _curveInfo.FitTypeQH;
                    }
                    break;
                case Model.eFeatCurveType.QE:
                    {
                        axisYTitle = "效率(%)";
                        _seriesCurvePoint.BindToData(analyzePoints, "Q", "E");
                        _seriesCurvePoint.CrosshairLabelPattern = "流量:{A:N0}  效率:{V:N1}";
                        _seriesCurvePoint.View.Color = CurveChartDisplay.PointColorQE;
 
                        minY = analyzePoints.Min(x => x.E);
                        maxY = analyzePoints.Max(x => x.E);
 
                        curveFitType = _curveInfo.FitTypeQE;
                    }
                    break;
                case Model.eFeatCurveType.QP:
                    {
                        axisYTitle = "功率(kw)";
                        _seriesCurvePoint.BindToData(analyzePoints, "Q", "P");
                        _seriesCurvePoint.CrosshairLabelPattern = "流量:{A:N0}  功率:{V:N0}";
                        _seriesCurvePoint.View.Color = CurveChartDisplay.PointColorQP;
 
                        minY = analyzePoints.Min(x => x.P);
                        maxY = analyzePoints.Max(x => x.P);
 
                        curveFitType = _curveInfo.FitTypeQP;
                    }
                    break;
                default:
                    break;
            }
            _seriesCurvePoint.Points.EndUpdate();
            this.chartControl1.BeginInit();
 
 
 
            minX *= 0.95;
            maxX *= 1.05;
 
            minY *= 0.95;
            maxY *= 1.05;
 
            minX = Math.Round(minX);
            maxX = Math.Floor(maxX);
 
            minY = Math.Round(minY);
            maxY = Math.Floor(maxY);
 
 
            _axisX.WholeRange.SetMinMaxValues(minX, maxX);
            _axisX.VisualRange.SetMinMaxValues(minX, maxX);
 
            _axisY.WholeRange.SetMinMaxValues(minY, maxY);
            _axisY.VisualRange.SetMinMaxValues(minY, maxY);
            _axisY.Title.Text = axisYTitle;
 
            this.chartControl1.EndInit();
 
            var currentCurveFitType = this.barEditCurveFitType.EditValue;
            if (currentCurveFitType != null && (int)currentCurveFitType != (int)curveFitType)
            {
                this.barEditCurveFitType.EditValue = (int)curveFitType;
            }
            else
            {
                LoadFeatCurve(curveType, curveFitType, analyzePoints);
            }
        }
 
        //加载点
        private void LoadFeatCurve(Model.eFeatCurveType curveType, Model.eCurveFitType curveFitType, List<Model.CurveAnalyzePoint> analyzePoints)
        {
            if (!Verify(analyzePoints))
                return;
 
            switch (curveType)
            {
                case Model.eFeatCurveType.QH:
                    {
                        var curvePoints = analyzePoints.Select(x => new Model.CurvePoint(x.Q, x.H)).ToList();
                        _fitCurvePoints = Model.FitCurveHelper.GetFitPoints(curvePoints, curveFitType, 10);
                        _curveInfo.FitTypeQH = curveFitType;
                    }
                    break;
                case Model.eFeatCurveType.QE:
                    {
                        var curvePoints = analyzePoints.Select(x => new Model.CurvePoint(x.Q, x.E)).ToList();
                        _fitCurvePoints = Model.FitCurveHelper.GetFitPoints(curvePoints, curveFitType, 10);
                        _curveInfo.FitTypeQE = curveFitType;
                    }
                    break;
                case Model.eFeatCurveType.QP:
                    {
                        var curvePoints = analyzePoints.Select(x => new Model.CurvePoint(x.Q, x.P)).ToList();
                        _fitCurvePoints = Model.FitCurveHelper.GetFitPoints(curvePoints, curveFitType, 10);
                        _curveInfo.FitTypeQP = curveFitType;
                    }
                    break;
                default:
                    break;
            }
            _seriesCurve.Points.BeginUpdate();
            _seriesCurve.BindToData(_fitCurvePoints, "X", "Y");
            _seriesCurve.Points.EndUpdate();
        }
 
 
        private void barBtnBoxSelect_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _diagram.EnableAxisXScrolling = false;
            _diagram.EnableAxisXZooming = false;
            _boxSelHelper.StartBoxSel();
        }
 
        //框选结束
        private void _boxSelHelper_BoxSelCompletedEvent(System.Windows.Forms.MouseEventArgs obj)
        {
            _diagram.EnableAxisXScrolling = true;
            _diagram.EnableAxisXZooming = true;
            var boxSelSeriesPoints = _boxSelHelper.CalcuNumericalSelSeriesPoints(new List<Series>() { _seriesCurvePoint });
            if (boxSelSeriesPoints == null || boxSelSeriesPoints.Count < 1)
            {
                _boxSelHelper.CloseBoxSel();
            }
            else
            {
                popMenu.ShowPopup(MousePosition);
                _boxSelPoints = boxSelSeriesPoints.Select(x => x.Tag as Model.CurveAnalyzePoint).ToList();
            }
        }
 
        private void barBtnViewData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_boxSelPoints == null || _boxSelPoints.Count < 1)
                return;
 
            var dlg = new BoxSelectPointsDlg();
            dlg.Set(_boxSelPoints.ToList());
            dlg.RemovePointEvent += (time) =>
            {
                DeletePoints(new List<DateTime>() { time });
                return true;
            };
            dlg.ShowDialog();
 
 
        }
 
        #region 删除点
 
        private List<Model.CurveAnalyzePoint> _boxSelPoints = null;
 
        //框选删除
        private void barBtnBoxDeletion_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _diagram.EnableAxisXScrolling = false;
            _diagram.EnableAxisXZooming = false;
            _boxSelHelper.StartBoxSel();
        }
 
        //删除
        private void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_boxSelPoints == null || _boxSelPoints.Count < 1)
                return;
            var timeList = _boxSelPoints.Select(x => x.Time).ToList();
            DeletePoints(timeList);
        }
 
        //筛选删除 异常流量
        private void barBtnAbnormalQ_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_allValidBindingList == null || !_allValidBindingList.Any())
            {
                XtraMessageBox.Show("无数据!");
                return;
            }
            var timeList = _allValidBindingList.Where(x => x.Q <= 0).Select(x => x.Time).ToList();
            DeletePoints(timeList);
        }
 
        //筛选删除 异常功率
        private void barBtnAbnormalP_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_allValidBindingList == null || !_allValidBindingList.Any())
            {
                XtraMessageBox.Show("无数据!");
                return;
            }
            var timeList = _allValidBindingList.Where(x => x.P == IStation.Error.Default).Select(x => x.Time).ToList();
            DeletePoints(timeList);
        }
 
        //筛选删除 异常效率
        private void barBtnAbnormalE_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_allValidBindingList == null || !_allValidBindingList.Any())
            {
                XtraMessageBox.Show("无数据!");
                return;
            }
            var timeList = _allValidBindingList.Where(x => x.E == IStation.Error.Default).Select(x => x.Time).ToList();
            DeletePoints(timeList);
        }
 
        /// <summary>
        /// 删除点
        /// </summary> 
        private void DeletePoints(List<DateTime> timeList)
        {
            if (timeList == null || timeList.Count < 1)
            {
                XtraMessageBox.Show("无数据!");
                return;
            }
 
            var lays = this.chartControl1.ShowOverlay();
            timeList = timeList.OrderByDescending(x => x).ToList();
            //var result = _bllPoint.SetInvalid(_monitorDataSourcesId, _curveAnalyzeId, _curveAnalyzePacketId, timeList);
            //if (!result)
            //{
            //    lays.Close();
            //    XtraMessageBox.Show("删除失败!");
            //    return;
            //}
 
            var minTime = timeList.Min();
            var maxTime = timeList.Max();
            var minIndex = _allValidBindingList.FindIndex(x => x.Time == minTime);
            var maxIndex = _allValidBindingList.FindIndex(x => x.Time == maxTime);
            var delIndex = 0;
            for (int i = maxIndex; i >= minIndex; i--)
            {
                var item = _allValidBindingList[i];
                for (int j = delIndex; j < timeList.Count; j++)
                {
                    var delItem = timeList[j];
                    if (item.Time == delItem)
                    {
                        _allValidBindingList.RemoveAt(i);
                        delIndex = j++;
                        break;
                    }
                }
            }
            lays.Close();
            LoadCurvePoints(_curveType, _allValidBindingList);
            lays.Close();
        }
 
        //菜单关闭
        private void popMenu_CloseUp(object sender, EventArgs e)
        {
            _boxSelPoints = null;
            _boxSelHelper?.CloseBoxSel();
        }
        #endregion
 
        #region Menu
  
 
        //拟合曲线
        private void barCekFitCurve_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _seriesCurve.Visible = this.barCekFitCurve.Checked;
        } 
 
        //更新曲线信息
        private void UpdateCurveInfo(List<Model.CurveAnalyzePoint> analyzePoints)
        {
            if (analyzePoints != null && analyzePoints.Count > 4)
            {
                var curvePointsQH = _allValidBindingList.Select(x => new Model.CurvePoint(x.Q, x.H)).ToList();
                var fitPointsQH = Model.FitCurveHelper.GetFitPoints(curvePointsQH, _curveInfo.FitTypeQH, 10);
                _curveInfo.CurveQH = new Model.CurveExpress(fitPointsQH, _curveInfo.FitTypeQH);
 
                var curvePointsQE = _allValidBindingList.Select(x => new Model.CurvePoint(x.Q, x.E)).ToList();
                var fitPointsQE = Model.FitCurveHelper.GetFitPoints(curvePointsQE, _curveInfo.FitTypeQE, 10);
                _curveInfo.CurveQE = new Model.CurveExpress(fitPointsQE, _curveInfo.FitTypeQE);
 
                var curvePointsQP = _allValidBindingList.Select(x => new Model.CurvePoint(x.Q, x.P)).ToList();
                var fitPointsQP = Model.FitCurveHelper.GetFitPoints(curvePointsQP, _curveInfo.FitTypeQP, 10);
                _curveInfo.CurveQP = new Model.CurveExpress(fitPointsQP, _curveInfo.FitTypeQP);
 
                _curveInfo.IsEmpty = false;
            }
            else
            {
                _curveInfo.IsEmpty = true;
            }
        }
 
 
        //预览
        private void barBtnPreview_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UpdateCurveInfo(_allValidBindingList);
            var dlg = new PreviewCurveDlg();
            dlg.SetBindingData(_curveInfo);
            dlg.ShowDialog();
        }
         
 
        
 
 
        // 刷新数据
        private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            InitialDataSource();
        }
        #endregion
 
    }
}