tx
2025-04-22 e0b138b3e057de6f57021e6c8963868f5c5acc5a
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
using System.Collections.Generic;
using System.Linq;
using WW.Math;
 
namespace TProduct.PumpGraph.Dxf
{
    public partial class LxpFeatChart : FeatChart
    {
        protected string _qhCurveLabelContent = "扬程(m)";
        protected string _qeCurveLabelContent = "效率(%)";
        protected string _qpCurveLabelContent = "功率(kW)";
        protected string _npshCurveLabelContent = "汽蚀(m)";
 
        public static TProduct.PumpGraph.Dxf.LxpFeatChart Build(int Template)
        {
            if (Template == 1)
                return new LxpFeatChartV1();
 
            else if (Template == 3)
                return new LxpFeatChartV3();
            else
                return new LxpFeatChartV3();
        }
 
 
        //注意即使改了单位,曲线里面的数据没有变,只变化了图表的坐标显示
        protected Eventech.Model.UnitP _unitP = Eventech.Model.UnitP.KW;
        public Eventech.Model.UnitP UnitP
        {
            get { return _unitP; }
            set { _unitP = value; }
        }
 
        protected Eventech.Model.UnitH _unitNPSH = Eventech.Model.UnitH.M;
        public Eventech.Model.UnitH UnitNPSH
        {
            get { return _unitNPSH; }
            set { _unitNPSH = value; }
        }
 
 
 
 
 
        #region 坐标
        protected Eventech.Model.LxpCoordinateParas _coordinateParas = null;
 
        public void SetCoordinate(Eventech.Model.LxpCoordinateParas coordinateParas)
        {
            this._coordinateParas = coordinateParas;
        }
 
        #endregion
 
 
        #region 汽蚀曲线
        //是否有汽蚀曲线
        protected bool _isNPSHCurve = true;
        public bool IsNPSHCurve
        {
            get { return _isNPSHCurve; }
            set { _isNPSHCurve = value; }
        }
 
        //汽蚀曲线如果超过流量扬程线,就切除掉
        protected bool _isTrimCurveNpshOverQH = false;
        public bool IsTrimCurveNpshOverQH
        {
            get { return _isTrimCurveNpshOverQH; }
            set { _isTrimCurveNpshOverQH = value; }
        }
        //汽蚀曲线延长到区域点(最小流量点开始)
        protected bool _isCurveNpshStartWithRegionAllow = false;
        public bool IsCurveNpshStartWithRegionAllow
        {
            get { return _isCurveNpshStartWithRegionAllow; }
            set { _isCurveNpshStartWithRegionAllow = value; }
        }
 
        protected List<Eventech.Model.CurveDispParasEx> _allCurveNPSH = null;
        public List<Eventech.Model.CurveDispParasEx> AllCurveNPSH
        {
            get { return _allCurveNPSH; }
            set { _allCurveNPSH = value; }
        }
        #endregion
 
 
        #region 性能曲线
        //超出坐标是否截取
        protected bool _isTrimCurveOverCoord = true;
        public bool IsTrimCurveOverCoord
        {
            get { return _isTrimCurveOverCoord; }
            set { _isTrimCurveOverCoord = value; }
        }
 
        public List<Eventech.Model.FeatPoint> _curveInfoQH = null;
        public List<Eventech.Model.FeatPoint> _curveInfoQE = null;
        public List<Eventech.Model.FeatPoint> _curveInfoQP = null;
 
        public List<Eventech.Model.FeatPoint> _pointInfoQH = null;
        public List<Eventech.Model.FeatPoint> _pointInfoQE = null;
        public List<Eventech.Model.FeatPoint> _pointInfoQP = null;
 
        public List<Eventech.Model.FeatPoint> _points_TestNPSH = null;
        public List<Eventech.Model.FeatPoint> _points_CurveNPSH = null;
 
        protected TProduct.Model.ProductMainExPump _currentPump = null;
 
 
 
        public virtual void SetFeatPointRecords(
             TProduct.Model.ProductMainExPump pump,
             List<TProduct.Model.PumpFeatTestRecordViewModel> groupPoints)
        {
            if (groupPoints == null || groupPoints.Count < 4)
            {
                return;
            }
            this._currentPump = pump;
            _pointInfoQH = new List<Eventech.Model.FeatPoint>();
            _pointInfoQE = new List<Eventech.Model.FeatPoint>();
            _pointInfoQP = new List<Eventech.Model.FeatPoint>();
 
            _curveInfoQH = new List<Eventech.Model.FeatPoint>();
            _curveInfoQE = new List<Eventech.Model.FeatPoint>();
            _curveInfoQP = new List<Eventech.Model.FeatPoint>();
 
            foreach (var pt in groupPoints)
            {
                _pointInfoQH.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtH));
                if (pt.CorrectPtP.HasValue)
                    _pointInfoQP.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtP.Value));
                if (pt.CorrectPtE.HasValue)
                    _pointInfoQE.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtE.Value));
            }
            if (_pointInfoQH.Count > 4)
                this._curveInfoQH = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQH, pump.CurveFitTypeQH, 12);
            if (_pointInfoQE.Count > 4)
                this._curveInfoQE = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQE, pump.CurveFitTypeQE, 12);
            if (_pointInfoQP.Count > 4)
                this._curveInfoQP = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQP, pump.CurveFitTypeQP, 12);
        }
 
 
        #endregion
 
 
 
 
 
 
 
 
 
 
 
        protected bool _isRotateAxisTitleY = false;//是否对坐标标题文字旋转90度
        protected bool _isTwoLineAxisTileY = true;//坐标名字和单位放在两行
        protected double _axisTitleSizeX = 10;//刻度文字尺寸
        protected double _axisTitleSizeY = 10;//刻度文字尺寸
 
        protected double _axisLabelSizeX = 8;//刻度文字尺寸
        protected double _axisLabelSizeY = 8;//刻度文字尺寸
 
        protected float _axisMajorTickLength = 8;//长刻度线的长度
        protected float _axisMinorTickLength = 4;//短刻度线的长度
        protected bool _isDrawMajorTickY = true;//长刻度线是否绘制
        protected bool _isDrawMajorTickX = true;
 
        protected int _minorTickNumberX = 5;
        protected int _minorTickNumberY = 5;
 
        protected double _axisTitleSpaceToDiagramQ_X = 0;//流量坐标标题距离图标的距离
        protected double _axisTitleSpaceToDiagramQ_Y = 35;//流量坐标标题距离图标的距离
        protected double _axisLabelSpaceToDiagramQ = 12;//流量坐标刻度距离图标的距离
 
        protected float _axisTitleSpaceToLabel_Vertial_Y = 1;//纵坐标Tile在Y方向与文字的间隔
 
        protected float _axisLabelSpaceToDiagramY_left = 15;//刻度文字离Y轴的距离(只对Y)
        protected float _axisTitleSpaceToDiagramY_left = 100;//
 
        protected float _axisLabelSpaceToDiagramY_right = 15;//刻度文字离Y轴的距离(只对Y)
        protected float _axisTitleSpaceToDiagramY_right = 45;//
 
        protected Point2D _diagramLeftBottomPt = new Point2D();
        protected Point2D _diagramRightBottomPt = new Point2D();
        protected Point2D _diagramLeftTopPt = new Point2D();
        protected Point2D _diagramRightTopPt = new Point2D();
 
        protected short _diagramBoundaryLineWidth = 2;
 
 
 
        //是否显示效率曲线
        protected bool _isDispCurveQE = true;//双达不显示
        public bool IsDispCurveQE { get { return _isDispCurveQE; } set { _isDispCurveQE = value; } }
 
 
        //曲线文字的间隙
        protected int _curveParasLabelSpaceX = 1;
        protected int _curveParasLabelSpaceY = 1;
 
        //X轴实际尺寸换算为像素尺寸
        protected virtual double MapRealToPictQ(double Q) { return 0; }
 
        //扬程曲线Y坐标实际尺寸换算为像素尺寸
        protected virtual double MapRealToPictH(double H) { return 0; }
 
        //效率曲线Y坐标实际尺寸换算为像素尺寸
        protected virtual double MapRealToPictE(double E) { return 0; }
 
        //功率曲线Y坐标实际尺寸换算为像素尺寸
        protected virtual double MapRealToPictP(double P) { return 0; }
 
        //汽蚀曲线Y坐标实际尺寸换算为像素尺寸
        protected virtual double MapRealToPictNPSH(double NPSH) { return 0; }
 
        //检查扬程线的坐标有没有超出
        protected void CheckPressCoord()
        {
            if (this._pointInfoQH == null)
                return;
            foreach (var lastPt in this._pointInfoQH)
            {
                if (this._coordinateParas.DispMinH() > lastPt.Y)
                {
                    if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0)
                        this._coordinateParas.StartLineNoH--;
 
                    if (this._coordinateParas.DispMinH() > lastPt.Y)
                    {
                        if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0)
                            this._coordinateParas.StartLineNoH--;
 
                        if (this._coordinateParas.DispMinH() > lastPt.Y)
                        {
                            if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0)
                                this._coordinateParas.StartLineNoH--;
                        }
                    }
                }
            }
        }
 
        //检查汽蚀线的坐标有没有超出
        protected void CheckNpshCoord()
        {
            if (this._allCurveNPSH == null)
                return;
            foreach (var curve in this._allCurveNPSH)
            {
                if (!curve.IsDispCurve)
                    continue;
 
                if (curve.CurveInfo != null && curve.CurveInfo.Count > 0)
                {
                    var lastPt = curve.CurveInfo.LastOrDefault();
                    if (this._coordinateParas.DispMaxNPSH() < lastPt.Y)
                        this._coordinateParas.EndLineNoNPSH++;
                }
                else if (curve.CurveExpress != null)
                {
                    var lastPt = curve.CurveExpress.GetLastPoint();
                    if (this._coordinateParas.DispMaxNPSH() < lastPt.Y)
                    {
                        this._coordinateParas.EndLineNoNPSH++;
 
                        if (this._coordinateParas.DispMaxNPSH() < lastPt.Y)
                        {
                            this._coordinateParas.EndLineNoNPSH++;
 
                            if (this._coordinateParas.DispMaxNPSH() < lastPt.Y)
                            {
                                this._coordinateParas.EndLineNoNPSH++;
                            }
                        }
                    }
 
                }
            }
        }
        //检查汽蚀线的坐标有没有超出
        protected void CheckPowerCoord()
        {
            if (this._pointInfoQP == null)
                return;
            foreach (var lastPt in this._pointInfoQP)
            {
                if (this._coordinateParas.DispMaxP() < lastPt.Y)
                {
                    this._coordinateParas.EndLineNoP++;
                    if (this._coordinateParas.DispMaxP() < lastPt.Y)
                    {
                        this._coordinateParas.EndLineNoP++;
                        if (this._coordinateParas.DispMaxP() < lastPt.Y)
                        {
                            this._coordinateParas.EndLineNoP++;
                        }
                    }
                }
            }
        }
 
 
        //检查坐标是否重叠冲突(合并坐标,需要检查)
        protected void CheckEtaNpshCoord冲突()
        {
            if (_coordinateParas.EndLineNoNPSH > _coordinateParas.StartLineNoNPSH)
            {
                for (int dd = 0; dd < 10; dd++)
                {
                    if (_coordinateParas.EndLineNoNPSH >= _coordinateParas.StartLineNoE)
                    {
                        _coordinateParas.EndLineNoE++;
                        _coordinateParas.StartLineNoE++;
                        _coordinateParas.CoordMinE = _coordinateParas.CoordMinE - _coordinateParas.CoordSpaceE;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
        //检查坐标是否重叠冲突(合并坐标,需要检查)
        protected void CheckPowerHeadCoord冲突()
        {
            if (_coordinateParas.EndLineNoP + 1 >= _coordinateParas.StartLineNoH)
            {
                for (int dd = 0; dd < 10; dd++)
                {
                    if (_coordinateParas.EndLineNoP + 1 >= _coordinateParas.StartLineNoH)
                    {
                        _coordinateParas.StartLineNoH++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
 
 
        protected int _blankGridNumberUpBottom = 2;//扬程下面预留2个格子
        protected int _blankGridNumberUpTop = 1;//扬程上面预留1个格子
 
        protected int _blankGridNumberDownBottom = 1;//功率下面预留2个格子
        protected int _blankGridNumberDownTop = 1;//功率上面预留1个格子
        public int BlankGridNumberDownTop
        {
            get { return _blankGridNumberDownTop; }
            set { _blankGridNumberDownTop = value; }
        }
    }
}