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
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 DrawPanelQP()
        {
            DrawGidLineInQP_竖直();
            DrawGidLineInQP_水平();
 
            DrawAxisPower();
 
            DrawAxisFlow_功率();
        }
 
        private void DrawGidLineInQP_竖直()
        {
            double spaceWidth = (_diagramRightBottomPt.X - _diagramLeftBottomPt.X) / (_coordinateParas.GridNumberX);//X轴上格子的宽度
 
            var layer_grid_line = GetLayerByName("细实线");
 
            double spaceInteriorWidth = spaceWidth / 5;
            for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
            {
                double space = i * spaceWidth;//竖直线之间的间距
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X + space, _diagramLeftBottomPt_QP.Y  );
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X + space, _diagramLeftTopPt_QP.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 < 5; j++)
                    {
                        Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QP.X + space + spaceInteriorWidth * j, _diagramLeftBottomPt_QP.Y);
                        Point2D endXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QP.X + space + spaceInteriorWidth * j, _diagramLeftTopPt_QP.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 DrawGidLineInQP_水平() 
        {
            var layer_grid_line = GetLayerByName("细实线");
 
            var gridNumber = _coordinateParas.EndLineNoP - _coordinateParas.StartLineNoP;
            double spaceHeight = _diagramLeftTopPt_QP.Y / gridNumber;//Y轴上格子的宽度
            double spaceInteriorHeight = spaceHeight / 5;
 
            for (int i = 0; i < gridNumber; i++)
            {
                double space = i * spaceHeight;//竖直线之间的间距
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X , _diagramLeftBottomPt_QP.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QP.X, _diagramLeftBottomPt_QP.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_QP.X, _diagramLeftBottomPt_QP.Y + space + spaceInteriorHeight * j);
                    Point2D endXgeziPt_subjoin = new Point2D(_diagramRightBottomPt_QP.X, _diagramLeftBottomPt_QP.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(_diagramLeftBottomPt.X, _diagramLeftBottomPt.Y + _diagramLeftTopPt_QP.Y), new Point2D(_diagramRightBottomPt.X, _diagramLeftBottomPt.Y + _diagramLeftTopPt_QP.Y));
            dxfTopLine.Color = this._gridLineColor;
            _dxfFileModel.Entities.Add(dxfTopLine);
 
        }
 
        private void DrawAxisPower()
        {
            double coorMin = _coordinateParas.DispMinP();
            double coordSpace = _coordinateParas.CoordSpaceP;
            double gridNumber = _coordinateParas.EndLineNoP - _coordinateParas.StartLineNoP;
            double coorMax = gridNumber * coordSpace;//刻度显示最大值
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //是否间隔的LABEL
            //bool isIntervalLabel = false;
            //if (_coordinateParas.GridNumberY > 20)
            //{
            //    isIntervalLabel = true;
            //}
            double spaceHeight = _diagramLeftTopPt_QP.Y / gridNumber;
 
            for (int i = 0; i < gridNumber + 1; i++)
            {
                double space = i * spaceHeight;
                double kedu_d = coorMin + i * coordSpace;
                if (kedu_d < 0.001)
                    kedu_d = 0;
                string kedu_str = "";
                kedu_str = kedu_d.ToString();
                var labelPt = new Point3D(_diagramLeftBottomPt.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt.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_QP.X - 1.2, _diagramLeftBottomPt_QP.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X, _diagramLeftBottomPt_QP.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("P\r\n(kW)");
            if (this._currentLangugage != Eventech.Model.eLocalizationType.zhCN)
            {
                title = string.Format("P(m)");
            }
            Point3D pt = new Point3D();
            pt.X = _diagramLeftTopPt_QP.X - 9.5;
            pt.Y = _diagramLeftTopPt_QP.Y - 5;
            pt.Z = 0;
            DxfMText textTitle = new DxfMText(title, pt, _axisTitleSizeY);
            textTitle.Color = this._axisTitleColorP;
            textTitle.AttachmentPoint = AttachmentPoint.MiddleRight;
            if (_axisTextFont != null)
                textTitle.Style = this._axisTextFont;
            textTitle.Layer = layer_grid_line;
            _dxfFileModel.Entities.Add(textTitle);
        }
 
 
        protected void DrawAxisFlow_功率()
        {
            double coorminQ = _coordinateParas.CoordMinQ;//最小显示值
            double coordSpace = _coordinateParas.CoordSpaceQ;//一个格子代表的数值15
            double coormax = (_coordinateParas.GridNumberX + 1) * coordSpace + coorminQ;//刻度显示最大值
 
            var layer_grid_line = GetLayerByName("细实线");
 
            //是否间隔的LABEL
            bool isIntervalLabel = false;
            if (_coordinateParas.GridNumberX > 20)
            {
                isIntervalLabel = true;
            }
 
            double spaceWidth = (_diagramRightBottomPt.X - _diagramLeftBottomPt.X) / (_coordinateParas.GridNumberX);//X轴上格子的宽度
 
            for (int i = 0; i < _coordinateParas.GridNumberX + 1; i = i + 1)
            {
                double space = i * spaceWidth;
                double kedu_d = coorminQ + i * coordSpace;
                if (kedu_d < 0.001)
                    kedu_d = 0;
                string kedu_str = "";
                if (_unitQ == Eventech.Model.UnitQ.M3H)
                {
                    kedu_str = kedu_d.ToString();
                }
                else
                {
                    kedu_str = Eventech.Common.UnitQHelper.fromM3H(_unitQ, kedu_d).ToString("N2");
                }
 
                var labelPtQ = new Point3D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y - _axisLabelSpaceToDiagramQ, 0d);
                DxfMText axisLabel_q = new DxfMText(kedu_str, labelPtQ, _axisLabelSizeX);//\P表示回车
                axisLabel_q.AttachmentPoint = AttachmentPoint.TopCenter;
                if (_axisTextFont != null)
                    axisLabel_q.Style = this._axisTextFont;
                axisLabel_q.Color = this._axisLabelColorQ;
                axisLabel_q.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(axisLabel_q);
 
 
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X + space, _diagramLeftBottomPt_QP.Y - 1.2);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QP.X + space, _diagramLeftBottomPt_QP.Y);
                DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
                dxfLine.Color = this._gridLineColor;
                dxfLine.Layer = layer_grid_line;
                dxfLine.LineWeight = 40;
                _dxfFileModel.Entities.Add(dxfLine);
 
                //
                if (isIntervalLabel)
                    i = i + 1;
            }
 
            var spec_font = _dxfFileModel.GetTextStyleWithName("长仿宋体");
            if (_frameTextFont != null)
            {
                spec_font = _frameTextFont; ;
            }
 
            string title = "";
            if (_unitQ == Eventech.Model.UnitQ.M3H)
            {
                title = @"Q(m{\fArial|b0|i0|c0|p34;\W1;³}/h)";
            }
            
            else
            {title = string.Format(" Q({0})",BuildCadText( Eventech.Common.UnitQHelper.GetEnUnitName(_unitQ)));
            }
 
            Point3D pt = new Point3D();
            pt.X = _diagramLeftBottomPt.X + (_diagramRightBottomPt.X - _diagramLeftBottomPt.X) / 2 - _axisTitleSizeX * 2;
            pt.Y = _diagramLeftBottomPt.Y - _axisTitleSpaceToDiagramQ_Y;
            pt.Z = 0;
            DxfMText textTitleQ = new DxfMText(title, pt, _axisTitleSizeX);
            textTitleQ.Color = this._axisTitleColorQ;
            if (spec_font != null)
                textTitleQ.Style = spec_font;
            textTitleQ.Layer = layer_grid_line;
            _dxfFileModel.Entities.Add(textTitleQ);
        }
 
        protected override string BuildCadText(string content)
        {
            return @"{\fArial|b0|i0|c0|p34;\W1;" + content + "}";
        }
 
    }
}