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
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 DrawPanelQH()
        {
            DrawGidLineInQH_竖直();
            DrawGidLineInQH_水平();
            DrawAxisHead();
     
        }
 
        private void DrawGidLineInQH_竖直()
        {
            double spaceWidth = (_diagramRightBottomPt_QH.X - _diagramLeftBottomPt_QH.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_QH.X + space, _diagramLeftBottomPt_QH.Y);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X + space, _diagramLeftTopPt_QH.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_QH.X + space + spaceInteriorWidth * j, _diagramLeftBottomPt_QH.Y);
                        Point2D endXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QH.X + space + spaceInteriorWidth * j, _diagramLeftTopPt_QH.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 DrawGidLineInQH_水平()
        {
            var gridNumber = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH;
            double spaceHeight = (_diagramLeftTopPt_QH.Y - _diagramLeftBottomPt_QH.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_QH.X, _diagramLeftBottomPt_QH.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QH.X, _diagramLeftBottomPt_QH.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_QH.X, _diagramLeftBottomPt_QH.Y + space + spaceInteriorHeight * j);
                    Point2D endXgeziPt_subjoin = new Point2D(_diagramRightBottomPt_QH.X, _diagramLeftBottomPt_QH.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_QH.X, _diagramLeftTopPt_QH.Y), new Point2D(_diagramRightTopPt_QH.X, _diagramLeftTopPt_QH.Y));
            dxfTopLine.Color = this._gridLineColor;
            _dxfFileModel.Entities.Add(dxfTopLine);
 
        }
 
        private void DrawAxisHead()
        {
            double coorMin = _coordinateParas.DispMinH();
            double coordSpace = _coordinateParas.CoordSpaceH;
            double gridNumber = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH;
            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(_diagramLeftBottomPt_QH.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt_QH.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._axisLabelColorH;
                axisLabel.Layer = layer_grid_line;
                _dxfFileModel.Entities.Add(axisLabel);
 
 
 
                Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X - 1.2, _diagramLeftBottomPt_QH.Y + space);
                Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X, _diagramLeftBottomPt_QH.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("H\r\n(m)");
 
            Point3D pt = new Point3D();
            pt.X = _diagramLeftTopPt_QH.X - 9.5;
            pt.Y = _diagramLeftTopPt_QH.Y - 3;
            pt.Z = 0;
            DxfMText textTitle = new DxfMText(title, pt, _axisTitleSizeY);
            textTitle.Color = this._axisTitleColorE;
            textTitle.AttachmentPoint = AttachmentPoint.MiddleRight;
            if (_axisTextFont != null)
                textTitle.Style = this._axisTextFont;
            textTitle.Layer = layer_grid_line;
            _dxfFileModel.Entities.Add(textTitle);
        }
 
    }
}