using System; using WW.Cad.Model.Entities; using WW.Math; namespace TProduct.PumpGraph.Dxf { //坐标分开的那种(参考双达,没有效率面板) public partial class LxpFeatChart_Split : LxpFeatChart { #region 流量扬程 protected Point2D _diagramLeftBottomPt_QH = new Point2D();//左下角 protected Point2D _diagramRightBottomPt_QH = new Point2D();//右下角 protected Point2D _diagramLeftTopPt_QH = new Point2D();//左上角 protected Point2D _diagramRightTopPt_QH = new Point2D();//右上角 #endregion #region 流量效率 protected Point2D _diagramLeftBottomPt_QE = new Point2D();//左下角 protected Point2D _diagramRightBottomPt_QE = new Point2D();//右下角 protected Point2D _diagramLeftTopPt_QE = new Point2D();//左上角 protected Point2D _diagramRightTopPt_QE = new Point2D();//右上角 #endregion #region 流量功率 protected Point2D _diagramLeftBottomPt_QP = new Point2D();//左下角 protected Point2D _diagramRightBottomPt_QP = new Point2D();//右下角 protected Point2D _diagramLeftTopPt_QP = new Point2D();//左上角 protected Point2D _diagramRightTopPt_QP = new Point2D();//右上角 #endregion #region 流量汽蚀 protected Point2D _diagramLeftBottomPt_QNPSH = new Point2D();//左下角 protected Point2D _diagramRightBottomPt_QNPSH = new Point2D();//右下角 protected Point2D _diagramLeftTopPt_QNPSH = new Point2D();//左上角 protected Point2D _diagramRightTopPt_QNPSH = new Point2D(); //右上角 #endregion protected double _diagram_Space = 20d;//面板之间的间距 protected double _diagram_Cell_Height_H = 0;//单元格高度 protected double _diagram_Cell_Height_E = 0;//单元格高度(可能没有值) protected double _diagram_Cell_Height_P = 0;//单元格高度 (可能没有值) protected double _diagram_Cell_Height_NPSH = 0;//单元格高度 (可能没有值) protected double _diagram_Cell_Width = 0;//单元格宽度 /// /// 初始化面板尺寸 /// /// 面板总宽 /// 面板总高 protected virtual void InitialDiagramSize(double diagramTotalLength, double diagramTotalHeight) { _diagramLeftBottomPt = new Point2D(0, 0); _diagramRightBottomPt.X = _diagramLeftBottomPt.X + diagramTotalLength; _diagramRightBottomPt.Y = _diagramLeftBottomPt.Y; _diagramLeftTopPt.X = _diagramLeftBottomPt.X; _diagramLeftTopPt.Y = _diagramLeftBottomPt.Y + diagramTotalHeight; _diagramRightTopPt.X = _diagramRightBottomPt.X; _diagramRightTopPt.Y = _diagramLeftTopPt.Y; int totalGridNumber_h = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH; int totalGridNumber_p = _coordinateParas.EndLineNoP - _coordinateParas.StartLineNoP; int totalGridNumber_npsh = _coordinateParas.EndLineNoNPSH - _coordinateParas.StartLineNoNPSH; _diagram_Cell_Height_H = (diagramTotalHeight - 2 * _diagram_Space) / (totalGridNumber_npsh + totalGridNumber_h + totalGridNumber_p); _diagram_Cell_Height_E = _diagram_Cell_Height_H; _diagram_Cell_Width = diagramTotalLength / _coordinateParas.GridNumberX; //最下面是功率 double diagramTotalHeight_QP = totalGridNumber_p * _diagram_Cell_Height_H; _diagramLeftBottomPt_QP = new Point2D(0, 0); _diagramRightBottomPt_QP.X = _diagramLeftBottomPt_QP.X + diagramTotalLength; _diagramRightBottomPt_QP.Y = _diagramLeftBottomPt_QP.Y; _diagramLeftTopPt_QP.X = _diagramLeftBottomPt_QP.X; _diagramLeftTopPt_QP.Y = _diagramLeftBottomPt_QP.Y + diagramTotalHeight_QP; _diagramRightTopPt_QP.X = _diagramRightBottomPt_QP.X; _diagramRightTopPt_QP.Y = _diagramLeftTopPt_QP.Y; //汽蚀 double diagramTotalHeight_QNPSH = totalGridNumber_npsh * _diagram_Cell_Height_E; _diagramLeftBottomPt_QNPSH.X = _diagramLeftTopPt_QP.X; _diagramLeftBottomPt_QNPSH.Y = _diagramLeftTopPt_QP.Y + _diagram_Space; _diagramRightBottomPt_QNPSH.X = _diagramLeftBottomPt_QNPSH.X + diagramTotalLength; _diagramRightBottomPt_QNPSH.Y = _diagramLeftBottomPt_QNPSH.Y; _diagramLeftTopPt_QNPSH.X = _diagramLeftBottomPt_QNPSH.X; _diagramLeftTopPt_QNPSH.Y = _diagramLeftBottomPt_QNPSH.Y + diagramTotalHeight_QNPSH; _diagramRightTopPt_QNPSH.X = _diagramRightBottomPt_QNPSH.X; _diagramRightTopPt_QNPSH.Y = _diagramLeftTopPt_QNPSH.Y; //扬程 double diagramTotalHeight_QH = totalGridNumber_h * _diagram_Cell_Height_H; _diagramLeftBottomPt_QH.X = _diagramLeftTopPt_QNPSH.X; _diagramLeftBottomPt_QH.Y = _diagramLeftTopPt_QNPSH.Y + _diagram_Space; _diagramRightBottomPt_QH.X = _diagramLeftBottomPt_QH.X + diagramTotalLength; _diagramRightBottomPt_QH.Y = _diagramLeftBottomPt_QH.Y; _diagramLeftTopPt_QH.X = _diagramLeftBottomPt_QH.X; _diagramLeftTopPt_QH.Y = _diagramLeftBottomPt_QH.Y + diagramTotalHeight_QH; _diagramRightTopPt_QH.X = _diagramRightBottomPt_QH.X; _diagramRightTopPt_QH.Y = _diagramLeftTopPt_QH.Y; } /// /// 绘制面板(QH) /// protected void DrawDiagramPanelQH() { //流量 刻度线 for (int i = 0; i <= _coordinateParas.GridNumberX; i++) { //流量 刻度线 var vertiBottomH = new Point2D(_diagramLeftBottomPt_QH.X + i * _diagram_Cell_Width, _diagramLeftBottomPt_QH.Y); var vertiTopH = new Point2D(vertiBottomH.X, _diagramLeftTopPt_QH.Y); var vertiLine = new DxfLine(vertiBottomH, vertiTopH); vertiLine.LineWeight = _gridLineWidth; vertiLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(vertiLine); //流量 子刻度线 if (_isDispGridSubLineX && _coordinateParas.GridNumberX != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(System.Drawing.Color.White); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Width / _subGridLineNumber; var horizLeftH_sub = new Point2D(vertiTopH.X + space, vertiBottomH.Y); var horizRightH_sub = new Point2D(vertiTopH.X + space, vertiTopH.Y); var horizLine_sub = new DxfLine(horizLeftH_sub, horizRightH_sub); horizLine_sub.LineWeight = 1; horizLine_sub.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(horizLine_sub); } } } //扬程刻度 var gridNumberH = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH; for (int i = 0; i <= gridNumberH; i++) { //网格线 var horizLeftH = new Point2D(_diagramLeftBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + i * _diagram_Cell_Height_H); var horizRightH = new Point2D(_diagramRightBottomPt_QH.X, horizLeftH.Y); var horizLine = new DxfLine(horizLeftH, horizRightH); horizLine.LineWeight = _gridLineWidth; horizLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(horizLine); #region 子刻度线 if (this._isDispGridSubLineY && gridNumberH != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(255, 20, 147); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Height_H / _subGridLineNumber; var horizLeftH_sub = new Point2D(_diagramLeftBottomPt_QH.X, horizLeftH.Y + space); var horizRightH_sub = new Point2D(_diagramRightBottomPt_QH.X, horizLeftH.Y + space); var horizLine_sub = new DxfLine(horizLeftH_sub, horizRightH_sub); horizLine_sub.LineWeight = 1; horizLine_sub.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(horizLine_sub); } } #endregion //刻度线 if (this._isDrawMajorTickY) { var axis_label_text = new Point2D(horizLeftH.X - (i % 2 == 0 ? _axisMajorTickLength : _axisMinorTickLength), horizLeftH.Y); var keDuLine = new DxfLine(axis_label_text, horizLeftH); keDuLine.LineWeight = _gridLineWidth; keDuLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(keDuLine); } //刻度 double keduValue = _coordinateParas.CoordMinH + (i + _coordinateParas.StartLineNoH) * _coordinateParas.CoordSpaceH; if (keduValue < 0) continue; string kedu_str_left = ""; if (_unitH == Eventech.Model.UnitH.M) { kedu_str_left = keduValue.ToString(); } else if (_unitH == Eventech.Model.UnitH.MPa) { kedu_str_left = (keduValue / 100).ToString(); } else { kedu_str_left = Eventech.Common.UnitHHelper.fromM2(_unitH, keduValue).ToString("N2"); } var label_posi_left = new Point3D(horizLeftH.X - _axisLabelSpaceToDiagramY_left, horizLeftH.Y, 0d); DxfMText axisLabel_h_left = new DxfMText(kedu_str_left, label_posi_left, _axisLabelSizeY);//\P表示回车 axisLabel_h_left.AttachmentPoint = AttachmentPoint.MiddleRight; if (_axisTextFont != null) axisLabel_h_left.Style = this._axisTextFont; axisLabel_h_left.Color = this._axisLabelColorH; _dxfFileModel.Entities.Add(axisLabel_h_left); } //Title Point3D pt_title_main = new Point3D(); pt_title_main.X = _diagramLeftTopPt_QH.X - _axisTitleSpaceToDiagramY_left; pt_title_main.Y = _diagramLeftTopPt_QH.Y - _axisTitleSizeY - _axisTitleSpaceToLabel_Vertial_Y; pt_title_main.Z = 0d; DxfMText text_axisTitle = new DxfMText(string.Format(@"{0}\P({1})", _axisTtileContentH, Eventech.Common.UnitHHelper.GetEnUnitName(_unitH)), pt_title_main, _axisTitleSizeY);//\P表示回车 if (this._axisTextFont != null) text_axisTitle.Style = this._axisTextFont; text_axisTitle.AttachmentPoint = _axisTitleDockV_Left; text_axisTitle.Color = this._axisTitleColorH; _dxfFileModel.Entities.Add(text_axisTitle); #region 流量第二刻度 if (this.SecondAxisH != null) {//产生第二刻度坐标:沃图要求 var unit_second_h = (Eventech.Model.UnitH)this.SecondAxisH.Unit; for (var i = 0; i < this.SecondAxisH.Labels.Count; i++) { var val_h = this.SecondAxisH.Labels[i]; var vall_m3h = Eventech.Common.UnitHHelper.toM(unit_second_h, val_h); if (vall_m3h < _coordinateParas.DispMinH() || vall_m3h > _coordinateParas.DispMaxH()) continue; var vall_map = this.MapRealToPictH(vall_m3h); var keDuLeftH1 = new Point2D(_diagramRightBottomPt_QH.X, vall_map); var keDuLeftH2 = new Point2D(_diagramRightBottomPt_QH.X + _axisMajorTickLength, vall_map); var keDuLine = new DxfLine(keDuLeftH1, keDuLeftH2); keDuLine.LineWeight = _gridLineWidth; keDuLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(keDuLine); string kedu_str_right = val_h.ToString(); var label_posi_right = new Point3D(_diagramRightBottomPt_QH.X + _axisLabelSpaceToDiagramY_right, vall_map, 0d); DxfMText axisLabel_h_right = new DxfMText(kedu_str_right, label_posi_right, _axisLabelSizeY);//\P表示回车 axisLabel_h_right.AttachmentPoint = AttachmentPoint.MiddleLeft; if (_axisTextFont != null) axisLabel_h_right.Style = this._axisTextFont; axisLabel_h_right.Color = this._axisLabelColorH; _dxfFileModel.Entities.Add(axisLabel_h_right); } Point3D pt_title_inch = new Point3D(); pt_title_inch.X = _diagramRightBottomPt_QH.X + _axisLabelSpaceToDiagramY_right; pt_title_inch.Y = _diagramRightTopPt_QH.Y + _axisLabelSizeY * 2.0; pt_title_inch.Z = 0d; DxfMText text_axisTitle_inch = new DxfMText(Eventech.Common.UnitHHelper.GetEnUnitName((Eventech.Model.UnitH)this.SecondAxisH.Unit), pt_title_inch, _axisTitleSizeY); if (this._axisTextFont != null) text_axisTitle_inch.Style = this._axisTextFont; text_axisTitle_inch.AttachmentPoint = AttachmentPoint.MiddleLeft; text_axisTitle_inch.Color = this._axisTitleColorH; _dxfFileModel.Entities.Add(text_axisTitle_inch); } if (this.SecondAxisQ != null) { Eventech.Model.UnitQ second_flow_unit = (Eventech.Model.UnitQ)this.SecondAxisQ.Unit; var num = this.SecondAxisQ.Labels.Count; // 流量刻度 for (int i = 0; i < num; i++) { // var keduValue = this.SecondAxisQ.Labels[i]; var keduValue_posi = this.MapRealToPictQ(Eventech.Common.UnitQHelper.toM3H(second_flow_unit, keduValue)); string kedu_str = keduValue.ToString(); if (i == num - 1) { kedu_str = string.Format("{0} ({1})", kedu_str, Eventech.Common.UnitQHelper.GetEnUnitName(second_flow_unit)); } var axisMajorLinePt1 = new Point2D(_diagramLeftTopPt_QH.X + keduValue_posi, _diagramLeftTopPt_QH.Y); var axisMajorLinePt2 = new Point2D(_diagramLeftTopPt_QH.X + keduValue_posi, _diagramLeftTopPt_QH.Y + this._axisMajorTickLength); var axisMajorLine = new DxfLine(axisMajorLinePt1, axisMajorLinePt2); axisMajorLine.LineWeight = _gridLineWidth; axisMajorLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(axisMajorLine); var labelPtQ = new Point3D( _diagramLeftTopPt_QH.X + keduValue_posi, _diagramLeftTopPt_QH.Y + _axisLabelSpaceToDiagramQ, 0d); DxfMText axisLabel_q = new DxfMText(kedu_str, labelPtQ, _axisLabelSizeX);//\P表示回车 axisLabel_q.AttachmentPoint = AttachmentPoint.BottomCenter; //axisLabel_q.ReferenceRectangleHeight = _axisLabelSizeX; if (_axisTextFont != null) axisLabel_q.Style = this._axisTextFont; //axisLabel_q.Height = _axisLabelSizeX; axisLabel_q.Color = this._axisLabelColorQ; _dxfFileModel.Entities.Add(axisLabel_q); } //string title_Q = string.Format("Q({0})", Eventech.Common.UnitQHelper.GetEnUnitName(_unitQ)); //Point3D pt_Q = new Point3D(); //pt_Q.X = _diagramRightBottomPt.X - _axisTitleSizeX / 2 - _axisTitleSpaceToDiagramQ_X; //pt_Q.Y = _diagramRightBottomPt.Y - _axisTitleSpaceToDiagramQ_Y; //pt_Q.Z = 0; //DxfText textTitle_Q = new DxfText(title_Q, pt_Q, _axisTitleSizeX); //textTitle_Q.Thickness = 0.5d; //textTitle_Q.Color = _axisTitleColorQ; //if (_axisTextFont != null) // textTitle_Q.Style = _axisTextFont; //_dxfFileModel.Entities.Add(textTitle_Q); } #endregion } protected WW.Cad.Model.Entities.AttachmentPoint _axisTitleDockV_Left = AttachmentPoint.MiddleRight; protected bool _isCreateInchAxislabelP = false; public bool IsCreateInchAxislabelP { get { return _isCreateInchAxislabelP; } set { _isCreateInchAxislabelP = value; } } /// /// 绘制面板(QP) /// protected virtual void DrawDiagramPanelQP() { //y轴格子数 var gridNumber_y = _coordinateParas.EndLineNoP - _coordinateParas.StartLineNoP; //竖线 for (int i = 0; i <= _coordinateParas.GridNumberX; i++) { //格子线 var gridLinePosiP = new Point2D(_diagramLeftBottomPt_QP.X + i * _diagram_Cell_Width, _diagramLeftBottomPt_QP.Y); var ptGridLine = new Point2D(gridLinePosiP.X, _diagramLeftTopPt_QP.Y); var gridLine = new DxfLine(gridLinePosiP, ptGridLine); gridLine.LineWeight = _gridLineWidth; gridLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(gridLine); #region 子格子线 if (_isDispGridSubLineX && _coordinateParas.GridNumberX != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(TProduct.PumpGraph.Dxf.AutoCadHelper.WhiteColorIndex); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Width / _subGridLineNumber; var subGridPosiLeft = new Point2D(ptGridLine.X + space, gridLinePosiP.Y); var subGridPosiRight = new Point2D(ptGridLine.X + space, ptGridLine.Y); var subGridLine = new DxfLine(subGridPosiLeft, subGridPosiRight); subGridLine.LineWeight = 1; subGridLine.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(subGridLine); } } #endregion //刻度线 if (_isDrawMajorTickY) { var majorTickPosi = new Point2D(gridLinePosiP.X, gridLinePosiP.Y - (i % 2 == 0 ? _axisMajorTickLength : _axisMinorTickLength)); var majorTickLine = new DxfLine(gridLinePosiP, majorTickPosi); majorTickLine.LineWeight = _gridLineWidth; majorTickLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(majorTickLine); } //流量刻度 double keduValue = _coordinateParas.CoordMinQ + i * _coordinateParas.CoordSpaceQ; string kedu_str = Math.Round(Eventech.Common.UnitQHelper.fromM3H(_unitQ, keduValue), 2).ToString(); var labelPtQ = new Point3D(gridLinePosiP.X, gridLinePosiP.Y - _axisLabelSpaceToDiagramQ, 0d); DxfMText axisLabel_q = new DxfMText(kedu_str, labelPtQ, _axisLabelSizeX);//\P表示回车 axisLabel_q.AttachmentPoint = AttachmentPoint.TopCenter; //axisLabel_q.ReferenceRectangleHeight = _axisLabelSizeX; if (this._axisTextFont != null) axisLabel_q.Style = this._axisTextFont; //axisLabel_q.Height = _axisLabelSizeX; axisLabel_q.Color = this._axisLabelColorQ; _dxfFileModel.Entities.Add(axisLabel_q); } string title_Q = string.Format("{0}({1})", _axisTtileContentQ, Eventech.Common.UnitQHelper.GetEnUnitName(_unitQ)); Point3D pt_Q = new Point3D(); pt_Q.X = _diagramRightBottomPt.X - _axisTitleSizeX / 2 - _axisTitleSpaceToDiagramQ_X - 20; pt_Q.Y = _diagramRightBottomPt.Y - _axisTitleSpaceToDiagramQ_Y - 5; pt_Q.Z = 0; DxfText textTitle_Q = new DxfText(title_Q, pt_Q, _axisTitleSizeX); //textTitle_Q.Thickness = 0.5d; textTitle_Q.Color = _axisTitleColorQ; if (this._axisTextFont != null) textTitle_Q.Style = this._axisTextFont; _dxfFileModel.Entities.Add(textTitle_Q); //横线 string unit_name = "kW"; for (int i = 0; i <= gridNumber_y; i++) { //格子线 var horizLeftP = new Point2D(_diagramLeftBottomPt_QP.X, _diagramLeftBottomPt_QP.Y + i * _diagram_Cell_Height_E); var horizRightP = new Point2D(_diagramRightBottomPt_QP.X, horizLeftP.Y); var horizLine = new DxfLine(horizLeftP, horizRightP); horizLine.LineWeight = _gridLineWidth; horizLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(horizLine); #region 子格子线 if (_isDispGridSubLineY && gridNumber_y != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(255, 20, 147); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Height_E / _subGridLineNumber; var horizLeftH_sub = new Point2D(_diagramLeftBottomPt_QP.X, horizLeftP.Y + space); var horizRightH_sub = new Point2D(_diagramRightBottomPt_QP.X, horizLeftP.Y + space); var horizLine_sub = new DxfLine(horizLeftH_sub, horizRightH_sub); horizLine_sub.LineWeight = 1; horizLine_sub.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(horizLine_sub); } } #endregion //刻度线 var keDuLeftP = new Point2D(horizLeftP.X - (i % 2 == 0 ? _axisMajorTickLength : _axisMinorTickLength), horizLeftP.Y); var keDuLine = new DxfLine(keDuLeftP, horizLeftP); keDuLine.LineWeight = _gridLineWidth; keDuLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(keDuLine); //刻度 double keduValueP = _coordinateParas.CoordMinP + (i + _coordinateParas.StartLineNoP) * _coordinateParas.CoordSpaceP; if (keduValueP < 0) continue; if (keduValueP < 0.001) keduValueP = 0; if (_unitP == Eventech.Model.UnitP.KW) { keduValueP = Math.Round(keduValueP, 3); } else { if (_unitP == Eventech.Model.UnitP.HP) unit_name = "hp"; else unit_name = ""; keduValueP = Math.Round(Eventech.Common.UnitPHelper.fromKW(_unitP, keduValueP), 1); } var labelPtP = new Point3D(horizLeftP.X - _axisLabelSpaceToDiagramY_left, horizLeftP.Y, 0d); DxfMText axisLabel_p_left = new DxfMText(keduValueP.ToString(), labelPtP, _axisLabelSizeY);//\P表示回车 axisLabel_p_left.AttachmentPoint = AttachmentPoint.MiddleRight; if (_axisTextFont != null) axisLabel_p_left.Style = this._axisTextFont; axisLabel_p_left.Color = this._axisLabelColorP; _dxfFileModel.Entities.Add(axisLabel_p_left); //产生英制坐标:沃图要求 if (_isCreateInchAxislabelP && _unitP == Eventech.Model.UnitP.KW) { string kedu_str_right = Eventech.Common.UnitPHelper.fromKW(Eventech.Model.UnitP.HP, keduValueP).ToString("N2"); var label_posi_right = new Point3D(_diagramRightBottomPt_QP.X + _axisLabelSpaceToDiagramY_right, keDuLeftP.Y, 0d); DxfMText axisLabel_p_right = new DxfMText(kedu_str_right, label_posi_right, _axisLabelSizeY); axisLabel_p_right.AttachmentPoint = AttachmentPoint.MiddleLeft; if (_axisTextFont != null) axisLabel_p_right.Style = this._axisTextFont; axisLabel_p_right.Color = this._axisLabelColorH; _dxfFileModel.Entities.Add(axisLabel_p_right); } } Point3D pt_title = new Point3D(); pt_title.X = _diagramLeftTopPt_QP.X - _axisTitleSpaceToDiagramY_left; pt_title.Y = _diagramLeftTopPt_QP.Y - _axisTitleSizeY - _axisTitleSpaceToLabel_Vertial_Y; pt_title.Z = 0d; DxfMText textTitle_P = new DxfMText(string.Format(@"{0}\P({1})", _axisTtileContentP, unit_name), pt_title, _axisTitleSizeY);//\P表示回车 textTitle_P.AttachmentPoint = _axisTitleDockV_Left; if (_axisTextFont != null) textTitle_P.Style = _axisTextFont; textTitle_P.Color = _axisTitleColorP; _dxfFileModel.Entities.Add(textTitle_P); if (_isCreateInchAxislabelP && _unitP == Eventech.Model.UnitP.KW) {//产生英制坐标:沃图要求 Point3D pt_title_inch = new Point3D(); pt_title_inch.X = _diagramRightTopPt_QP.X + _axisLabelSpaceToDiagramY_right; pt_title_inch.Y = _diagramRightTopPt_QP.Y + _axisLabelSizeY * 2.0; pt_title_inch.Z = 0d; DxfMText text_axisTitle_inch = new DxfMText("hp", pt_title_inch, _axisTitleSizeY); if (this._axisTextFont != null) text_axisTitle_inch.Style = this._axisTextFont; text_axisTitle_inch.AttachmentPoint = AttachmentPoint.MiddleLeft; text_axisTitle_inch.Color = this._axisTitleColorH; _dxfFileModel.Entities.Add(text_axisTitle_inch); } } //绘制面板(Q_NPSH) protected virtual void DrawDiagramPanelQNPSH() { if (!_isNPSHCurve) return; //y轴格子数 var gridNumber_y = _coordinateParas.EndLineNoNPSH - _coordinateParas.StartLineNoNPSH; //竖线 for (int i = 0; i <= _coordinateParas.GridNumberX; i++) { //格子线 var gridLinePosiNPSH = new Point2D(_diagramLeftBottomPt_QNPSH.X + i * _diagram_Cell_Width, _diagramLeftBottomPt_QNPSH.Y); var vertiTopNPSH = new Point2D(gridLinePosiNPSH.X, _diagramLeftTopPt_QNPSH.Y); var vertiLine = new DxfLine(gridLinePosiNPSH, vertiTopNPSH); vertiLine.LineWeight = _gridLineWidth; vertiLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(vertiLine); #region 子格子线 if (_isDispGridSubLineX && _coordinateParas.GridNumberX != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(255, 20, 147); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Width / _subGridLineNumber; var horizLeftH_sub = new Point2D(vertiTopNPSH.X + space, gridLinePosiNPSH.Y); var horizRightH_sub = new Point2D(vertiTopNPSH.X + space, vertiTopNPSH.Y); var horizLine_sub = new DxfLine(horizLeftH_sub, horizRightH_sub); horizLine_sub.LineWeight = 1; horizLine_sub.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(horizLine_sub); } } #endregion } //横线 for (int i = 0; i <= gridNumber_y; i++) { //格子线 var horizLeftNPSH = new Point2D(_diagramLeftBottomPt_QNPSH.X, _diagramLeftBottomPt_QNPSH.Y + i * _diagram_Cell_Height_E); var horizRightNPSH = new Point2D(_diagramRightBottomPt_QNPSH.X, horizLeftNPSH.Y); var horizLine = new DxfLine(horizLeftNPSH, horizRightNPSH); horizLine.LineWeight = _gridLineWidth; horizLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(horizLine); #region 子格子线 if (_isDispGridSubLineY && gridNumber_y != i) { if (_gridSubLineColor == null) { _gridSubLineColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(255, 20, 147); } for (int m = 1; m < _subGridLineNumber; m++) { var space = m * _diagram_Cell_Height_E / _subGridLineNumber; var horizLeftH_sub = new Point2D(_diagramLeftBottomPt_QNPSH.X, horizLeftNPSH.Y + space); var horizRightH_sub = new Point2D(_diagramRightBottomPt_QNPSH.X, horizLeftNPSH.Y + space); var horizLine_sub = new DxfLine(horizLeftH_sub, horizRightH_sub); horizLine_sub.LineWeight = 1; horizLine_sub.Color = _gridSubLineColor; _dxfFileModel.Entities.Add(horizLine_sub); } } #endregion //刻度线 var keDuLeftNPSH = new Point2D(horizLeftNPSH.X - (i % 2 == 0 ? _axisMajorTickLength : _axisMinorTickLength), horizLeftNPSH.Y); var keDuLine = new DxfLine(keDuLeftNPSH, horizLeftNPSH); keDuLine.LineWeight = _gridLineWidth; keDuLine.Color = _gridLineColor; _dxfFileModel.Entities.Add(keDuLine); double keduValue = _coordinateParas.CoordMinNPSH + (i + _coordinateParas.StartLineNoNPSH) * _coordinateParas.CoordSpaceNPSH; if (keduValue < 0) continue; var labelPtNPSH = new Point3D(horizLeftNPSH.X - _axisLabelSpaceToDiagramY_left, horizLeftNPSH.Y, 0d); DxfMText axisLabel_npsh = new DxfMText(keduValue.ToString(), labelPtNPSH, _axisLabelSizeY);//\P表示回车 axisLabel_npsh.AttachmentPoint = AttachmentPoint.MiddleRight; //axisLabel_q.ReferenceRectangleHeight = _axisLabelSizeX; //axisLabel_q.Height = _axisLabelSizeX; if (_axisTextFont != null) axisLabel_npsh.Style = this._axisTextFont; axisLabel_npsh.Color = this._axisLabelColorNPSH; _dxfFileModel.Entities.Add(axisLabel_npsh); } Point3D pt_title = new Point3D(); pt_title.X = _diagramLeftTopPt_QNPSH.X - _axisTitleSpaceToDiagramY_left; pt_title.Y = _diagramLeftTopPt_QNPSH.Y - _axisTitleSizeY - _axisTitleSpaceToLabel_Vertial_Y; pt_title.Z = 0d; DxfMText textTitle = new DxfMText(string.Format(@"{0}\P(m)", _axisTtileContentNPSH), pt_title, _axisTitleSizeY);//\P表示回车 textTitle.AttachmentPoint = _axisTitleDockV_Left; if (_axisTextFont != null) textTitle.Style = this._axisTextFont; textTitle.Color = this._axisTitleColorNPSH; _dxfFileModel.Entities.Add(textTitle); } //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 startH = _coordinateParas.CoordMinH + _coordinateParas.StartLineNoH * _coordinateParas.CoordSpaceH; return _diagramLeftBottomPt_QH.Y + (H - startH) * _diagram_Cell_Height_H / _coordinateParas.CoordSpaceH; } //效率曲线Y坐标实际尺寸换算为像素尺寸(复制,需要修改) protected override double MapRealToPictE(double E) { double startE = _coordinateParas.CoordMinE + _coordinateParas.StartLineNoE * _coordinateParas.CoordSpaceE; return _diagramLeftBottomPt_QE.Y + (E - startE) * _diagram_Cell_Height_H / _coordinateParas.CoordSpaceE; } //功率曲线Y坐标实际尺寸换算为像素尺寸(复制,需要修改) protected override double MapRealToPictP(double P) { double startP = _coordinateParas.CoordMinP + _coordinateParas.StartLineNoP * _coordinateParas.CoordSpaceP; return _diagramLeftBottomPt_QP.Y + (P - startP) * _diagram_Cell_Height_E / _coordinateParas.CoordSpaceP; } //汽蚀曲线Y坐标实际尺寸换算为像素尺寸(复制,需要修改) protected override double MapRealToPictNPSH(double NPSH) { if (_coordinateParas.CoordSpaceNPSH < 0.01) return 0; double startNPSH = _coordinateParas.CoordMinNPSH + _coordinateParas.StartLineNoNPSH * _coordinateParas.CoordSpaceNPSH; return _diagramLeftBottomPt_QNPSH.Y + (NPSH - startNPSH) * _diagram_Cell_Height_E / _coordinateParas.CoordSpaceNPSH; } } }