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; using Eventech.Model; namespace TProduct.PumpGraph.Dxf { //坐标在一起的那种 public partial class MultiSpeed_Whole : MultiSpeedBaseCuve { //绘制刻度显示值 protected void DrawAxisX() { double coorminQ = _coordinateParas.CoordMinQ;//最小显示值 double coordSpace = _coordinateParas.CoordSpaceQ;//一个格子代表的数值15 double coormax = (_coordinateParas.GridNumberX + 1) * coordSpace + coorminQ;//刻度显示最大值 //_defaultTextFont = new DxfTextStyle("MYSTYLE", "simfang.ttf");//仿宋体 在WINDOWS/FONT下的文件名称 //_dxfFileModel.TextStyles.Add(_defaultTextFont); //_dxfFileModel.TextStyles.Add(_defaultTextFont); //是否间隔的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"); } //DxfText axisLabel = new DxfText(kedu_str, new Point3D(_diagramLeftBottomPt.X + space - _axisLabelSizeX / 2, _diagramLeftBottomPt.Y - _axisLabelSpaceToDiagramQ, 0d), _axisLabelSizeX); //axisLabel.Thickness = 0.4d; //axisLabel.Color = _axisLabelColorQ; //if (_defaultTextFont != null) // axisLabel.Style = _defaultTextFont; //_dxfFileModel.Entities.Add(axisLabel); 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; _dxfFileModel.Entities.Add(axisLabel_q); // if (isIntervalLabel) i = i + 1; } //绘制网格线 if (_isDispGridLineX) { for (int i = 1; i < _coordinateParas.GridNumberX; i++) { double space = i * spaceWidth;//竖直线之间的间距 Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y); Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftTopPt.Y); DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } string title = string.Format("流量({0})", 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; pt.Z = 0; DxfText textTitleQ = new DxfText(title, pt, _axisTitleSizeX); textTitleQ.Thickness = 0.5d; textTitleQ.Color = this._axisTitleColorQ; if (_axisTextFont != null) textTitleQ.Style = this._axisTextFont; _dxfFileModel.Entities.Add(textTitleQ); for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++) { double space = i * spaceWidth;//竖直线之间的间距 Point2D startPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y); Point2D endPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y - _axisMajorTickLength); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } for (int i = 0; i < _coordinateParas.GridNumberX; i++) { double Longspace = i * spaceWidth;//竖直线之间的间距 for (int j = 1; j <= _minorTickNumberX; j++) { double space = j * spaceWidth / _minorTickNumberX; double x = _diagramLeftBottomPt.X + space + Longspace; Point2D startPt = new Point2D(x, _diagramLeftBottomPt.Y); Point2D endPt = new Point2D(x, _diagramLeftBottomPt.Y - _axisMinorTickLength); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } } //绘制QH刻度数值和刻度线 protected void DrawAxisH() { double coordSpace = _coordinateParas.CoordSpaceH;//一个格子代表的数值 int gridNumber = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH;//Y格子的数量 // _dxfFileModel.TextStyles.Add(_defaultTextFont); //是否间隔的LABEL bool isIntervalLabel = false; if (_coordinateParas.StartLineNoH - _coordinateParas.EndLineNoH > 8) { isIntervalLabel = true; } double gridHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y) / _coordinateParas.GridNumberY; //刻度文字 for (int i = _coordinateParas.StartLineNoH; i <= _coordinateParas.EndLineNoH; i++) { double space = i * gridHeight; double kedu_d = _coordinateParas.CoordMinH + i * coordSpace;//刻度值显示 if (kedu_d < 0.001) kedu_d = 0; string kedu_str = ""; if (_unitH == Eventech.Model.UnitH.M) { kedu_str = kedu_d.ToString(); } else if (_unitH == Eventech.Model.UnitH.MPa) { kedu_str = (kedu_d / 100).ToString(); } else { kedu_str = Eventech.Common.UnitHHelper.fromM2(_unitH, kedu_d).ToString("N2"); } var labelPtH = new Point3D(_diagramLeftBottomPt.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt.Y + space, 0d); DxfMText axisLabel_h = new DxfMText(kedu_str, labelPtH, _axisLabelSizeY);//\P表示回车 axisLabel_h.AttachmentPoint = AttachmentPoint.MiddleRight; if (_axisTextFont != null) axisLabel_h.Style = this._axisTextFont; axisLabel_h.Color = this._axisLabelColorH; _dxfFileModel.Entities.Add(axisLabel_h); if (isIntervalLabel) { i++; } } Point3D pt_title = new Point3D(); pt_title.X = _diagramLeftBottomPt.X - _axisTitleSpaceToDiagramY_left; //纵坐标标题的位置 0表示 中间, 1表示刻度的上面 if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { pt_title.Y = _diagramLeftBottomPt.Y + _coordinateParas.EndLineNoH * gridHeight + _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } else { pt_title.Y = _diagramLeftBottomPt.Y + (_coordinateParas.StartLineNoH + _coordinateParas.EndLineNoH) * gridHeight / 2 - _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } pt_title.Z = 0; DxfMText textTitle; if (this._isTwoLineAxisTileY) textTitle = new DxfMText(string.Format(@"扬程\P({0})", Eventech.Common.UnitHHelper.GetEnUnitName(_unitH)), pt_title, _axisTitleSizeY);//\P表示回车 else textTitle = new DxfMText(string.Format("扬程 ({0})", Eventech.Common.UnitHHelper.GetEnUnitName(_unitH)), pt_title, _axisTitleSizeY);//\P表示回车 if (this._isRotateAxisTitleY) { textTitle.XAxis = new Vector3D(0, 1, 0); textTitle.ZAxis = new Vector3D(0, 0, 1); } if (this._axisTextFont != null) textTitle.Style = this._axisTextFont; if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { textTitle.AttachmentPoint = AttachmentPoint.BottomCenter; } else { textTitle.AttachmentPoint = AttachmentPoint.TopCenter; } textTitle.Color = this._axisTitleColorH; _dxfFileModel.Entities.Add(textTitle); //画刻度线 (主) for (int i = _coordinateParas.StartLineNoH; i <= _coordinateParas.EndLineNoH; i++) { double space = i * gridHeight;//水平线的间距 Point2D axisTitleStartPt = new Point2D(_diagramLeftBottomPt.X, _diagramLeftBottomPt.Y + space); Point2D axisTitleEndPt = new Point2D(_diagramLeftBottomPt.X - _axisMajorTickLength, _diagramLeftBottomPt.Y + space); DxfLine dxfLine = new DxfLine(axisTitleStartPt, axisTitleEndPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } //画较短刻度线 if (_minorTickNumberY > 0) { for (int i = _coordinateParas.StartLineNoH; i <= _coordinateParas.EndLineNoH - 1; i++) { double space = i * gridHeight; for (int j = 1; j < _minorTickNumberY; j++) { double y = _diagramLeftBottomPt.Y + space + j * gridHeight / _minorTickNumberY; Point2D startPt = new Point2D(_diagramLeftBottomPt.X, y); Point2D endPt = new Point2D(_diagramLeftBottomPt.X - _axisMinorTickLength, y); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } } } protected void DrawAxisE() { double coordSpace = _coordinateParas.CoordSpaceE;//一个格子代表的数值 int gridNumber = _coordinateParas.EndLineNoE - _coordinateParas.StartLineNoE;//Y格子的数量 //是否间隔的LABEL bool isIntervalLabel = false; if (_coordinateParas.StartLineNoE - _coordinateParas.EndLineNoE > 8) { isIntervalLabel = true; } double gridHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y) / _coordinateParas.GridNumberY; //刻度文字 for (int i = _coordinateParas.StartLineNoE; i <= _coordinateParas.EndLineNoE; i++) { if (i <= _coordinateParas.EndLineNoNPSH) continue;//保证不要重叠,效率少几个刻度没事 double space = i * gridHeight; double kedu = _coordinateParas.CoordMinE + i * coordSpace;//刻度值显示 if (kedu < 0.001) kedu = 0; Point3D startPt = new Point3D(_diagramRightBottomPt.X + _axisLabelSpaceToDiagramY_right, _diagramRightBottomPt.Y + space - _axisLabelSizeY / 2, 0d); DxfText textX = new DxfText(kedu.ToString(), startPt, 2d); textX.Thickness = 0.4d; textX.Height = this._axisLabelSizeY; textX.Color = this._axisLabelColorE; if (_axisTextFont != null) textX.Style = this._axisTextFont; _dxfFileModel.Entities.Add(textX); if (isIntervalLabel) { i++; } } Point3D pt_title = new Point3D(); pt_title.X = _diagramRightBottomPt.X + _axisTitleSpaceToDiagramY_right; //纵坐标标题的位置 0表示 中间, 1表示刻度的上面 if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { pt_title.Y = _diagramLeftBottomPt.Y + _coordinateParas.EndLineNoE * gridHeight + _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } else { pt_title.Y = _diagramLeftBottomPt.Y + (_coordinateParas.StartLineNoE + _coordinateParas.EndLineNoE) * gridHeight / 2 - _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } pt_title.Z = 0; DxfMText textTitle ; if (this._isTwoLineAxisTileY) textTitle = new DxfMText(@" 效率\P(%)", pt_title, this._axisTitleSizeY); else textTitle = new DxfMText("效率 (%)", pt_title, this._axisTitleSizeY); if (this._isRotateAxisTitleY) { textTitle.XAxis = new Vector3D(0, 1, 0); textTitle.ZAxis = new Vector3D(0, 0, 1); } if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { textTitle.AttachmentPoint = AttachmentPoint.BottomCenter; } else { textTitle.AttachmentPoint = AttachmentPoint.TopCenter; } if (_axisTextFont != null) textTitle.Style = _axisTextFont; textTitle.Color = _axisTitleColorE; _dxfFileModel.Entities.Add(textTitle); //画刻度线 (主) for (int i = _coordinateParas.StartLineNoE; i <= _coordinateParas.EndLineNoE; i++) { double space = i * gridHeight;//水平线的间距 Point2D majorTickStartPt = new Point2D(_diagramRightBottomPt.X, _diagramRightBottomPt.Y + space); Point2D majorTickEndPt = new Point2D(_diagramRightBottomPt.X + _axisMajorTickLength, _diagramRightBottomPt.Y + space); DxfLine dxfLine = new DxfLine(majorTickStartPt, majorTickEndPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } //画较短刻度线 if (_minorTickNumberY > 0) { for (int i = _coordinateParas.StartLineNoE; i <= _coordinateParas.EndLineNoE - 1; i++) { double space = i * gridHeight; for (int j = 1; j < _minorTickNumberY; j++) { double y = _diagramRightBottomPt.Y + space + j * gridHeight / _minorTickNumberY; Point2D startPt = new Point2D(_diagramRightBottomPt.X, y); Point2D endPt = new Point2D(_diagramRightBottomPt.X + _axisMinorTickLength, y); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } } } protected void DrawAxisP() { double coordSpace = _coordinateParas.CoordSpaceP;//一个格子代表的数值 int gridNumber = _coordinateParas.EndLineNoP - _coordinateParas.StartLineNoP;//Y格子的数量 //是否间隔的LABEL bool isIntervalLabel = false; if (_coordinateParas.StartLineNoP - _coordinateParas.EndLineNoP > 8) { isIntervalLabel = true; } double gridHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y) / _coordinateParas.GridNumberY; //刻度文字 for (int i = _coordinateParas.StartLineNoP; i <= _coordinateParas.EndLineNoP; i++) { if (i >= _coordinateParas.StartLineNoH) continue;//保证不要重叠,功率少几个刻度没事 double space = i * gridHeight; double kedu = _coordinateParas.CoordMinP + i * coordSpace;//刻度值显示 if (kedu < 0.001) kedu = 0; string kedu_str = kedu.ToString(); //Point3D labelPtP = new Point3D(_diagramLeftBottomPt.X - _axisLabelSpaceToDiagramY_left - 1, _diagramLeftBottomPt.Y + space - _axisLabelSizeY / 2, 0d); //DxfText textX = new DxfText(kedu.ToString(), labelPtP, 2d); //textX.Thickness = 0.4d; ////textY.Style = _defaultTextFont; //textX.Height = this._axisLabelSizeY; //textX.Color = _axisLabelColorP; //_dxfFileModel.Entities.Add(textX); var labelPtP = new Point3D(_diagramLeftBottomPt.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt.Y + space, 0d); DxfMText axisLabel_p = new DxfMText(kedu_str, labelPtP, _axisLabelSizeY);//\P表示回车 axisLabel_p.AttachmentPoint = AttachmentPoint.MiddleRight; if (_axisTextFont != null) axisLabel_p.Style = this._axisTextFont; axisLabel_p.Color = this._axisLabelColorP; _dxfFileModel.Entities.Add(axisLabel_p); if (isIntervalLabel) { i++; } } Point3D pt_title = new Point3D(); pt_title.X = _diagramLeftBottomPt.X - _axisTitleSpaceToDiagramY_left; //纵坐标标题的位置 0表示 中间, 1表示刻度的上面 if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { pt_title.Y = _diagramLeftBottomPt.Y + _coordinateParas.EndLineNoP * gridHeight + _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } else { pt_title.Y = _diagramLeftBottomPt.Y + (_coordinateParas.StartLineNoP + _coordinateParas.EndLineNoP) * gridHeight / 2 - _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } pt_title.Z = 0; DxfMText textTitle ; if (this._isTwoLineAxisTileY) textTitle = new DxfMText(@"功率\P(kW)", pt_title, this._axisTitleSizeY); else textTitle = new DxfMText("功率 (kW)", pt_title, this._axisTitleSizeY); if (this._isRotateAxisTitleY) { textTitle.XAxis = new Vector3D(0, 1, 0); textTitle.ZAxis = new Vector3D(0, 0, 1); } if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { textTitle.AttachmentPoint = AttachmentPoint.BottomCenter; } else { textTitle.AttachmentPoint = AttachmentPoint.TopCenter; } if (_axisTextFont != null) textTitle.Style = _axisTextFont; textTitle.Color = _axisTitleColorP; _dxfFileModel.Entities.Add(textTitle); //画刻度线 (主) for (int i = _coordinateParas.StartLineNoP; i <= _coordinateParas.EndLineNoP; i++) { double space = i * gridHeight;//水平线的间距 Point2D majorTickStartPt = new Point2D(_diagramLeftBottomPt.X, _diagramLeftBottomPt.Y + space); Point2D majorTickEndPt = new Point2D(_diagramLeftBottomPt.X - _axisMajorTickLength, _diagramLeftBottomPt.Y + space); DxfLine dxfLine = new DxfLine(majorTickStartPt, majorTickEndPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } //画较短刻度线 if (_minorTickNumberY > 0) { for (int i = _coordinateParas.StartLineNoP; i <= _coordinateParas.EndLineNoP - 1; i++) { double space = i * gridHeight; for (int j = 1; j < _minorTickNumberY; j++) { double y = _diagramLeftBottomPt.Y + space + j * gridHeight / _minorTickNumberY; Point2D startPt = new Point2D(_diagramLeftBottomPt.X, y); Point2D endPt = new Point2D(_diagramLeftBottomPt.X - _axisMinorTickLength, y); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } } } protected void DrawAxisNPSH() { if (!_isNPSHCurve) return; double coordSpace = _coordinateParas.CoordSpaceNPSH;//一个格子代表的数值 int gridNumber = _coordinateParas.EndLineNoNPSH - _coordinateParas.StartLineNoNPSH;//Y格子的数量 //是否间隔的LABNPSHL bool isIntervalLabel = false; if (_coordinateParas.StartLineNoNPSH - _coordinateParas.EndLineNoNPSH > 5) { isIntervalLabel = true; } double gridHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y) / _coordinateParas.GridNumberY; //刻度文字 for (int i = _coordinateParas.StartLineNoNPSH; i <= _coordinateParas.EndLineNoNPSH; i++) { double space = i * gridHeight; double kedu = _coordinateParas.CoordMinNPSH + i * coordSpace;//刻度值显示 if (kedu < 0.001) kedu = 0; Point3D startPt = new Point3D(_diagramRightBottomPt.X + _axisLabelSpaceToDiagramY_right, _diagramRightBottomPt.Y + space - this._axisLabelSizeY / 2, 0d); DxfText textX = new DxfText(kedu.ToString(), startPt, 2d); textX.Thickness = 0.4d; textX.Height = this._axisLabelSizeY; textX.Color = this._axisLabelColorNPSH; if (_axisTextFont != null) textX.Style = this._axisTextFont; _dxfFileModel.Entities.Add(textX); if (isIntervalLabel) { i++; } } Point3D pt_title = new Point3D(); pt_title.X = _diagramRightBottomPt.X + _axisTitleSpaceToDiagramY_right; //纵坐标标题的位置 0表示 中间, 1表示刻度的上面 if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { pt_title.Y = _diagramLeftBottomPt.Y + _coordinateParas.EndLineNoNPSH * gridHeight + _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } else { pt_title.Y = _diagramLeftBottomPt.Y + (_coordinateParas.StartLineNoNPSH + _coordinateParas.EndLineNoNPSH) * gridHeight / 2 - _axisTitleSizeY + _axisTitleSpaceToLabel_Vertial_Y; } pt_title.Z = 0; DxfMText textTitle = null; if (this._isTwoLineAxisTileY) textTitle = new DxfMText(@" 汽蚀\P(m)", pt_title, this._axisTitleSizeY); else textTitle = new DxfMText("汽蚀 (m)", pt_title, this._axisTitleSizeY); if (this._isRotateAxisTitleY) { textTitle.XAxis = new Vector3D(0, 1, 0); textTitle.ZAxis = new Vector3D(0, 0, 1); } if (AxisTitlePosiStyleY == eAxisTitlePosiStyle.Top) { textTitle.AttachmentPoint = AttachmentPoint.BottomCenter; } else { textTitle.AttachmentPoint = AttachmentPoint.TopCenter; } if (_axisTextFont != null) textTitle.Style = this._axisTextFont; textTitle.Color = this._axisTitleColorNPSH; _dxfFileModel.Entities.Add(textTitle); //画刻度线 (主) for (int i = _coordinateParas.StartLineNoNPSH; i <= _coordinateParas.EndLineNoNPSH; i++) { double space = i * gridHeight;//水平线的间距 Point2D majorTickStartPt = new Point2D(_diagramRightBottomPt.X, _diagramRightBottomPt.Y + space); Point2D majorTickEndPt = new Point2D(_diagramRightBottomPt.X + _axisMajorTickLength, _diagramRightBottomPt.Y + space); DxfLine dxfLine = new DxfLine(majorTickStartPt, majorTickEndPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } //画较短刻度线 if (_minorTickNumberY > 0) { for (int i = _coordinateParas.StartLineNoNPSH; i <= _coordinateParas.EndLineNoNPSH - 1; i++) { double space = i * gridHeight; for (int j = 1; j < _minorTickNumberY; j++) { double y = _diagramRightBottomPt.Y + space + j * gridHeight / this._minorTickNumberY; Point2D startPt = new Point2D(_diagramRightBottomPt.X, y); Point2D endPt = new Point2D(_diagramRightBottomPt.X + this._axisMinorTickLength, y); DxfLine dxfLine = new DxfLine(startPt, endPt); dxfLine.Color = this._gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } } } protected void DrawAxisY() { double spaceWidth = (_diagramLeftBottomPt.Y - _diagramLeftTopPt.Y) / (_coordinateParas.GridNumberY);//X轴上格子的宽度 //绘制网格线 if (_isDispGridLineY) { for (int i = 1; i < _coordinateParas.GridNumberY; i++) { double space = i * spaceWidth; Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt.X, _diagramLeftBottomPt.Y - space); Point2D endXgeziPt = new Point2D(_diagramRightTopPt.X, _diagramLeftBottomPt.Y - space); DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt); dxfLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(dxfLine); } } DrawAxisH(); DrawAxisE(); DrawAxisP(); DrawAxisNPSH(); } //初始化面板尺寸 protected virtual void InitialDiagramSize(double diagramLength, double diagramHeight) { _diagramLeftBottomPt = new Point2D(0, 0); _diagramRightBottomPt.X = _diagramLeftBottomPt.X + diagramLength; _diagramRightBottomPt.Y = _diagramLeftBottomPt.Y; _diagramLeftTopPt.X = _diagramLeftBottomPt.X; _diagramLeftTopPt.Y = _diagramLeftBottomPt.Y + diagramHeight; _diagramRightTopPt.X = _diagramRightBottomPt.X; _diagramRightTopPt.Y = _diagramLeftBottomPt.Y + diagramHeight; DxfLine lineBottom = new DxfLine(_diagramLeftBottomPt, _diagramRightBottomPt); lineBottom.LineWeight = 2; DxfLine lineLeft = new DxfLine(_diagramLeftBottomPt, _diagramLeftTopPt); lineLeft.LineWeight = 2; DxfLine lineTop = new DxfLine(_diagramLeftTopPt, _diagramRightTopPt); lineTop.LineWeight = 2; DxfLine lineRight = new DxfLine(_diagramRightBottomPt, _diagramRightTopPt); lineRight.LineWeight = 2; _dxfFileModel.Entities.Add(lineBottom); _dxfFileModel.Entities.Add(lineLeft); _dxfFileModel.Entities.Add(lineTop); _dxfFileModel.Entities.Add(lineRight); #region 绘制图框 //if (_isCreataePageBorder) //{ // double A4BorderWidth = 210; // double A4BorderHeight = 297; //Point2D _a4BorderXStartPt; //Point2D _a4BorderXEndPt; //Point2D _a4BorderYEndPt; //_a4BorderXStartPt = new Point2D(0, 0); //_a4BorderXEndPt.X = _a4BorderXStartPt.X + A4BorderWidth; //_a4BorderXEndPt.Y = _a4BorderXStartPt.Y; //_a4BorderYEndPt.X = _a4BorderXStartPt.X; //_a4BorderYEndPt.Y = _a4BorderXStartPt.Y + A4BorderHeight; // //DxfLine lineBottom = new DxfLine(_a4BorderXStartPt, _a4BorderXEndPt); // //DxfLine lineLeft = new DxfLine(_a4BorderXStartPt, _a4BorderYEndPt); // //DxfLine lineTop = new DxfLine(_a4BorderYEndPt, new Point2D(_a4BorderYEndPt.X + A4BorderWidth, _a4BorderYEndPt.Y)); // //DxfLine lineRight = new DxfLine(_a4BorderXEndPt, new Point2D(_a4BorderXEndPt.X, _a4BorderXEndPt.Y + A4BorderHeight)); // //_dxfFileModel.Entities.Add(lineBottom); // //_dxfFileModel.Entities.Add(lineLeft); // //_dxfFileModel.Entities.Add(lineTop); // //_dxfFileModel.Entities.Add(lineRight); //} #endregion } //X轴实际尺寸换算为像素尺寸 protected override double MapRealToPictQ(double Q) { return ((Q - _coordinateParas.CoordMinQ) * (_diagramRightBottomPt.X - _diagramLeftBottomPt.X) / (_coordinateParas.GridNumberX * _coordinateParas.CoordSpaceQ)) + _diagramLeftBottomPt.X; } //扬程曲线Y坐标实际尺寸换算为像素尺寸 protected override double MapRealToPictH(double H) { double diagramHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y);//汽蚀曲线图的高度 return _diagramLeftBottomPt.Y + (H - _coordinateParas.CoordMinH) * diagramHeight / (_coordinateParas.CoordSpaceH * _coordinateParas.GridNumberY); } //效率曲线Y坐标实际尺寸换算为像素尺寸 protected override double MapRealToPictE(double E) { double diagramHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y);//汽蚀曲线图的高度 return _diagramLeftBottomPt.Y + (E - _coordinateParas.CoordMinE) * diagramHeight / (_coordinateParas.CoordSpaceE * _coordinateParas.GridNumberY); } //功率曲线Y坐标实际尺寸换算为像素尺寸 protected override double MapRealToPictP(double P) { double diagramHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y);//汽蚀曲线图的高度 return _diagramLeftBottomPt.Y + (P - _coordinateParas.CoordMinP) * diagramHeight / (_coordinateParas.CoordSpaceP * _coordinateParas.GridNumberY); } //汽蚀曲线Y坐标实际尺寸换算为像素尺寸 protected override double MapRealToPictNPSH(double NPSH) { if (_coordinateParas.CoordSpaceNPSH < 0.01) return 0; double diagramHeight = (_diagramLeftTopPt.Y - _diagramLeftBottomPt.Y);//汽蚀曲线图的高度 return _diagramLeftBottomPt.Y + (NPSH - _coordinateParas.CoordMinNPSH) * diagramHeight / (_coordinateParas.CoordSpaceNPSH * _coordinateParas.GridNumberY); } } }