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 MultiSpeedBaseCuve : FeatChart
|
{
|
protected string _qhCurveLabelContent = "扬程(m)";
|
protected string _qeCurveLabelContent = "效率(%)";
|
protected string _qpCurveLabelContent = "功率(kW)";
|
protected string _npshCurveLabelContent = "汽蚀(m)";
|
|
|
//注意即使改了单位,曲线里面的数据没有变,只变化了图表的坐标显示
|
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(string strChartCoord)
|
{
|
SetCoordinate(Eventech.Common.LxpCoordinateParasConver.ToParameter(strChartCoord));
|
}
|
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 _isCutOutRangeCurveNPSH = false;
|
//public bool IsCutOutRangeCurveNPSH
|
//{
|
// get { return _isCutOutRangeCurveNPSH; }
|
// set { _isCutOutRangeCurveNPSH = value; }
|
//}
|
//汽蚀曲线延长到区域点(最小流量点开始)
|
protected bool _isCurveNpshStartWithRegionAllow = false;
|
public bool IsCurveNpshStartWithRegionAllow
|
{
|
get { return _isCurveNpshStartWithRegionAllow; }
|
set { _isCurveNpshStartWithRegionAllow = value; }
|
}
|
|
protected List<Eventech.Model.CurveDispParasEx> _allCurveNPSH = null;
|
public List<Eventech.Model.CurveDispParasEx> AllCurveNPSH
|
{
|
get { return _allCurveNPSH; }
|
set { _allCurveNPSH = value; }
|
}
|
#endregion
|
|
|
#region 性能曲线
|
|
|
protected List<Eventech.Model.CurveDispParasEx> _allCurveQH = null;
|
public List<Eventech.Model.CurveDispParasEx> AllCurveQH
|
{
|
get { return _allCurveQH; }
|
set { _allCurveQH = value; }
|
}
|
public void AddlCurveQH(Eventech.Model.CurveExpress curveExpress, string curveName = null,Eventech.Model.FeatPoint curveNamePosi = null)
|
{
|
Eventech.Model.CurveDispParasEx curveDispParasEx = new Eventech.Model.CurveDispParasEx();
|
if (string.IsNullOrEmpty(curveName))
|
{
|
curveDispParasEx.IsDispName = false;
|
}
|
else
|
{
|
curveDispParasEx.LabelPosiName = curveNamePosi;
|
curveDispParasEx.CurveName = curveName;
|
curveDispParasEx.IsDispName = true ;
|
}
|
|
curveDispParasEx.IsDispCurve = true;
|
curveDispParasEx.CurveExpress = curveExpress;
|
curveDispParasEx.CurveColor = System.Drawing.Color.FromArgb(100, 149, 237);
|
if (_allCurveQH == null)
|
_allCurveQH = new List<Eventech.Model.CurveDispParasEx>();
|
_allCurveQH.Add(curveDispParasEx);
|
}
|
public void AddlCurveQH(Eventech.Model.CurveExpress curveExpress, string curveName, Eventech.Model.FeatPoint curveNamePosi,
|
double curvePara ,Eventech.Model.FeatPoint curveParaPosi, bool IsMeterUnit)
|
{
|
Eventech.Model.CurveDispParasEx curveDispParasEx = new Eventech.Model.CurveDispParasEx();
|
if (string.IsNullOrEmpty(curveName) || string.IsNullOrWhiteSpace(curveName))
|
{
|
curveDispParasEx.IsDispName = false;
|
}
|
else
|
{
|
curveDispParasEx.LabelPosiName = curveNamePosi;
|
curveDispParasEx.CurveName = curveName;
|
curveDispParasEx.IsDispName = true;
|
}
|
|
if (curvePara > 0.5)
|
{
|
if (IsMeterUnit)
|
curveDispParasEx.CurvePara = string.Format("{0}mm", curvePara);
|
else
|
curveDispParasEx.CurvePara = string.Format("{0}\"", curvePara);
|
curveDispParasEx.LabelPosiPara = curveParaPosi;
|
curveDispParasEx.IsDispPara = true;
|
}
|
else
|
{
|
curveDispParasEx.IsDispPara = false ;
|
}
|
|
curveDispParasEx.IsDispCurve = true;
|
curveDispParasEx.CurveExpress = curveExpress;
|
curveDispParasEx.CurveColor = System.Drawing.Color.FromArgb(100, 149, 237);
|
|
if (_allCurveQH == null)
|
_allCurveQH = new List<Eventech.Model.CurveDispParasEx>();
|
_allCurveQH.Add(curveDispParasEx);
|
}
|
public void AddlCurveQH(Eventech.Model.CurveDispParasEx curveDispParasEx)
|
{
|
if (_allCurveQH == null)
|
_allCurveQH = new List<Eventech.Model.CurveDispParasEx>();
|
|
curveDispParasEx.CurveColor = System.Drawing.Color.FromArgb(100, 149, 237);
|
_allCurveQH.Add(curveDispParasEx);
|
}
|
|
protected List<Eventech.Model.CurveDispParasEx> _allCurveQE = null;
|
public List<Eventech.Model.CurveDispParasEx> AllCurveQE
|
{
|
get { return _allCurveQE; }
|
set { _allCurveQE = value; }
|
}
|
public void AddlCurveQE(Eventech.Model.CurveExpress curveExpress, string curveName = null)
|
{
|
Eventech.Model.CurveDispParasEx curveDispParasEx = new Eventech.Model.CurveDispParasEx();
|
if (string.IsNullOrEmpty(curveName))
|
{
|
curveDispParasEx.IsDispName = false;
|
}
|
else
|
{
|
curveDispParasEx.CurveName = curveName;
|
curveDispParasEx.IsDispName = false;
|
}
|
curveDispParasEx.IsDispCurve = true;
|
curveDispParasEx.IsDispCurve = true;
|
curveDispParasEx.CurveExpress = curveExpress;
|
curveDispParasEx.CurveColor = System.Drawing.Color.FromArgb(154, 255, 154);
|
if (_allCurveQE == null)
|
_allCurveQE = new List<Eventech.Model.CurveDispParasEx>();
|
_allCurveQE.Add(curveDispParasEx);
|
}
|
|
protected List<Eventech.Model.CurveDispParasEx> _allCurveQP = null;
|
public List<Eventech.Model.CurveDispParasEx> AllCurveQP
|
{
|
get { return _allCurveQP; }
|
set { _allCurveQP = value; }
|
}
|
public void AddlCurveQP(Eventech.Model.CurveExpress curveExpress, string curveName = null)
|
{
|
Eventech.Model.CurveDispParasEx curveDispParasEx = new Eventech.Model.CurveDispParasEx();
|
if (string.IsNullOrEmpty(curveName))
|
{
|
curveDispParasEx.IsDispName = false;
|
}
|
else
|
{
|
curveDispParasEx.CurveName = curveName;
|
curveDispParasEx.IsDispName = false;
|
}
|
curveDispParasEx.IsDispCurve = true;
|
curveDispParasEx.CurveExpress = curveExpress;
|
curveDispParasEx.CurveColor = System.Drawing.Color.FromArgb(255, 140, 105);
|
if (_allCurveQP == null)
|
_allCurveQP = new List<Eventech.Model.CurveDispParasEx>();
|
_allCurveQP.Add(curveDispParasEx);
|
}
|
|
|
|
|
|
#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 int _minorTickNumberX = 4;
|
protected int _minorTickNumberY = 3;
|
|
protected double _axisTitleSpaceToDiagramQ = 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 bool isDispSpectrum = true;
|
public bool IsDispSpectrum { get { return isDispSpectrum; } set { isDispSpectrum = 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 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._allCurveQP == null)
|
return;
|
foreach (var curve in this._allCurveQP)
|
{
|
if (!curve.IsDispCurve)
|
continue;
|
|
if (curve.CurveInfo != null && curve.CurveInfo.Count > 0)
|
{
|
var lastPt = curve.CurveInfo.LastOrDefault();
|
if (this._coordinateParas.DispMaxP() < lastPt.Y)
|
this._coordinateParas.EndLineNoP++;
|
}
|
else if (curve.CurveExpress != null)
|
{
|
var lastPt = curve.CurveExpress.GetLastPoint();
|
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;
|
}
|
}
|
}
|
}
|
|
}
|
}
|