using System.Linq;
|
using WW.Cad.Model.Entities;
|
using WW.Math;
|
|
namespace TProduct.PumpGraph.Dxf
|
{
|
//坐标在一起的那种
|
public partial class LxpFeatChart_Whole : LxpFeatChart
|
{
|
//绘制刻度显示值
|
protected virtual 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_content = string.Format("{0}({1})", _axisTtileContentQ, Eventech.Common.UnitQHelper.GetEnUnitName(_unitQ));
|
|
Point3D title_posi_pt = new Point3D();
|
title_posi_pt.X = _diagramLeftBottomPt.X + (_diagramRightBottomPt.X - _diagramLeftBottomPt.X) / 2 - _axisTitleSizeX * 2;
|
title_posi_pt.Y = _diagramLeftBottomPt.Y - _axisTitleSpaceToDiagramQ_Y;
|
title_posi_pt.Z = 0;
|
DxfMText textTitleQ = new DxfMText(title_content, title_posi_pt, _axisTitleSizeX);
|
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;
|
if (this._isDrawMajorTickX)
|
{
|
endPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y - _axisMajorTickLength);
|
}
|
else
|
{
|
endPt = new Point2D(_diagramLeftBottomPt.X + space, _diagramLeftBottomPt.Y);
|
}
|
DxfLine dxfLine = new DxfLine(startPt, endPt);
|
dxfLine.Color = _gridLineColor;
|
|
_dxfFileModel.Entities.Add(dxfLine);
|
}
|
|
if (_minorTickNumberX > 0)
|
{
|
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 virtual 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(@"{0}\P({1})", _axisTtileContentH, Eventech.Common.UnitHHelper.GetEnUnitName(_unitH)), pt_title, _axisTitleSizeY);//\P表示回车
|
else
|
textTitle = new DxfMText(string.Format("{0} ({1})", _axisTtileContentH, 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);
|
|
|
//画刻度线 (主)
|
if (_isDrawMajorTickY)
|
{
|
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 double _minAxisLabelE = 0;//效率最小刻度
|
protected virtual void DrawAxisE()
|
{
|
if (!this._isDispCurveQE)
|
return;
|
|
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;
|
if (kedu < _minAxisLabelE)
|
continue;
|
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(string.Format(@" {0}\P(%)", _axisTtileContentE), pt_title, this._axisTitleSizeY);
|
else
|
textTitle = new DxfMText(string.Format("{0} (%)", _axisTtileContentE), 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);
|
|
|
|
|
//画刻度线 (主)
|
if (_isDrawMajorTickY)
|
{
|
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 virtual 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;
|
|
//刻度文字
|
string unit_name = "kW";
|
for (int i = _coordinateParas.StartLineNoP; i <= _coordinateParas.EndLineNoP; i++)
|
{
|
if (i >= _coordinateParas.StartLineNoH)
|
continue;//保证不要重叠,功率少几个刻度没事
|
|
double space = i * gridHeight;
|
double kedu_d = _coordinateParas.CoordMinP + i * coordSpace;//刻度值显示
|
if (kedu_d < 0.001)
|
kedu_d = 0;
|
|
string kedu_str = "";
|
|
if (_unitP == Eventech.Model.UnitP.KW)
|
{
|
kedu_str = kedu_d.ToString();
|
}
|
else
|
{
|
if (_unitP == Eventech.Model.UnitP.HP)
|
unit_name = "hp";
|
else
|
unit_name = "";
|
kedu_str = Eventech.Common.UnitPHelper.fromKW(_unitP, kedu_d).ToString("N2");
|
}
|
|
|
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(string.Format(@"{0}\P({1})", _axisTtileContentP, unit_name), pt_title, this._axisTitleSizeY);
|
else
|
textTitle = new DxfMText(string.Format("{0} ({1})", _axisTtileContentP, unit_name), 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);
|
|
|
|
//画刻度线 (主)
|
if (_isDrawMajorTickY)
|
{
|
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 virtual void DrawAxisNPSH()
|
{
|
if (!_isNPSHCurve)
|
return;
|
if (_allCurveNPSH == null || _allCurveNPSH.Count() == 0)
|
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(string.Format(@" {0}\P(m)", _axisTtileContentNPSH), pt_title, this._axisTitleSizeY);
|
else
|
textTitle = new DxfMText(string.Format("{0} (m)", _axisTtileContentNPSH), 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);
|
|
|
//画刻度线 (主)
|
if (_isDrawMajorTickY)
|
{
|
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 virtual 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 = _diagramBoundaryLineWidth;
|
_dxfFileModel.Entities.Add(lineBottom);
|
|
DxfLine lineLeft = new DxfLine(_diagramLeftBottomPt, _diagramLeftTopPt);
|
lineLeft.LineWeight = _diagramBoundaryLineWidth;
|
_dxfFileModel.Entities.Add(lineLeft);
|
|
DxfLine lineTop = new DxfLine(_diagramLeftTopPt, _diagramRightTopPt);
|
lineTop.LineWeight = _diagramBoundaryLineWidth;
|
_dxfFileModel.Entities.Add(lineTop);
|
|
DxfLine lineRight = new DxfLine(_diagramRightBottomPt, _diagramRightTopPt);
|
lineRight.LineWeight = _diagramBoundaryLineWidth;
|
_dxfFileModel.Entities.Add(lineRight);
|
}
|
|
|
|
|
//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);
|
}
|
|
|
}
|
}
|