using System.Collections.Generic; using System.Linq; using WW.Math; namespace TProduct.PumpGraph.Dxf { public partial class LxpFeatChart : FeatChart { protected string _qhCurveLabelContent = "扬程(m)"; protected string _qeCurveLabelContent = "效率(%)"; protected string _qpCurveLabelContent = "功率(kW)"; protected string _npshCurveLabelContent = "汽蚀(m)"; public static TProduct.PumpGraph.Dxf.LxpFeatChart Build(int Template) { if (Template == 1) return new LxpFeatChartV1(); else if (Template == 3) return new LxpFeatChartV3(); else return new LxpFeatChartV3(); } //注意即使改了单位,曲线里面的数据没有变,只变化了图表的坐标显示 protected Eventech.Model.UnitP _unitP = Eventech.Model.UnitP.KW; public Eventech.Model.UnitP UnitP { get { return _unitP; } set { _unitP = value; } } protected Eventech.Model.UnitH _unitNPSH = Eventech.Model.UnitH.M; public Eventech.Model.UnitH UnitNPSH { get { return _unitNPSH; } set { _unitNPSH = value; } } #region 坐标 protected Eventech.Model.LxpCoordinateParas _coordinateParas = null; public void SetCoordinate(Eventech.Model.LxpCoordinateParas coordinateParas) { this._coordinateParas = coordinateParas; } #endregion #region 汽蚀曲线 //是否有汽蚀曲线 protected bool _isNPSHCurve = true; public bool IsNPSHCurve { get { return _isNPSHCurve; } set { _isNPSHCurve = value; } } //汽蚀曲线如果超过流量扬程线,就切除掉 protected bool _isTrimCurveNpshOverQH = false; public bool IsTrimCurveNpshOverQH { get { return _isTrimCurveNpshOverQH; } set { _isTrimCurveNpshOverQH = value; } } //汽蚀曲线延长到区域点(最小流量点开始) protected bool _isCurveNpshStartWithRegionAllow = false; public bool IsCurveNpshStartWithRegionAllow { get { return _isCurveNpshStartWithRegionAllow; } set { _isCurveNpshStartWithRegionAllow = value; } } protected List _allCurveNPSH = null; public List AllCurveNPSH { get { return _allCurveNPSH; } set { _allCurveNPSH = value; } } #endregion #region 性能曲线 //超出坐标是否截取 protected bool _isTrimCurveOverCoord = true; public bool IsTrimCurveOverCoord { get { return _isTrimCurveOverCoord; } set { _isTrimCurveOverCoord = value; } } public List _curveInfoQH = null; public List _curveInfoQE = null; public List _curveInfoQP = null; public List _pointInfoQH = null; public List _pointInfoQE = null; public List _pointInfoQP = null; public List _points_TestNPSH = null; public List _points_CurveNPSH = null; protected TProduct.Model.ProductMainExPump _currentPump = null; public virtual void SetFeatPointRecords( TProduct.Model.ProductMainExPump pump, List groupPoints) { if (groupPoints == null || groupPoints.Count < 4) { return; } this._currentPump = pump; _pointInfoQH = new List(); _pointInfoQE = new List(); _pointInfoQP = new List(); _curveInfoQH = new List(); _curveInfoQE = new List(); _curveInfoQP = new List(); foreach (var pt in groupPoints) { _pointInfoQH.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtH)); if (pt.CorrectPtP.HasValue) _pointInfoQP.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtP.Value)); if (pt.CorrectPtE.HasValue) _pointInfoQE.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtE.Value)); } if (_pointInfoQH.Count > 4) this._curveInfoQH = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQH, pump.CurveFitTypeQH, 12); if (_pointInfoQE.Count > 4) this._curveInfoQE = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQE, pump.CurveFitTypeQE, 12); if (_pointInfoQP.Count > 4) this._curveInfoQP = Eventech.Common.FitCurveHelper.GetFitPoints(_pointInfoQP, pump.CurveFitTypeQP, 12); } #endregion protected bool _isRotateAxisTitleY = false;//是否对坐标标题文字旋转90度 protected bool _isTwoLineAxisTileY = true;//坐标名字和单位放在两行 protected double _axisTitleSizeX = 10;//刻度文字尺寸 protected double _axisTitleSizeY = 10;//刻度文字尺寸 protected double _axisLabelSizeX = 8;//刻度文字尺寸 protected double _axisLabelSizeY = 8;//刻度文字尺寸 protected float _axisMajorTickLength = 8;//长刻度线的长度 protected float _axisMinorTickLength = 4;//短刻度线的长度 protected bool _isDrawMajorTickY = true;//长刻度线是否绘制 protected bool _isDrawMajorTickX = true; protected int _minorTickNumberX = 5; protected int _minorTickNumberY = 5; protected double _axisTitleSpaceToDiagramQ_X = 0;//流量坐标标题距离图标的距离 protected double _axisTitleSpaceToDiagramQ_Y = 35;//流量坐标标题距离图标的距离 protected double _axisLabelSpaceToDiagramQ = 12;//流量坐标刻度距离图标的距离 protected float _axisTitleSpaceToLabel_Vertial_Y = 1;//纵坐标Tile在Y方向与文字的间隔 protected float _axisLabelSpaceToDiagramY_left = 15;//刻度文字离Y轴的距离(只对Y) protected float _axisTitleSpaceToDiagramY_left = 100;// protected float _axisLabelSpaceToDiagramY_right = 15;//刻度文字离Y轴的距离(只对Y) protected float _axisTitleSpaceToDiagramY_right = 45;// protected Point2D _diagramLeftBottomPt = new Point2D(); protected Point2D _diagramRightBottomPt = new Point2D(); protected Point2D _diagramLeftTopPt = new Point2D(); protected Point2D _diagramRightTopPt = new Point2D(); protected short _diagramBoundaryLineWidth = 2; //是否显示效率曲线 protected bool _isDispCurveQE = true;//双达不显示 public bool IsDispCurveQE { get { return _isDispCurveQE; } set { _isDispCurveQE = value; } } //曲线文字的间隙 protected int _curveParasLabelSpaceX = 1; protected int _curveParasLabelSpaceY = 1; //X轴实际尺寸换算为像素尺寸 protected virtual double MapRealToPictQ(double Q) { return 0; } //扬程曲线Y坐标实际尺寸换算为像素尺寸 protected virtual double MapRealToPictH(double H) { return 0; } //效率曲线Y坐标实际尺寸换算为像素尺寸 protected virtual double MapRealToPictE(double E) { return 0; } //功率曲线Y坐标实际尺寸换算为像素尺寸 protected virtual double MapRealToPictP(double P) { return 0; } //汽蚀曲线Y坐标实际尺寸换算为像素尺寸 protected virtual double MapRealToPictNPSH(double NPSH) { return 0; } //检查扬程线的坐标有没有超出 protected void CheckPressCoord() { if (this._pointInfoQH == null) return; foreach (var lastPt in this._pointInfoQH) { if (this._coordinateParas.DispMinH() > lastPt.Y) { if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0) this._coordinateParas.StartLineNoH--; if (this._coordinateParas.DispMinH() > lastPt.Y) { if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0) this._coordinateParas.StartLineNoH--; if (this._coordinateParas.DispMinH() > lastPt.Y) { if (this._coordinateParas.DispMinH() - this._coordinateParas.CoordSpaceH >= 0) this._coordinateParas.StartLineNoH--; } } } } } //检查汽蚀线的坐标有没有超出 protected void CheckNpshCoord() { if (this._allCurveNPSH == null) return; foreach (var curve in this._allCurveNPSH) { if (!curve.IsDispCurve) continue; if (curve.CurveInfo != null && curve.CurveInfo.Count > 0) { var lastPt = curve.CurveInfo.LastOrDefault(); if (this._coordinateParas.DispMaxNPSH() < lastPt.Y) this._coordinateParas.EndLineNoNPSH++; } else if (curve.CurveExpress != null) { var lastPt = curve.CurveExpress.GetLastPoint(); if (this._coordinateParas.DispMaxNPSH() < lastPt.Y) { this._coordinateParas.EndLineNoNPSH++; if (this._coordinateParas.DispMaxNPSH() < lastPt.Y) { this._coordinateParas.EndLineNoNPSH++; if (this._coordinateParas.DispMaxNPSH() < lastPt.Y) { this._coordinateParas.EndLineNoNPSH++; } } } } } } //检查汽蚀线的坐标有没有超出 protected void CheckPowerCoord() { if (this._pointInfoQP == null) return; foreach (var lastPt in this._pointInfoQP) { if (this._coordinateParas.DispMaxP() < lastPt.Y) { this._coordinateParas.EndLineNoP++; if (this._coordinateParas.DispMaxP() < lastPt.Y) { this._coordinateParas.EndLineNoP++; if (this._coordinateParas.DispMaxP() < lastPt.Y) { this._coordinateParas.EndLineNoP++; } } } } } //检查坐标是否重叠冲突(合并坐标,需要检查) protected void CheckEtaNpshCoord冲突() { if (_coordinateParas.EndLineNoNPSH > _coordinateParas.StartLineNoNPSH) { for (int dd = 0; dd < 10; dd++) { if (_coordinateParas.EndLineNoNPSH >= _coordinateParas.StartLineNoE) { _coordinateParas.EndLineNoE++; _coordinateParas.StartLineNoE++; _coordinateParas.CoordMinE = _coordinateParas.CoordMinE - _coordinateParas.CoordSpaceE; } else { break; } } } } //检查坐标是否重叠冲突(合并坐标,需要检查) protected void CheckPowerHeadCoord冲突() { if (_coordinateParas.EndLineNoP + 1 >= _coordinateParas.StartLineNoH) { for (int dd = 0; dd < 10; dd++) { if (_coordinateParas.EndLineNoP + 1 >= _coordinateParas.StartLineNoH) { _coordinateParas.StartLineNoH++; } else { break; } } } } protected int _blankGridNumberUpBottom = 2;//扬程下面预留2个格子 protected int _blankGridNumberUpTop = 1;//扬程上面预留1个格子 protected int _blankGridNumberDownBottom = 1;//功率下面预留2个格子 protected int _blankGridNumberDownTop = 1;//功率上面预留1个格子 public int BlankGridNumberDownTop { get { return _blankGridNumberDownTop; } set { _blankGridNumberDownTop = value; } } } }