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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
using WW.Cad.Base;
using WW.Cad.Drawing;
using WW.Cad.Drawing.GDI;
using WW.Cad.IO;
using WW.Cad.Model;
using WW.Math;
using WW.Cad.Model.Entities;
using WW.Actions;
using WW.Cad.Model.Tables;
using WW.Cad.Model.Objects;
 
namespace TProduct.PumpGraph.Dxf
{
    //坐标在一起的那种
    public partial class LxpFeatChart7
    {
        private void DrawPanelQE_QNpsh()
        {
            DrawGidLineInQE_NSPH_竖直();
            DrawGidLineInQE_NSPH_水平();
            DrawAxisEta();
            DrawAxisNPSH();
        }
        private void DrawPanelQNpsh()
        {
            DrawGidLineInNSPH_竖直();
            DrawGidLineInNSPH_水平();
     
            DrawAxisNPSH();
        }
        private void DrawGidLineInQE_NSPH_竖直()
        {
            double spaceWidth = (_diagramRightBottomPt_QE.X - _diagramLeftBottomPt_QE.X) / (_coordinateParas.GridNumberX);//X轴上格子的宽度
      
            var layer_grid_line = GetLayerByName("细实线");
 
            double spaceInteriorWidth = spaceWidth / 3;
            for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
            {
                double space = i * spaceWidth;//竖直线之间的间距
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QE.X + space, _diagramLeftBottomPt_QE.Y);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QE.X + space, _diagramLeftTopPt_QE.Y);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.Layer = layer_grid_line;
 
                _dxfFileModel.Entities.Add(dxfLine);
 
                if (i != _coordinateParas.GridNumberX)
                {
                    for (int j = 1; j < 3; j++)
                    {
                        Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QE.X + space + spaceInteriorWidth * j, _diagramLeftBottomPt_QE.Y);
                        Point2D endXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QE.X + space + spaceInteriorWidth * j, _diagramLeftTopPt_QE.Y);
                        DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
                        dxfLine_subjoin.Color = this._gridLineColor;
                        dxfLine_subjoin.Layer = layer_grid_line;
                        _dxfFileModel.Entities.Add(dxfLine_subjoin);
                    }
                }
            }
        }
 
        private void DrawGidLineInQE_NSPH_水平()
        {
            var gridNumber = _coordinateParas.EndLineNoE - _coordinateParas.StartLineNoE;
            double spaceHeight = (_diagramLeftTopPt_QE.Y - _diagramLeftBottomPt_QE.Y) / gridNumber;//Y轴上格子的宽度
            double spaceInteriorHeight = spaceHeight / 5;
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //bool isIntervalLabel = false;
            //if (hGridNumber > 5)
            //{
            //    isIntervalLabel = true;
            //}
            for (int i = 0; i < gridNumber; i++)
            {
                //if (isIntervalLabel && i % 2 == 0)
                //    continue;
 
                double space = i * spaceHeight;//水平线
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QE.X, _diagramLeftBottomPt_QE.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QE.X, _diagramLeftBottomPt_QE.Y + space);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(dxfLine);
 
                for (int j = 1; j < 5; j++)
                {
                    Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QE.X, _diagramLeftBottomPt_QE.Y + space + spaceInteriorHeight * j);
                    Point2D endXgeziPt_subjoin = new Point2D(_diagramRightBottomPt_QE.X, _diagramLeftBottomPt_QE.Y + space + spaceInteriorHeight * j);
                    DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
                    dxfLine_subjoin.Color = this._gridLineColor;
                    dxfLine_subjoin.Layer = layer_grid_line;
                    _dxfFileModel.Entities.Add(dxfLine_subjoin);
                }
            }
 
            DxfLine dxfTopLine = new DxfLine(new Point2D(_diagramLeftTopPt_QE.X, _diagramLeftTopPt_QE.Y), new Point2D(_diagramRightTopPt_QE.X, _diagramLeftTopPt_QE.Y));
            dxfTopLine.Color = this._gridLineColor;
            _dxfFileModel.Entities.Add(dxfTopLine);
 
        }
     
        
        private void DrawGidLineInNSPH_竖直()
        {//只显示汽蚀, 不显示效率
            double spaceWidth = (_diagramRightBottomPt_QNPSH.X - _diagramLeftBottomPt_QNPSH.X) / (_coordinateParas.GridNumberX);//X轴上格子的宽度
 
            var layer_grid_line = GetLayerByName("细实线");
 
            double spaceInteriorWidth = spaceWidth / 3;
            for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
            {
                double space = i * spaceWidth;//竖直线之间的间距
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QNPSH.X + space, _diagramLeftBottomPt_QNPSH.Y);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QNPSH.X + space, _diagramLeftTopPt_QNPSH.Y);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.Layer = layer_grid_line;
 
                _dxfFileModel.Entities.Add(dxfLine);
 
                if (i != _coordinateParas.GridNumberX)
                {
                    for (int j = 1; j < 3; j++)
                    {
                        Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QNPSH.X + space + spaceInteriorWidth * j, _diagramLeftBottomPt_QNPSH.Y);
                        Point2D endXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QNPSH.X + space + spaceInteriorWidth * j, _diagramLeftTopPt_QNPSH.Y);
                        DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
                        dxfLine_subjoin.Color = this._gridLineColor;
                        dxfLine_subjoin.Layer = layer_grid_line;
                        _dxfFileModel.Entities.Add(dxfLine_subjoin);
                    }
                }
            }
        }
        private void DrawGidLineInNSPH_水平()
        {
            var gridNumber = _coordinateParas.EndLineNoNPSH - _coordinateParas.StartLineNoNPSH;
            double spaceHeight = (_diagramLeftTopPt_QNPSH.Y - _diagramLeftBottomPt_QNPSH.Y) / gridNumber;//Y轴上格子的宽度
            double spaceInteriorHeight = spaceHeight / 5;
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //bool isIntervalLabel = false;
            //if (hGridNumber > 5)
            //{
            //    isIntervalLabel = true;
            //}
            for (int i = 0; i < gridNumber; i++)
            {
                //if (isIntervalLabel && i % 2 == 0)
                //    continue;
 
                double space = i * spaceHeight;//水平线
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + space);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(dxfLine);
 
                //if (gridNumber != i)
                {
                    for (int j = 1; j < 5; j++)
                    {
                        Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + space + spaceInteriorHeight * j);
                        Point2D endXgeziPt_subjoin = new Point2D(_diagramRightBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + space + spaceInteriorHeight * j);
                        DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
                        dxfLine_subjoin.Color = this._gridLineColor;
                        dxfLine_subjoin.Layer = layer_grid_line;
                        _dxfFileModel.Entities.Add(dxfLine_subjoin);
                    }
                }
 
            }
 
            DxfLine dxfTopLine = new DxfLine(new Point2D(_diagramLeftTopPt_QNPSH.X, _diagramLeftTopPt_QNPSH.Y), new Point2D(_diagramRightTopPt_QNPSH.X, _diagramLeftTopPt_QNPSH.Y));
            dxfTopLine.Color = this._gridLineColor;
            _dxfFileModel.Entities.Add(dxfTopLine);
 
        }
 
   
        private void DrawAxisEta()
        {
            double coorMin = _coordinateParas.DispMinE();
            double coordSpace = _coordinateParas.CoordSpaceE;
            double gridNumber = _coordinateParas.EndLineNoE - _coordinateParas.StartLineNoE;
            double coorMax = gridNumber * coordSpace;//刻度显示最大值
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //是否间隔的LABEL
            //bool isIntervalLabel = false;
            //if (_coordinateParas.GridNumberY > 20)
            //{
            //    isIntervalLabel = true;
            //}
     
            for (int i = 0; i < gridNumber + 1; i++)
            {
                double space = i * this._diagram_Cell_Height_E;
                double kedu_d = coorMin + i * coordSpace;
                if (kedu_d < 0.001)
                    kedu_d = 0;
                string kedu_str  = kedu_d.ToString();
                var labelPt = new Point3D(_diagramRightBottomPt_QE.X + 2.5, _diagramLeftBottomPt_QE.Y + space, 0d);
                DxfMText axisLabel = new DxfMText(kedu_str, labelPt, _axisLabelSizeY);//\P表示回车
                axisLabel.AttachmentPoint = AttachmentPoint.MiddleLeft;
                if (_axisTextFont != null)
                    axisLabel.Style = this._axisTextFont;
                axisLabel.Color = this._axisLabelColorP;
                axisLabel.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(axisLabel);
 
 
 
                Point2D startXgeziPt = new Point2D(_diagramRightBottomPt_QE.X + 1.2, _diagramRightBottomPt_QE.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QE.X, _diagramRightBottomPt_QE.Y + space);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.LineWeight = 40;
                dxfLine.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(dxfLine);
 
 
                ////
                //if (isIntervalLabel)
                //    i = i + 1;
            }
 
            string title = string.Format("Eta\r\n(%)");
 
            Point3D pt = new Point3D();
            pt.X = _diagramRightTopPt_QE.X + 8.5;
            pt.Y = _diagramRightTopPt_QE.Y - 3;
            pt.Z = 0;
            DxfMText textTitle = new DxfMText(title, pt, _axisTitleSizeY);
            textTitle.Color = this._axisTitleColorE;
            if (_axisTextFont != null)
                textTitle.Style = this._axisTextFont;
            textTitle.Layer = layer_grid_line;
            _dxfFileModel.Entities.Add(textTitle);
        }
 
        private void DrawAxisNPSH()
        {
            double coorMin = _coordinateParas.DispMinNPSH();
            double coordSpace = _coordinateParas.CoordSpaceNPSH;
            double gridNumber = _coordinateParas.EndLineNoNPSH - _coordinateParas.StartLineNoNPSH;
            double coorMax = gridNumber * coordSpace;//刻度显示最大值
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //是否间隔的LABEL
            //bool isIntervalLabel = false;
            //if (_coordinateParas.GridNumberY > 20)
            //{
            //    isIntervalLabel = true;
            //}
 
 
            for (int i = 0; i < gridNumber + 1; i++)
            {
                double space = i * _diagram_Cell_Height_NPSH;
                double kedu_d = coorMin + i * coordSpace ;
                if (kedu_d < 0.001)
                    kedu_d = 0;
                string kedu_str = kedu_d.ToString();
                var labelPt = new Point3D(_diagramLeftBottomPt_QNPSH.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt_QNPSH.Y + space, 0d);
                DxfMText axisLabel = new DxfMText(kedu_str, labelPt, _axisLabelSizeY);//\P表示回车
                axisLabel.AttachmentPoint = AttachmentPoint.MiddleRight;
                if (_axisTextFont != null)
                    axisLabel.Style = this._axisTextFont;
                axisLabel.Color = this._axisLabelColorP;
                axisLabel.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(axisLabel);
 
 
 
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QNPSH.X - 1.2, _diagramLeftBottomPt_QNPSH.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + space);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.LineWeight = 40;
                dxfLine.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(dxfLine);
 
 
                ////
                //if (isIntervalLabel)
                //    i = i + 1;
            }
 
            string title = string.Format("NPSH\r\n(m)");
 
            Point3D pt = new Point3D();
            pt.X = _diagramLeftTopPt_QNPSH.X - 9.5;
            pt.Y = _diagramLeftTopPt_QNPSH.Y + 2;
            pt.Z = 0;
            DxfMText textTitle = new DxfMText(title, pt, _axisTitleSizeY);
            textTitle.Color = this._axisTitleColorNPSH;
            textTitle.AttachmentPoint = AttachmentPoint.MiddleRight;
            if (_axisTextFont != null)
                textTitle.Style = this._axisTextFont;
            textTitle.Layer = layer_grid_line;
            _dxfFileModel.Entities.Add(textTitle);
        }
 
    }
}