tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
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 ZlpFeatChart10 : ZlpFeatChart
    {
        public ZlpFeatChart10()
        {
            AxisTitlePosiStyleY = eAxisTitlePosiStyle.Top;//纵坐标标题的位置 0表示 中间, 1表示刻度的上面
            _axisLabelSizeX = 8;
            _axisLabelSizeY = 8;
            _axisTitleSizeX = 10;
            _axisTitleSizeY = 10;
 
 
            _axisMajorTickLength = 4;//长刻度线的长度
            _axisMinorTickLength = 2;//短刻度线的长度
 
            _defatulCurveLabelHeight = 8;
            _equalCurveParaLabelHeight = 5;
 
 
            _axisLabelSpaceToDiagramY_left = 8;//刻度文字离Y轴的距离 
            _axisTitleSpaceToDiagramY_left = 9;//
 
            _axisTitleSpaceToLabel_Vertial_Y = 20;
 
            _axisLabelSpaceToDiagramQ = 8;//刻度文字离X轴的距离 
            _axisTitleSpaceToDiagramQ = 32;//
        }
 
        public virtual bool InitialTemplate()
        {
            return false;
        }
 
        public override bool CreateDxf(string strFilePath)
        {
            try
            {
                if (string.IsNullOrEmpty(_strTemplateFile) || !System.IO.File.Exists(_strTemplateFile))
                {
                    return false;
                }
 
 
                _dxfFileModel = DwgReader.Read(_strTemplateFile);
 
                InitialChartColorAndFont();
 
                InitialDiagramSize();
 
                DrawAxisQ_First();//画X轴
 
                DrawAxisH();//画Y轴
 
                DrawDesignPointLine();
 
                if (CurveInfoQH != null && CurveInfoQH.Count > 0)
                {
                    foreach (var curve in CurveInfoQH)
                    {
                        if (_annoAnchorPointList == null)
                        {
                            DrawSingleCurveH(curve.PointInfo, curve.CurvePara.ToString() + "°",false);
                        }
                        else
                        {
                            DrawSingleCurveH(curve.PointInfo,null,false);
                        }
                    }
                }
 
                if (EqualParaCurveE != null && EqualParaCurveE.Count > 0)
                {
                    foreach (var curve in EqualParaCurveE)
                    {
                        if (_annoAnchorPointList == null)
                        {
                            DrawSingleCurveE(curve.PointInfo, curve.CurvePara.ToString() + "%", curve.IsClosed);
                        }
                        else
                        {
                            DrawSingleCurveE(curve.PointInfo, null, curve.IsClosed);
                        }
                    }
                }
 
                //
                DrawCurveLabel();
 
                DrawDesignPointLine();
 
 
 
 
 
                //标题栏
                 DrawFrameTtileText_Draw();
 
                //绘制参数表
                CreateOhterHdrTable();
 
                //if (_equipmentCurveParas != null)
                //{
                //    WW.Cad.Model.Entities.EntityColor colorDxf = GetEntityColor(System.Drawing.Color.Beige);
 
                //    DrawSingleCurveQH(colorDxf, _equipmentCurveParas.CurveInfo, null);
                //}
 
 
                ////添加尺寸
                //DxfDimension.Aligned dimension = new DxfDimension.Aligned(_dxfFileModel.DefaultDimensionStyle);
                //dimension.DimensionLineLocation = new Point3D(7, 2, 0);
                //// Touches bottom side of the circle.
                //dimension.ExtensionLine1StartPoint = new Point3D(3, 0, 0);
                //// Touches top side of the circle.
                //dimension.ExtensionLine2StartPoint = new Point3D(3, 4, 0);
                //_dxfFileModel.Entities.Add(dimension);
 
 
 
                //保存文件
                this._printKindSize = System.Drawing.Printing.PaperKind.A4;
                SaveFile(strFilePath);
 
 
            }
            catch  //(Exception ex)
            {
 
                return false;
            }
 
 
            return true;
        }
 
        protected override void InitialChartColorAndFont()
        {
            base.InitialChartColorAndFont();
            //默认字体
            //_axisTextFont = new DxfTextStyle("arial", "arial.ttf");
            //_defaultTextFont = new DxfTextStyle("simfang", "simfang.ttf");//仿宋体 在WINDOWS/FONT下的文件名称
            //   _dxfFileModel.TextStyles.Add(_axisTextFont);
            var hz0 = _dxfFileModel.GetTextStyleWithName("HZTXT");//文件自带字体 
            _axisTextFont = hz0;
 
            _frameTextFont = hz0;//文件自带字体 
 
            _frameTextColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GreenColor;
            _curveTextFont = hz0;//文件自带字体 
        }
 
        public override bool InitialTemplate(string CorpDataFolder, Eventech.Model.eLocalizationType location, string attachInfo)
        {
            _currentLangugage = location;
            var file = GetTemplateFilePath(CorpDataFolder, location);
            if (string.IsNullOrEmpty(file))
                return false;
            this._strTemplateFile = file;
            return true;
        }
 
        public static string GetTemplateFilePath(string CorpDataFolder, Eventech.Model.eLocalizationType location)
        {
            string strTemplateFolder = null;
            if (location != Eventech.Model.eLocalizationType.zhCN)
            {
                strTemplateFolder = System.IO.Path.Combine(CorpDataFolder, "template", "ZLP_Style10_EN.dwg");
                if (System.IO.File.Exists(strTemplateFolder))
                {
                    return strTemplateFolder;
                }
                strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style10_EN.dwg");
                if (System.IO.File.Exists(strTemplateFolder))
                {
                    return strTemplateFolder;
                }
            }
 
            strTemplateFolder = System.IO.Path.Combine(CorpDataFolder, "template", "ZLP_Style10_CN.dwg");
            if (System.IO.File.Exists(strTemplateFolder))
            {
                return strTemplateFolder;
            }
            strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style10_CN.dwg");
            if (System.IO.File.Exists(strTemplateFolder))
            {
                return strTemplateFolder;
            }
 
            return strTemplateFolder;
        }
 
 
 
 
        // 设计点
        private void DrawDesignPointLine()
        {
            if (_designPointStdUnit == null)
                return;
            Point2D centerPt = new Point2D();
            centerPt.X = MapRealToPictQ(_coordinateParas.AxisCalcQ.Calc(_designPointStdUnit.X));
            centerPt.Y = MapRealToPictH(_coordinateParas.AxisCalcH.Calc(_designPointStdUnit.Y));
 
 
            DxfLine lineH = new DxfLine(new Point2D(centerPt.X, centerPt.Y),
                   new Point2D(centerPt.X - 25, centerPt.Y));
            lineH.LineWeight = 35;
            lineH.Color = _designPointColor;
            _dxfFileModel.Entities.Add(lineH);
 
 
            DxfLine lineV = new DxfLine(new Point2D(centerPt.X, centerPt.Y),
                new Point2D(centerPt.X, centerPt.Y - 16));
            lineV.LineWeight = 35;
            lineV.Color = _designPointColor;
            _dxfFileModel.Entities.Add(lineV);
 
 
            DxfLine lineX1 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 16),
    new Point2D(centerPt.X - 25, centerPt.Y));
            lineX1.LineWeight = 35;
            lineX1.Color = _designPointColor;
            _dxfFileModel.Entities.Add(lineX1);
 
            DxfLine lineX2 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 11.26),
new Point2D(centerPt.X - 17.45, centerPt.Y));
            lineX2.LineWeight = 35;
            lineX2.Color = _designPointColor;
            _dxfFileModel.Entities.Add(lineX2);
 
 
            DxfLine lineX3 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 6.52),
new Point2D(centerPt.X - 10.1, centerPt.Y));
            lineX3.LineWeight = 35;
            lineX3.Color = _designPointColor;
            _dxfFileModel.Entities.Add(lineX3);
 
        }
  
    }
}