using DevExpress.Utils;
|
using DevExpress.XtraCharts;
|
using IStation.Model;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Globalization;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using System.Windows.Forms;
|
|
|
|
namespace IStation.WinFrmUI.Curve
|
{
|
public partial class ChartFeatCurveViewCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
#region 显示
|
|
//是否显示点
|
private bool _isDispCurrentPoint = false;
|
public bool IsDispCurvePoint { get { return _isDispCurrentPoint; } set { _isDispCurrentPoint = value; } }
|
|
//是否显示曲线标签
|
private bool _isDispCurveName = true;
|
|
/// <summary>
|
/// 是否显示曲线标签
|
/// </summary>
|
public bool IsDispCurveName
|
{
|
get { return _isDispCurveName; }
|
set
|
{
|
_isDispCurveName = value;
|
if (TextAnnotationQH != null)
|
TextAnnotationQH.Visible = _isDispCurveName;
|
if (TextAnnotationQE != null)
|
TextAnnotationQE.Visible = _isDispCurveName;
|
if (TextAnnotationQP != null)
|
TextAnnotationQP.Visible = _isDispCurveName;
|
}
|
}
|
|
public void SetCurveNameVisible(bool isDisp)
|
{
|
this._isDispCurveName = isDisp;
|
if (TextAnnotationQH != null)
|
TextAnnotationQH.Visible = isDisp;
|
if (TextAnnotationQE != null)
|
TextAnnotationQE.Visible = isDisp;
|
if (TextAnnotationQP != null)
|
TextAnnotationQP.Visible = isDisp;
|
}
|
//
|
private void InitialChartDisplay()
|
{
|
SetSettingColor();
|
}
|
|
|
public void SetSettingColor()
|
{
|
XtraChartHelper.SetDisplay(AxisQ, QHAxisY, QEAxisY, QPAxisY);
|
XtraChartHelper.SetCurveDisplay(SeriesQHcurve, SeriesQEcurve, SeriesQPcurve);
|
XtraChartHelper.SetPointDisplay(SeriesQHpoint, SeriesQEpoint, SeriesQPpoint);
|
|
//XtraChartHelper.SetSeriesQH(SeriesQHline);
|
|
XtraChartHelper.SetDisplay(WorkRegionStrip);
|
|
if (_isDispCurveName)
|
{
|
XtraChartHelper.SetDisplay(TextAnnotationQH, TextAnnotationQE, TextAnnotationQP);
|
}
|
|
TextAnnotationQH.Visible = _isDispCurveName;
|
TextAnnotationQE.Visible = _isDispCurveName;
|
TextAnnotationQP.Visible = _isDispCurveName;
|
}
|
|
#endregion
|
|
#region 曲线
|
private bool _isOnlyCurveQH = false;
|
double _CurveMaxQ = 0, _CurveMinQ = 0;
|
double _CurveMaxH = 0, _CurveMinH = 0;
|
private List<Model.CurvePoint> CurveInfoQH = null;
|
private List<Model.CurvePoint> PointInfoQH = null;
|
public Model.CurveExpress CurveExprQH = null;
|
|
private List<Model.CurvePoint> CurveInfoQE = null;
|
private List<Model.CurvePoint> PointInfoQE = null;
|
public Model.CurveExpress CurveExprQE = null;
|
|
private List<Model.CurvePoint> CurveInfoQP = null;
|
private Model.CurveExpress CurveExprQP = null;
|
private List<Model.CurvePoint> PointInfoQP = null;
|
|
Unit.eUnitH _unitH = Unit.eUnitH.M;
|
|
public void SetCurveInfo(
|
Model.CurveExpress curveQH,
|
Model.CurveExpress curveQE,
|
Model.CurveExpress curveQP)
|
{
|
if (curveQH == null)
|
{
|
EmptyGroupPoint();
|
return;
|
}
|
|
this.CurveExprQH = curveQH;
|
this.CurveExprQE = curveQE;
|
this.CurveExprQP = curveQP;
|
|
this.CurveInfoQH = Model.FitCurveHelper.GetFitPoints(curveQH, 11);
|
this.CurveInfoQE = Model.FitCurveHelper.GetFitPoints(curveQE, 11);
|
this.CurveInfoQP = Model.FitCurveHelper.GetFitPoints(curveQP, 11);
|
|
_isOnlyCurveQH = false;
|
if (curveQE == null && curveQP == null)
|
{
|
_isOnlyCurveQH = true;
|
}
|
|
|
|
|
//每次都设置为不显示。且重新计算
|
WorkRegionMax = (from r in this.CurveInfoQH select r.X).Max();
|
WorkRegionMin = WorkRegionMax * 0.9;
|
isDispWorkRegion = false;
|
}
|
public void SetPointInfo(FeatCurvePointGroup pointInfo)
|
{
|
this.PointInfoQH = pointInfo.PointQH ;
|
this.PointInfoQE = pointInfo.PointQE;
|
this.PointInfoQP = pointInfo.PointQP;
|
}
|
//清理
|
public void EmptyGroupPoint()
|
{
|
CurveExprQH = null;
|
CurveInfoQH = null;
|
CurveExprQE = null; CurveInfoQE = null;
|
CurveExprQP = null; CurveInfoQP = null;
|
}
|
|
#endregion
|
|
#region CHART变量
|
//测试的原始点
|
private Series SeriesQHpoint = null;
|
private Series SeriesQEpoint = null;
|
private Series SeriesQPpoint = null;
|
|
//拟合后的曲线上的点
|
private Series SeriesQHcurve = null;
|
private Series SeriesQEcurve = null;
|
private Series SeriesQPcurve = null;
|
|
private Series SeriesQHline = null;
|
|
//
|
private DevExpress.XtraCharts.XYDiagram mainChartDiagram;
|
private DevExpress.XtraCharts.Strip WorkRegionStrip = null;
|
private DevExpress.XtraCharts.ConstantLine RatedParasLine = null;
|
private DevExpress.XtraCharts.ConstantLine WorkParasLine = null;
|
//
|
private DevExpress.XtraCharts.TextAnnotation TextAnnotationQH = null;
|
private DevExpress.XtraCharts.TextAnnotation TextAnnotationQE = null;
|
private DevExpress.XtraCharts.TextAnnotation TextAnnotationQP = null;
|
private DevExpress.XtraCharts.TextAnnotation TextAnnotationEquip = null;
|
private DevExpress.XtraCharts.TextAnnotation TextAnnoWorkPoint = null;
|
|
private DevExpress.XtraCharts.TextAnnotation TextAnnotationMaxE = null;
|
|
//
|
AxisX AxisQ = null;
|
AxisY QHAxisY = null;
|
SecondaryAxisY QEAxisY = null;
|
SecondaryAxisY QPAxisY = null;
|
|
#endregion
|
|
#region 构造函数和加载函数
|
public ChartFeatCurveViewCtrl()
|
{
|
InitializeComponent();
|
|
_unitH = Unit.eUnitH.M;
|
|
InitialChart();
|
|
//if (Eventech.Localization.UICulture.IsEnglish)
|
//{//英语
|
// //资源文件
|
// System.ComponentModel.ComponentResourceManager resources
|
// = new System.ComponentModel.ComponentResourceManager(typeof(ChartTestDataCtrl));
|
// Eventech.Localization.SetResource.ContextMenuStrip(chartRightMenu, resources);
|
// QHAxisY.Title.Text = "Head(m)";
|
// QEAxisY.Title.Text = "Efficiency(%)";
|
// QPAxisY.Title.Text = "Power(kw)";
|
// RatedParasLine.Title.Text = "Work";
|
//}
|
}
|
|
private void LoadWindow(object sender, EventArgs e)
|
{
|
InitialChartDisplay();
|
XtraChartHelper.SetAxisName(QHAxisY, "扬程", _unitH);
|
}
|
|
private void InitialChart()
|
{
|
SeriesQHpoint = chartControl1.Series["SeriesQHpoint"];
|
SeriesQEpoint = chartControl1.Series["SeriesQEpoint"];
|
SeriesQPpoint = chartControl1.Series["SeriesQPpoint"];
|
|
SeriesQHcurve = chartControl1.Series["SeriesQHcurve"];
|
SeriesQEcurve = chartControl1.Series["SeriesQEcurve"];
|
SeriesQPcurve = chartControl1.Series["SeriesQPcurve"];
|
|
SeriesQHline = chartControl1.Series["SeriesQHline"];
|
|
mainChartDiagram = (XYDiagram)chartControl1.Diagram;
|
|
SeriesQHpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQEpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQPpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQHcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQEcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQPcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQHpoint.Visible = false;
|
SeriesQEpoint.Visible = false;
|
SeriesQPpoint.Visible = false;
|
SeriesQHline.Visible = false;
|
|
SeriesQHcurve.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQEcurve.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQPcurve.CrosshairEnabled = DefaultBoolean.False;
|
|
SeriesQHpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQEpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQPpoint.CrosshairEnabled = DefaultBoolean.False;
|
|
SeriesQHline.CrosshairHighlightPoints = DefaultBoolean.False;
|
SeriesQHline.CrosshairEnabled = DefaultBoolean.False;
|
|
//
|
AxisQ = mainChartDiagram.AxisX;
|
QHAxisY = mainChartDiagram.AxisY;
|
AxisQ.Visibility = DefaultBoolean.False;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
|
QEAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QEAxisY");
|
QPAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QPAxisY");
|
QEAxisY.Visibility = DefaultBoolean.False;
|
QPAxisY.Visibility = DefaultBoolean.False;
|
|
//
|
WorkRegionStrip = AxisQ.Strips.GetStripByName("WorkRegion");
|
WorkRegionStrip.Visible = false;
|
|
RatedParasLine = (DevExpress.XtraCharts.ConstantLine)mainChartDiagram.AxisX.ConstantLines.GetElementByName("RatedParasLine");
|
RatedParasLine.Visible = false;
|
|
WorkParasLine = (DevExpress.XtraCharts.ConstantLine)mainChartDiagram.AxisX.ConstantLines.GetElementByName("WorkParasLine");
|
WorkParasLine.Visible = false;
|
//SeriesQHline.Visible = false;
|
|
TextAnnotationQH = chartControl1.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
TextAnnotationQH.Visible = false;
|
|
TextAnnotationQE = chartControl1.AnnotationRepository[1] as DevExpress.XtraCharts.TextAnnotation;
|
TextAnnotationQE.Visible = false;
|
|
TextAnnotationQP = chartControl1.AnnotationRepository[2] as DevExpress.XtraCharts.TextAnnotation;
|
TextAnnotationQP.Visible = false;
|
|
TextAnnoWorkPoint = chartControl1.AnnotationRepository[3] as DevExpress.XtraCharts.TextAnnotation;
|
TextAnnotationEquip = chartControl1.AnnotationRepository[4] as DevExpress.XtraCharts.TextAnnotation;
|
TextAnnotationMaxE = chartControl1.AnnotationRepository[5] as DevExpress.XtraCharts.TextAnnotation;
|
|
|
TextAnnotationMaxE.Visible = false;
|
TextAnnoWorkPoint.Visible = false;
|
TextAnnotationEquip.Visible = false;
|
|
LineSeriesView view1 = (SplineSeriesView)SeriesQHcurve.View;
|
view1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;
|
LineSeriesView view2 = (SplineSeriesView)SeriesQEcurve.View;
|
view2.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;
|
LineSeriesView view3 = (SplineSeriesView)SeriesQPcurve.View;
|
view3.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;
|
|
this.chartControl1.SeriesSelectionMode = SeriesSelectionMode.Point;//设置此属性 表示可以选择CHART上物体
|
// this.chartControl1.RuntimeSeriesSelectionMode = SeriesSelectionMode.Point;//系列选择是选择其中的点而不是整个系列
|
this.SeriesQHpoint.CrosshairHighlightPoints = DefaultBoolean.True;
|
//this.chartControl1.RuntimeSeriesSelectionMode = SeriesSelectionMode.Series;
|
|
//添加重绘事件
|
this.chartControl1.CustomPaint += new DevExpress.XtraCharts.CustomPaintEventHandler(this.chartControl_CustomPaint);
|
this.chartControl1.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.chartControl1_ObjectHotTracked);
|
////this.chartControl1.MouseLeave += new System.EventHandler(this.chartControl1_MouseLeave);
|
this.chartControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseMove);
|
this.chartControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseUp);
|
this.chartControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseDown);
|
this.chartControl1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chartControl_MouseClick);
|
|
this.chartControl1.AnimationStartMode = DevExpress.XtraCharts.ChartAnimationMode.OnLoad;
|
|
}
|
#endregion
|
|
#region 设置额定参数
|
private ViewModel.RatedParas _ratedParas = null;
|
private bool isDispRatedLine = false;
|
private string ratedParasAnno = "";
|
public ViewModel.RatedParas RatedParas
|
{
|
get { return _ratedParas; }
|
set
|
{
|
_ratedParas = value;
|
isDispRatedLine = false;
|
if (_ratedParas != null)
|
{
|
StringBuilder builder = new StringBuilder();
|
builder.AppendFormat("额定点 流量:{0:N1}; ", _ratedParas.Q);
|
builder.AppendFormat("扬程:{0:N1}; ", _ratedParas.H);
|
builder.AppendLine("");
|
builder.AppendFormat(" 效率:{0:N1}; ", _ratedParas.E);
|
builder.AppendFormat("功率:{0:N1} ", _ratedParas.P);
|
ratedParasAnno = builder.ToString();
|
isDispRatedLine = true;
|
}
|
}
|
}
|
#endregion
|
|
#region 设置工作点
|
private bool isDispWorkPt = false;
|
private Model.GroupPoint workPt = new Model.GroupPoint(0, 0, 0, 0, 0);
|
public void SetWorkPointQ(double wrkQ)
|
{
|
if (this.CurveInfoQH != null && this.CurveInfoQH.Count > 3)
|
{
|
workPt.Q = wrkQ;
|
isDispWorkPt = true;
|
SeriesQHline.Visible = true;
|
WorkParasLine.Visible = true;
|
WorkParasLine.Title.Visible = true;
|
SeriesQHline.Visible = true;
|
TextAnnoWorkPoint.Visible = true;
|
|
CalcWorkPtByQ(wrkQ);
|
SetQHLineByWorkPt();
|
}
|
}
|
|
public void SetWorkPointQ_Auto()
|
{
|
if (this.CurveInfoQH != null && this.CurveInfoQH.Count > 3)
|
{
|
double wrkQ = (_CurveMinQ + _CurveMaxQ) / 2;
|
|
SetWorkPointQ(wrkQ);
|
}
|
}
|
public void SetWorkPointH(double wrkH)
|
{
|
if (this.CurveInfoQH != null && this.CurveInfoQH.Count > 3)
|
{
|
workPt.H = wrkH;
|
isDispWorkPt = true;
|
SeriesQHline.Visible = true;
|
WorkParasLine.Visible = true;
|
WorkParasLine.Title.Visible = true;
|
SeriesQHline.Visible = true;
|
TextAnnoWorkPoint.Visible = true;
|
|
double wrkQ = 0;
|
if (CalcWorkQByH(wrkH, ref wrkQ))
|
{
|
CalcWorkPtByQ(wrkQ);
|
SetQHLineByWorkPt();
|
}
|
}
|
}
|
|
public Model.GroupPoint GetWorkPoint()
|
{
|
return workPt;
|
}
|
|
public void IsNotDispWorkPt()
|
{
|
isDispWorkPt = false;
|
WorkParasLine.Visible = false;
|
WorkParasLine.Title.Visible = false;
|
TextAnnoWorkPoint.Visible = false;
|
SeriesQHline.Visible = false;
|
}
|
#endregion
|
|
#region 坐标
|
//坐标
|
private Model.CurveCoordinateParas _coordinateParas = null;
|
public Model.CurveCoordinateParas CoordinateParas { get { return _coordinateParas; } set { _coordinateParas = value; } }
|
|
//更新图表坐标
|
public void UpdateCoordinate()
|
{
|
//先设置为不显示
|
AxisQ.Visibility = DefaultBoolean.False;
|
QHAxisY.GridLines.Visible = false;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
QPAxisY.GridLines.Visible = false;
|
QPAxisY.Visibility = DefaultBoolean.False;
|
QEAxisY.GridLines.Visible = false;
|
QEAxisY.Visibility = DefaultBoolean.False;
|
|
WorkRegionStrip.Visible = false;
|
RatedParasLine.Visible = false;
|
|
if (CoordinateParas == null)
|
return;
|
var nfi = new NumberFormatInfo();
|
nfi.NumberGroupSeparator = " "; // set the group separator to a space
|
nfi.NumberDecimalSeparator = ","; // set decimal separator to comma
|
|
//流量
|
if (CurveInfoQH != null)
|
{
|
//坐标刻度
|
List<CustomAxisLabel> q_Label_List = new List<CustomAxisLabel>();
|
AxisQ.CustomLabels.Clear();
|
double disQ = CoordinateParas.CoordMinQ;
|
for (int i = 0; i < CoordinateParas.GridNumberX + 1; i++)
|
{
|
q_Label_List.Add(new CustomAxisLabel(disQ.ToString("N0", nfi), disQ));
|
disQ = disQ + CoordinateParas.CoordSpaceQ;
|
}
|
AxisQ.CustomLabels.AddRange(q_Label_List.ToArray());
|
|
//设置显示
|
AxisQ.Visibility = DefaultBoolean.True;
|
AxisQ.GridLines.Visible = true;
|
XtraChartHelper.SetAxisRange(AxisQ, CoordinateParas.CoordMinQ, CoordinateParas.CoordMinQ + CoordinateParas.GridNumberX * CoordinateParas.CoordSpaceQ);
|
|
}
|
|
//扬程
|
int h_grid_count = 0;
|
if (CurveInfoQH != null)
|
{
|
//坐标刻度
|
QHAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> h_Label_List = new List<CustomAxisLabel>();
|
double disH = CoordinateParas.CoordMinH + CoordinateParas.CoordSpaceH * CoordinateParas.StartLineNoH;
|
for (int i = CoordinateParas.StartLineNoH; i < CoordinateParas.EndLineNoH + 1; i++)
|
{
|
h_Label_List.Add(new CustomAxisLabel(disH.ToString(), disH));
|
disH = disH + CoordinateParas.CoordSpaceH;
|
}
|
QHAxisY.CustomLabels.AddRange(h_Label_List.ToArray());
|
//设置显示
|
//QHAxisY.GridLines.Visible = true;
|
QHAxisY.Visibility = DefaultBoolean.True;
|
if (_isOnlyCurveQH)
|
{
|
h_grid_count = h_Label_List.Count();
|
XtraChartHelper.SetAxisRange(QHAxisY, CoordinateParas.DispMinH(), CoordinateParas.DispMaxH());
|
}
|
else
|
{
|
h_grid_count = h_Label_List.Count() + 3;
|
XtraChartHelper.SetAxisRange(QHAxisY,
|
CoordinateParas.DispMinH() - 3 * CoordinateParas.CoordSpaceH,
|
CoordinateParas.DispMaxH());
|
}
|
QHAxisY.GridLines.Visible = true;
|
}
|
|
//效率
|
if (CurveInfoQE != null)
|
{
|
QEAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> E_Label_List = new List<CustomAxisLabel>();
|
double disE = CoordinateParas.CoordMinE + CoordinateParas.CoordSpaceE * CoordinateParas.StartLineNoE;
|
for (int i = CoordinateParas.StartLineNoE; i < CoordinateParas.EndLineNoE + 1; i++)
|
{
|
E_Label_List.Add(new CustomAxisLabel(disE.ToString(), disE));
|
disE = disE + CoordinateParas.CoordSpaceE;
|
}
|
QEAxisY.CustomLabels.AddRange(E_Label_List.ToArray());
|
//设置显示
|
QEAxisY.GridLines.Visible = true;
|
QEAxisY.Visibility = DefaultBoolean.True;
|
|
|
XtraChartHelper.SetAxisRange(QEAxisY,
|
CoordinateParas.DispMinE(),
|
CoordinateParas.DispMinE() + (h_grid_count - 1) * CoordinateParas.CoordSpaceE);
|
}
|
|
//功率
|
if (CurveInfoQP != null)
|
{
|
//坐标刻度
|
QPAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> P_Label_List = new List<CustomAxisLabel>();
|
double disP = CoordinateParas.DispMinP();
|
double maxP = disP;
|
for (int i = CoordinateParas.StartLineNoP; i < CoordinateParas.EndLineNoP + 1; i++)
|
{
|
P_Label_List.Add(new CustomAxisLabel(disP.ToString(), disP));
|
disP = disP + CoordinateParas.CoordSpaceP;
|
maxP = disP;
|
}
|
QPAxisY.CustomLabels.AddRange(P_Label_List.ToArray());
|
//设置显示
|
QPAxisY.Visibility = DefaultBoolean.True;
|
QPAxisY.GridLines.Visible = true ;
|
XtraChartHelper.SetAxisRange(QPAxisY,
|
CoordinateParas.DispMinP(), maxP);
|
}
|
}
|
|
#endregion
|
|
#region 更新
|
|
//更新所有
|
public void UpdateChart(bool isCalcCoordinate = false)
|
{
|
//要依次更新
|
if (this.CurveInfoQH == null || this.CurveInfoQH.Count < 3)
|
return;
|
if (isCalcCoordinate || CoordinateParas == null)
|
{//不强迫计算,就用上次更新的坐标系
|
CalcCoordinate();
|
}
|
|
UpdateCoordinate();
|
|
UpdateCurve();
|
|
UpdatePoint();
|
|
UpdateRatedParas();
|
|
UpdateWorkParas();
|
|
if (isDispMaxE)
|
{
|
ShowMaxEffPt();
|
}
|
else if (isDispMaxH)
|
{
|
ShowMaxQPoint();
|
}
|
else
|
{
|
if (isDispWorkPt && workPt != null && this.CurveInfoQH != null && this.CurveInfoQH.Count > 2)
|
{
|
if (workPt.Q < _CurveMaxQ && workPt.Q > _CurveMinQ)
|
{
|
SetWorkPointQ(workPt.Q);
|
}
|
}
|
}
|
|
}
|
|
//计算坐标
|
public void CalcCoordinate()
|
{
|
if (CurveInfoQH != null && CurveInfoQH.Count() > 3)
|
{
|
CoordinateParas = Model.CurveCoordinateParas.CalcCoordinate(CurveInfoQH, CurveInfoQE, CurveInfoQP);
|
|
_CurveMinQ = (from x in CurveInfoQH select x.X).Min();
|
_CurveMaxQ = (from x in CurveInfoQH select x.X).Max();
|
_CurveMinH = (from x in CurveInfoQH select x.Y).Min();
|
_CurveMaxH = (from x in CurveInfoQH select x.Y).Max();
|
}
|
else
|
{
|
CoordinateParas = GetBlankCoordinate();
|
if (_CurveMinQ > _CurveMaxQ - 1)
|
{
|
_CurveMinQ = _CurveMinQ * 0.8;
|
_CurveMaxQ = _CurveMaxQ * 1.2;
|
}
|
if (_CurveMinH > _CurveMaxH - 0.1)
|
{
|
_CurveMinH = _CurveMinH * 0.8;
|
_CurveMaxH = _CurveMaxH * 1.2;
|
}
|
}
|
}
|
|
/// <summary>
|
/// 获取空白坐标
|
/// </summary>
|
private Model.CurveCoordinateParas GetBlankCoordinate()
|
{
|
var para = new Model.CurveCoordinateParas();
|
para.GridNumberX = 30;
|
para.GridNumberY = 16;
|
|
//显示的坐标线号
|
para.StartLineNoH = 10;
|
para.EndLineNoH = 15;
|
|
para.StartLineNoE = 0;
|
para.EndLineNoE = 10;
|
|
para.StartLineNoP = 2;
|
para.EndLineNoP = 9;
|
|
//坐标最小值和间隔
|
para.CoordMinQ = 0; para.CoordSpaceQ = 1000;
|
para.CoordMinH = 10; para.CoordSpaceH = 100;
|
para.CoordMinE = 0; para.CoordSpaceE = 100;
|
para.CoordMinP = 10; para.CoordSpaceP = 100;
|
return para;
|
}
|
|
/// <summary>
|
/// 清除数据
|
/// </summary>
|
public void ClearData()
|
{
|
CurveExprQH = null; CurveInfoQH = null;
|
CurveExprQE = null; CurveInfoQE = null;
|
CurveExprQP = null; CurveInfoQP = null;
|
UpdateCurve();
|
}
|
|
|
//更新所有点
|
public void UpdateCurve()
|
{
|
|
int i = 0;
|
//更新所有曲线
|
if (CurveInfoQH != null && CurveInfoQH.Count > 3)
|
{
|
SeriesQHcurve.Visible = true;
|
SeriesQHcurve.Points.Clear();
|
for (i = 0; i < CurveInfoQH.Count(); i++)
|
{
|
SeriesQHcurve.Points.Add(new SeriesPoint(CurveInfoQH[i].X, new double[] { CurveInfoQH[i].Y }));
|
}
|
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = TextAnnotationQH.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
paneAnchorPoint1.AxisXCoordinate.AxisValue = CurveInfoQH[CurveInfoQH.Count() - 2].X.ToString();
|
paneAnchorPoint1.AxisYCoordinate.AxisValue = CurveInfoQH[CurveInfoQH.Count() - 2].Y.ToString();
|
TextAnnotationQH.Visible = _isDispCurveName;
|
}
|
else
|
{
|
SeriesQHcurve.Visible = false;
|
TextAnnoWorkPoint.Visible = false;
|
TextAnnotationQH.Visible = false;
|
WorkParasLine.Visible = false;
|
SeriesQHline.Visible = false;
|
SeriesQHcurve.Points.Clear();
|
}
|
|
if (CurveInfoQE != null && CurveInfoQE.Count > 3)
|
{
|
SeriesQEcurve.Visible = true;
|
SeriesQEcurve.Points.Clear();
|
for (i = 0; i < CurveInfoQE.Count(); i++)
|
{
|
SeriesQEcurve.Points.Add(new SeriesPoint(CurveInfoQE[i].X, new double[] { CurveInfoQE[i].Y }));
|
}
|
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint2 = TextAnnotationQE.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
var x = CurveInfoQE[CurveInfoQE.Count() - 2].X.ToString();
|
var y = CurveInfoQE[CurveInfoQE.Count() - 2].Y.ToString();
|
paneAnchorPoint2.AxisXCoordinate.AxisValue = CurveInfoQE[CurveInfoQE.Count() - 2].X.ToString();
|
paneAnchorPoint2.AxisYCoordinate.AxisValue = CurveInfoQE[CurveInfoQE.Count() - 2].Y.ToString();
|
TextAnnotationQE.Visible = _isDispCurveName;
|
}
|
else
|
{
|
SeriesQEcurve.Visible = false;
|
TextAnnotationQE.Visible = false;
|
SeriesQEcurve.Points.Clear();
|
}
|
|
|
|
if (CurveInfoQP != null && CurveInfoQP.Count > 3)
|
{
|
SeriesQPcurve.Visible = true;
|
SeriesQPcurve.Points.Clear();
|
for (i = 0; i < CurveInfoQP.Count(); i++)
|
{
|
SeriesQPcurve.Points.Add(new SeriesPoint(CurveInfoQP[i].X, new double[] { CurveInfoQP[i].Y }));
|
}
|
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint3 = TextAnnotationQP.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
paneAnchorPoint3.AxisXCoordinate.AxisValue = CurveInfoQP[CurveInfoQP.Count() - 2].X.ToString();
|
paneAnchorPoint3.AxisYCoordinate.AxisValue = CurveInfoQP[CurveInfoQP.Count() - 2].Y.ToString();
|
TextAnnotationQP.Visible = _isDispCurveName;
|
}
|
else
|
{
|
SeriesQPcurve.Visible = false;
|
TextAnnotationQP.Visible = false;
|
SeriesQEcurve.Points.Clear();
|
}
|
|
//stopwatchH.Stop();
|
//TimeSpan timespanH = stopwatchH.Elapsed; // 获取当前实例测量得出的总时间
|
//double milliseconds1 = timespanH.TotalMilliseconds; // 总毫秒数
|
// MessageBox.Show("单独添加点:"+milliseconds1.ToString() + "ms");
|
}
|
|
public void UpdatePoint()
|
{
|
|
|
if (_isDispCurrentPoint)
|
{
|
SeriesQHpoint.Visible = true;
|
SeriesQEpoint.Visible = true;
|
SeriesQPpoint.Visible = true;
|
}
|
else
|
{
|
SeriesQHpoint.Visible = false;
|
SeriesQEpoint.Visible = false;
|
SeriesQPpoint.Visible = false;
|
return;
|
}
|
|
|
int i = 0;
|
//更新所有曲线
|
if (PointInfoQH != null && PointInfoQH.Count > 3)
|
{
|
|
SeriesQHpoint.Visible = true;
|
SeriesQHpoint.Points.Clear();
|
for (i = 0; i < PointInfoQH.Count(); i++)
|
{
|
SeriesQHpoint.Points.Add(new SeriesPoint(PointInfoQH[i].X, new double[] { PointInfoQH[i].Y }));
|
}
|
}
|
|
|
if (PointInfoQE != null && PointInfoQE.Count > 3)
|
{
|
SeriesQEpoint.Visible = true;
|
SeriesQEpoint.Points.Clear();
|
for (i = 0; i < PointInfoQE.Count(); i++)
|
{
|
SeriesQEpoint.Points.Add(new SeriesPoint(PointInfoQE[i].X, new double[] { PointInfoQE[i].Y }));
|
}
|
}
|
|
|
if (PointInfoQP != null && PointInfoQP.Count > 3)
|
{
|
SeriesQPpoint.Visible = true;
|
SeriesQPpoint.Points.Clear();
|
for (i = 0; i < PointInfoQP.Count(); i++)
|
{
|
SeriesQPpoint.Points.Add(new SeriesPoint(PointInfoQP[i].X, new double[] { PointInfoQP[i].Y }));
|
}
|
}
|
|
|
}
|
|
//更新区域
|
public void UpdateWorkRegion()
|
{
|
WorkRegionStrip.Visible = isDispWorkRegion;
|
|
if (isDispWorkRegion)
|
{
|
WorkRegionStrip.MinLimit.AxisValue = 0; //因为会重复赋值,所以先设个小值,这样不会报错
|
WorkRegionStrip.MaxLimit.AxisValue = WorkRegionMax;
|
WorkRegionStrip.MinLimit.AxisValue = WorkRegionMin;
|
}
|
}
|
|
//更新额定参数
|
public void UpdateRatedParas()
|
{
|
if (RatedParasLine == null || _ratedParas == null)
|
{
|
RatedParasLine.Visible = false;
|
return;
|
}
|
|
RatedParasLine.AxisValue = _ratedParas.Q;
|
|
RatedParasLine.Visible = isDispRatedLine;
|
}
|
|
//更新工作参数
|
public void UpdateWorkParas()
|
{
|
if (WorkParasLine == null)
|
return;
|
if (isDispWorkPt && this.CurveInfoQH != null && this.CurveInfoQH.Count > 3)
|
{
|
if (workPt.Q > 2)
|
{
|
WorkParasLine.AxisValue = workPt.Q;
|
WorkParasLine.Visible = true;
|
}
|
else
|
{
|
WorkParasLine.Visible = false;
|
}
|
}
|
else
|
{
|
WorkParasLine.Visible = false;
|
}
|
}
|
|
#endregion
|
|
#region 重绘
|
//private float curveWidth = 2F;
|
Rectangle CalculateDiagramBounds()
|
{
|
Point p1 = mainChartDiagram.DiagramToPoint((double)mainChartDiagram.AxisX.VisualRange.MinValue, (double)mainChartDiagram.AxisY.VisualRange.MinValue).Point;
|
Point p2 = mainChartDiagram.DiagramToPoint((double)mainChartDiagram.AxisX.VisualRange.MaxValue, (double)mainChartDiagram.AxisY.VisualRange.MaxValue).Point;
|
return GeomHelper.CreateRectangle(p1, p2);
|
}
|
void chartControl_CustomPaint(object sender, CustomPaintEventArgs e)
|
{
|
if (_coordinateParas == null)
|
return;
|
if (!(e is DXCustomPaintEventArgs dxArgs))
|
return;
|
//chartControl1.DrawGridLineY(dxArgs, _coordinateParas, IStation.WinFrmUI.Curve.Cookie.ChartDisp.Default.GridLinesColorY, 0.2f, true);
|
#region 绘制装配曲线
|
//if (_equipmentCurveParas != null && _equipmentCurveParas.CurveInfo != null)
|
//{
|
// if (isDispEquipmentCurve)
|
// chartControl1.DrawEquipmentCurve(g, _equipmentCurveParas.CurveInfo);
|
//}
|
#endregion
|
}
|
|
#endregion
|
|
#region 右击菜单
|
private bool isMonoColor = false;
|
private void chartRightMenu_Opening(object sender, CancelEventArgs e)
|
{
|
if (isMonoColor)
|
{
|
单色显示MenuItem.Text = "多色显示";
|
}
|
else
|
{
|
单色显示MenuItem.Text = "单色显示";
|
}
|
|
|
if (OnChangeAxisTypeH == null)
|
{
|
转化为压差曲线MenuItem.Visible = false;
|
}
|
else
|
{//_hIsPress = false;//H表示是false扬程还是true压差
|
if (_hIsPress)
|
{
|
转化为压差曲线MenuItem.Text = "转化为扬程曲线";
|
}
|
else
|
{
|
转化为压差曲线MenuItem.Text = "转化为压差曲线";
|
}
|
}
|
|
if (WorkParasLine.Visible)
|
{
|
isDispWorkPt = true;
|
不显示工况点Item.Text = "不显示工况点";
|
}
|
else
|
{
|
isDispWorkPt = false;
|
不显示工况点Item.Text = "显示工况点";
|
}
|
}
|
|
private void 修改Anno名称MenuItem_Click(object sender, EventArgs e)
|
{
|
var anno = _rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
//SetCurveNameDlg theDlg = new SetCurveNameDlg();
|
//theDlg.CurveName = anno.Text;
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// anno.Text = theDlg.CurveName;
|
//}
|
}
|
|
private void 设置颜色AnnoMenuItem_Click(object sender, EventArgs e)
|
{
|
var anno = _rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = anno.TextColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
anno.TextColor = colorDialog1.Color;
|
anno.Border.Color = colorDialog1.Color;
|
}
|
}
|
|
private bool isDispCoodText = true;
|
private void DispCoodTextMenu_Click(object sender, EventArgs e)
|
{
|
isDispCoodText = !isDispCoodText;
|
if (isDispCoodText)
|
{
|
DispCoodTextMenu.Text = "不显示坐标说明";
|
}
|
else
|
{
|
DispCoodTextMenu.Text = "显示坐标说明";
|
}
|
|
AxisQ.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QHAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QEAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QPAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
private void 导出图片Item_Click(object sender, EventArgs e)
|
{
|
this.chartControl1.ExportPictByDlg();
|
}
|
|
private void 设置坐标Menu_Click(object sender, EventArgs e)
|
{
|
SetCoordinateAllDlg theSetDlg = new SetCoordinateAllDlg();
|
theSetDlg.CoordinateParas = this._coordinateParas;
|
theSetDlg.OnChangedCoord += (coord) =>
|
{
|
this._coordinateParas = coord;
|
UpdateCoordinate();
|
};
|
theSetDlg.Show();
|
}
|
|
public void SetCoordinateParas(Model.CurveCoordinateParas curveCoordinateParas)
|
{
|
this._coordinateParas = curveCoordinateParas;
|
UpdateCoordinate();
|
}
|
|
|
private void 不显示曲线标签Item_Click(object sender, EventArgs e)
|
{
|
_isDispCurveName = !_isDispCurveName;
|
if (_isDispCurveName)
|
{
|
不显示曲线标签Item.Text = "不显示曲线名称";
|
}
|
else
|
{
|
不显示曲线标签Item.Text = "显示曲线名称";
|
}
|
|
TextAnnotationQH.Visible = _isDispCurveName;
|
TextAnnotationQE.Visible = _isDispCurveName;
|
TextAnnotationQP.Visible = _isDispCurveName;
|
}
|
|
private void 不显示测试点Item_Click(object sender, EventArgs e)
|
{
|
_isDispCurrentPoint = !_isDispCurrentPoint;
|
if (_isDispCurrentPoint)
|
{
|
不显示测试点Item.Text = "不显示测试点";
|
SeriesQHpoint.Visible = true;
|
SeriesQEpoint.Visible = true;
|
SeriesQPpoint.Visible = true;
|
}
|
else
|
{
|
不显示测试点Item.Text = "显示测试点";
|
SeriesQHpoint.Visible = false;
|
SeriesQEpoint.Visible = false;
|
SeriesQPpoint.Visible = false;
|
}
|
}
|
|
private bool isDispPointPara = false;
|
private void 显示测试点参数MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispPointPara = !isDispPointPara;
|
if (isDispPointPara)
|
{
|
显示测试点参数MenuItem.Text = "不显示测试点参数";
|
}
|
else
|
{
|
显示测试点参数MenuItem.Text = "显示测试点参数";
|
}
|
|
SeriesQHpoint.Label.LineVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
SeriesQEpoint.Label.LineVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
SeriesQPpoint.Label.LineVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
SeriesQHpoint.LabelsVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
SeriesQEpoint.LabelsVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
SeriesQPpoint.LabelsVisibility = isDispPointPara ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
private void 不显示工况点Item_Click(object sender, EventArgs e)
|
{
|
isDispWorkPt = !isDispWorkPt;
|
if (isDispWorkPt)
|
{
|
不显示工况点Item.Text = "不显示工况点";
|
WorkParasLine.Visible = true;
|
TextAnnoWorkPoint.Visible = true;
|
SeriesQHline.Visible = true;
|
}
|
else
|
{
|
不显示工况点Item.Text = "显示工况点";
|
WorkParasLine.Visible = false;
|
TextAnnoWorkPoint.Visible = false;
|
SeriesQHline.Visible = false;
|
}
|
}
|
|
private void 设置图形显示Item_Click(object sender, EventArgs e)
|
{
|
// SetChartDisplayDlg theDlg = new SetChartDisplayDlg();
|
////theDlg.IsDispCurveQE = SeriesConnectCurveQE.Visible;
|
////theDlg.IsDispCurveQP = SeriesConnectCurveQP.Visible;
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// // SeriesConnectCurveQE.Visible = theDlg.IsDispCurveQE;
|
// // SeriesConnectCurveQP.Visible = theDlg.IsDispCurveQP;
|
|
// SetChartDisplay();
|
// chartControl1.Refresh();
|
//}
|
}
|
|
private void 显示曲线方程Item_Click(object sender, EventArgs e)
|
{
|
DispCurveEquationDlg theSetDlg = new DispCurveEquationDlg();
|
theSetDlg.SetCurveInfo(this.CurveExprQH, this.CurveExprQE, this.CurveExprQP);
|
theSetDlg.Show();
|
}
|
|
private void 保存曲线文件Item_Click(object sender, EventArgs e)
|
{
|
if (CurveExprQH == null)
|
return;
|
System.Windows.Forms.SaveFileDialog saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
saveFileDialog1.Filter = "*.csv|*.csv";
|
//saveFileDialog1.CheckFileExists = true;
|
//saveFileDialog1.CheckPathExists = true;
|
DialogResult ret = saveFileDialog1.ShowDialog();
|
if (ret != System.Windows.Forms.DialogResult.OK)
|
return;
|
var fileName = saveFileDialog1.FileName;
|
|
StreamWriter streamWriter = new StreamWriter(fileName, false, System.Text.Encoding.GetEncoding("gb2312"));
|
streamWriter.WriteLine("流量,扬程");
|
for (int i = 0; i < 10; i++)
|
{
|
var q = CurveExprQH.Min + (CurveExprQH.Max - CurveExprQH.Min) * i / 9;
|
var h = Model.FitCurveHelper.GetFitPointY(CurveExprQH, q);
|
streamWriter.WriteLine(string.Format("{0},{1}", q, h));
|
}
|
|
streamWriter.Flush();
|
streamWriter.Close();
|
}
|
|
bool isDispWorkRegion = false;
|
double WorkRegionMin = 0, WorkRegionMax = 0;
|
private void 设置运行区域Item_Click(object sender, EventArgs e)
|
{
|
//SetRegionParasDlg theDlg = new SetRegionParasDlg();
|
//theDlg.IsDispRegion = true;
|
//theDlg.RegionMax = WorkRegionMax;
|
//theDlg.RegionMin = WorkRegionMin;
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// isDispWorkRegion = theDlg.IsDispRegion;
|
// WorkRegionMax = theDlg.RegionMax;
|
// WorkRegionMin = theDlg.RegionMin;
|
|
// XtraChartHelper.SetDisplay(WorkRegionStrip);
|
// UpdateWorkRegion();
|
//}
|
}
|
|
private void 显示额定点MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispRatedLine = !isDispRatedLine;
|
if (isDispRatedLine)
|
{
|
显示额定点MenuItem.Text = "不显示额定点";
|
}
|
else
|
{
|
显示额定点MenuItem.Text = "显示额定点";
|
}
|
RatedParasLine.Visible = isDispRatedLine;
|
}
|
|
private void 单色显示MenuItem_Click(object sender, EventArgs e)
|
{
|
isMonoColor = !isMonoColor;
|
if (isMonoColor)
|
{
|
单色显示MenuItem.Text = "多色显示";
|
XtraChartHelper.SetMonoColor(chartControl1);
|
}
|
else
|
{
|
单色显示MenuItem.Text = "单色显示";
|
|
SetSettingColor();
|
}
|
}
|
|
|
private void 设置颜色LineMenuItem_Click(object sender, EventArgs e)
|
{
|
var refLine = _rightClickObj as DevExpress.XtraCharts.ConstantLine;
|
if (refLine == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = refLine.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
refLine.Color = colorDialog1.Color;
|
refLine.Title.TextColor = colorDialog1.Color;
|
}
|
}
|
|
|
|
private void 设置值SeriesMenuItem_Click(object sender, EventArgs e)
|
{
|
//SetRefLineValueDlg theDlg = new SetRefLineValueDlg();
|
//if (_hIsPress)
|
//{
|
// theDlg.RefLineValue = Convert.ToDecimal(Math.Round(workPt.H,4));
|
//}
|
//else
|
//{
|
// theDlg.RefLineValue = Convert.ToDecimal(Math.Round(workPt.H,1));
|
//}
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// double refH = Convert.ToDouble(theDlg.RefLineValue);
|
// double refQ = 0;
|
// if (CalcWorkQByH(refH, ref refQ))
|
// {
|
// CalcWorkPtByQ(refQ);
|
// SetQHLineByWorkPt();
|
// }
|
// else
|
// {
|
// XtraMessageBox.Show("没有交点");
|
// }
|
//}
|
}
|
private void 设置值LineMenuItem_Click(object sender, EventArgs e)
|
{
|
var refLine = _rightClickObj as DevExpress.XtraCharts.ConstantLine;
|
if (refLine == null)
|
return;
|
if (refLine == WorkParasLine)
|
{
|
SetWorkPointDlg theDlg = new SetWorkPointDlg();
|
theDlg.WorkQ = Math.Round(Convert.ToDecimal(WorkParasLine.AxisValue), 1);
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
SetWorkPointQ(Convert.ToDouble(theDlg.WorkQ));
|
if (OnChangeWorkPt != null)
|
{
|
OnChangeWorkPt(this, new TagEventArgs(workPt));
|
}
|
}
|
}
|
else if (refLine == RatedParasLine)
|
{
|
if (_ratedParas == null)
|
return;
|
|
//Eventech.ModuleBaseData.DispRatedParaDlg theDlg = new Eventech.ModuleBaseData.DispRatedParaDlg();
|
//theDlg.SetDispPump(_ratedParas);
|
//theDlg.Show();
|
}
|
}
|
|
private void 设置颜色AxisMenuItem_Click(object sender, EventArgs e)
|
{
|
var axis = _rightClickObj as DevExpress.XtraCharts.Axis;
|
if (axis == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
colorDialog1.Color = axis.Label.TextColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
axis.Title.TextColor = colorDialog1.Color;
|
axis.Label.TextColor = colorDialog1.Color;
|
axis.Color = colorDialog1.Color;
|
}
|
}
|
|
private void 设置坐标值MenuItem_Click(object sender, EventArgs e)
|
{
|
var axis = _rightClickObj as DevExpress.XtraCharts.Axis;
|
if (axis == null)
|
return;
|
SetCoordinateAllDlg theSetDlg = new SetCoordinateAllDlg();
|
theSetDlg.CoordinateParas = CoordinateParas;
|
if (theSetDlg.ShowDialog() == DialogResult.OK)
|
{
|
UpdateCoordinate();
|
// UpdateChart(false);
|
}
|
}
|
|
|
private void 设置颜色SeriesMenuItem_Click(object sender, EventArgs e)
|
{
|
var series = _rightClickObj as DevExpress.XtraCharts.Series;
|
if (series == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = series.View.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
series.View.Color = colorDialog1.Color;
|
}
|
}
|
#endregion
|
|
#region 获取图片
|
public System.IO.Stream GetChartImageStream()
|
{
|
System.IO.Stream stream = new MemoryStream();
|
chartControl1.ExportToImage(stream, System.Drawing.Imaging.ImageFormat.Png);
|
return stream;
|
}
|
#endregion
|
|
#region chartControl事件
|
object _rightClickObj = null;
|
SeriesPoint _rightSeriesPoint = null;
|
private void chartControl_MouseClick(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
{
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InAnnotation)
|
{
|
_rightClickObj = hitInfo.Annotation;
|
annoRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InSeries)
|
{
|
_rightClickObj = hitInfo.Series;
|
_rightSeriesPoint = hitInfo.SeriesPoint;
|
if ((_rightClickObj as DevExpress.XtraCharts.Series).Name == "SeriesQHline")
|
{
|
删除此点SeriesMenuItem.Visible = false;
|
编辑此点SeriesMenuItem.Visible = false;
|
设置值SeriesMenuItem.Visible = true;
|
}
|
else
|
{
|
删除此点SeriesMenuItem.Visible = true;
|
编辑此点SeriesMenuItem.Visible = true;
|
设置值SeriesMenuItem.Visible = false;
|
}
|
|
seriesRightMenu.Show(chartControl1, e.Location);
|
}
|
|
else if (hitInfo.InAxis)
|
{
|
_rightClickObj = hitInfo.Axis;
|
axisRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InConstantLine)
|
{
|
_rightClickObj = hitInfo.ConstantLine;
|
lineMenuStrip.Show(chartControl1, e.Location);
|
}
|
else
|
{
|
_rightClickObj = null;
|
chartRightMenu.Show(chartControl1, e.Location);
|
}
|
}
|
else if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
//if (_isDispRefConstantLineQ)
|
//{
|
// DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
// double refQ = coordPt.NumericalArgument;
|
// // FeatPoint ftPoint = new FeatPoint(coordPt.NumericalArgument, coordPt.NumericalValue);
|
//}
|
}
|
}
|
|
ToolTipController toolTipController1 = new ToolTipController();
|
private void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e)
|
{
|
if (SeriesQHcurve == e.Object)
|
{
|
toolTipController1.ShowHint("流量扬程曲线");
|
}
|
else if (SeriesQEcurve == e.Object)
|
{
|
toolTipController1.ShowHint("流量效率曲线");
|
}
|
else if (SeriesQPcurve == e.Object)
|
{
|
toolTipController1.ShowHint("流量功率曲线");
|
}
|
else if (RatedParasLine == e.Object)
|
{
|
if (_ratedParas == null)
|
return;
|
|
toolTipController1.ShowHint(ratedParasAnno);
|
}
|
else if (e.AdditionalObject is SeriesPoint)
|
{
|
SeriesPoint point = e.AdditionalObject as SeriesPoint;
|
if (point != null)
|
{
|
ChartHitInfo hitInfo = e.HitInfo;
|
string s = string.Format("{0} , {1}", point.Argument, point.Values[0]);
|
toolTipController1.ShowHint(s);
|
}
|
}
|
//else if (e.AdditionalObject is Series)
|
//{
|
// if (SeriesTestCurveQH == e.AdditionalObject)
|
// {
|
// toolTipController1.ShowHint("流量扬程曲线");
|
// }
|
//}
|
//else if (e.AdditionalObject is TextAnnotation)
|
//{
|
// if (e.AdditionalObject == TextAnnotationMaxE)
|
// {
|
// toolTipController1.ShowHint("aaaa");
|
// }
|
//}
|
else
|
{
|
toolTipController1.HideHint();
|
}
|
}
|
|
private void chartControl1_MouseClick(object sender, MouseEventArgs e)
|
{
|
//if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
//{
|
// chartRightMenu.Show(chartControl1, e.Location);
|
//}
|
//else if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
//{
|
// //if (_isDispRefConstantLineQ)
|
// //{
|
// // DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
// // double refQ = coordPt.NumericalArgument;
|
// // // FeatPoint ftPoint = new FeatPoint(coordPt.NumericalArgument, coordPt.NumericalValue);
|
// //}
|
//}
|
}
|
|
public class TagEventArgs : EventArgs
|
{
|
private object tag;
|
|
public TagEventArgs(object tag)
|
{
|
this.tag = tag;
|
}
|
|
public object GetTag()
|
{
|
return tag;
|
}
|
}
|
|
public delegate void TagEventHandler(object sender, TagEventArgs e);
|
|
public event TagEventHandler OnChangeWorkPt = null;
|
|
|
private void CalcWorkPtByQ_old(double refQ)
|
{
|
if (!isDispWorkPt)
|
return;
|
if (CurveInfoQH == null)
|
return;
|
|
|
if (refQ < _CurveMinQ || refQ > _CurveMaxQ)
|
return;
|
|
workPt.Q = refQ;
|
WorkParasLine.AxisValue = refQ;
|
|
StringBuilder builder = new StringBuilder();
|
|
builder.AppendLine("---工作点参数---");
|
builder.AppendFormat("流量:{0:N1}", workPt.Q);
|
|
workPt.H = Model.FitCurveHelper.GetFitPointY(CurveExprQH, refQ);
|
builder.AppendLine("");
|
if (_hIsPress)
|
{
|
builder.AppendFormat("压差:{0:N4}", workPt.H);
|
}
|
else
|
{
|
builder.AppendFormat("扬程:{0:N3}", workPt.H);
|
}
|
|
if (CurveInfoQE != null)
|
{
|
workPt.E = Model.FitCurveHelper.GetFitPointY(CurveExprQE, refQ);
|
builder.AppendLine("");
|
builder.AppendFormat("效率:{0:N1}", workPt.E);
|
}
|
|
if (CurveInfoQP != null)
|
{
|
workPt.P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, refQ);
|
builder.AppendLine("");
|
builder.AppendFormat("功率:{0:N1}", workPt.P);
|
}
|
|
TextAnnoWorkPoint.Visible = true;
|
TextAnnoWorkPoint.Text = builder.ToString();
|
}
|
|
private int? _calcuType = null;
|
|
public void SetCalcuType(int calcuType)
|
{
|
_calcuType = calcuType;
|
}
|
|
public void CalcWorkPtByQ()
|
{
|
if (workPt.Q > 100)
|
{
|
CalcWorkPtByQ(workPt.Q);
|
}
|
}
|
|
public void CalcWorkPtByQ(double refQ)
|
{
|
if (!isDispWorkPt)
|
return;
|
if (CurveInfoQH == null)
|
return;
|
if (workPt == null)
|
return;
|
|
if (refQ < _CurveMinQ || refQ > _CurveMaxQ)
|
return;
|
|
workPt.Q = refQ;
|
WorkParasLine.AxisValue = refQ;
|
|
StringBuilder builder = new StringBuilder();
|
builder.AppendLine("---工作点参数---");
|
|
workPt.H = Model.FitCurveHelper.GetFitPointY(CurveExprQH, workPt.Q);
|
var h = Math.Round(workPt.H, 2);
|
|
if (_calcuType.HasValue)
|
{
|
var calcuType = _calcuType.Value;
|
builder.AppendFormat("流量:{0:N1}", workPt.Q);
|
builder.AppendLine("");
|
if (_hIsPress)
|
{
|
builder.AppendFormat("压差:{0:N4}", workPt.H);
|
}
|
else
|
{
|
|
builder.AppendFormat("扬程:{0}", h);
|
}
|
|
if (calcuType == 0)
|
{
|
if (CurveInfoQE != null)
|
{
|
workPt.E = Model.FitCurveHelper.GetFitPointY(CurveExprQE, workPt.Q);
|
builder.AppendLine("");
|
builder.AppendFormat("效率:{0:N1}", workPt.E);
|
}
|
|
if (CurveInfoQP != null)
|
{
|
workPt.P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, workPt.Q);
|
builder.AppendLine("");
|
builder.AppendFormat("功率:{0:N1}", workPt.P);
|
}
|
}
|
else if (CurveInfoQE != null && CurveInfoQE != null)
|
{
|
|
if (calcuType == 1)
|
{
|
workPt.E = Model.FitCurveHelper.GetFitPointY(CurveExprQE, workPt.Q);
|
workPt.P = Model.CurveCalcuHelper.CalculateP(workPt.Q, h, workPt.E);
|
|
}
|
else
|
{
|
|
workPt.P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, workPt.Q);
|
workPt.E = Model.CurveCalcuHelper.CalculateE(workPt.Q, h, workPt.P);
|
}
|
|
builder.AppendLine("");
|
builder.AppendFormat("效率:{0:N1}", workPt.E);
|
|
builder.AppendLine("");
|
builder.AppendFormat("功率:{0:N1}", workPt.P);
|
}
|
|
}
|
else
|
{
|
builder.AppendFormat("流量:{0:N1}", workPt.Q);
|
builder.AppendLine("");
|
if (_hIsPress)
|
{
|
builder.AppendFormat("压差:{0:N4}", workPt.H);
|
}
|
else
|
{
|
builder.AppendFormat("扬程:{0}", h);
|
}
|
|
if (CurveInfoQE != null)
|
{
|
workPt.E = Model.FitCurveHelper.GetFitPointY(CurveExprQE, refQ);
|
builder.AppendLine("");
|
builder.AppendFormat("效率:{0:N1}", workPt.E);
|
}
|
|
if (CurveInfoQP != null)
|
{
|
workPt.P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, refQ);
|
builder.AppendLine("");
|
builder.AppendFormat("功率:{0:N1}", workPt.P);
|
}
|
}
|
|
TextAnnoWorkPoint.Visible = true;
|
TextAnnoWorkPoint.Text = builder.ToString();
|
}
|
|
private bool CalcWorkQByH(double wrkH, ref double wrkQ)
|
{
|
if (this.CurveInfoQH == null)
|
return false;
|
|
if (wrkH < _CurveMinH * 1.01 || wrkH > _CurveMaxH * 0.999)
|
return false;
|
|
List<Model.CurvePoint> intrPts = Model.FitCurveHelper.GetInterPointX(CurveExprQH, wrkH);
|
if (intrPts == null || intrPts.Count == 0)
|
{
|
return false;
|
}
|
else
|
{
|
wrkQ = intrPts.Last().X;
|
return true;
|
}
|
}
|
|
private void SetQHLineByWorkPt()
|
{
|
SeriesQHline.Visible = true;
|
SeriesQHline.Points.Clear();
|
if (CoordinateParas == null)
|
{
|
SeriesQHline.Points.Add(new SeriesPoint(0, workPt.H));
|
}
|
else
|
{
|
SeriesQHline.Points.Add(new SeriesPoint(CoordinateParas.CoordMinQ, workPt.H));
|
}
|
SeriesQHline.Points.Add(new SeriesPoint(workPt.Q, workPt.H));
|
}
|
|
bool isMoveWorkRefLine = false;
|
bool isMoveSeriesQHline = false;
|
private void chartControl1_MouseDown(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InConstantLine)
|
{
|
if (hitInfo.ConstantLine == WorkParasLine)
|
isMoveWorkRefLine = true;
|
}
|
else if (hitInfo.InSeries)
|
{
|
if (hitInfo.Series == SeriesQHline)
|
isMoveSeriesQHline = true;
|
}
|
else
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refQ = coordPt.NumericalArgument;
|
double refH = coordPt.NumericalValue;
|
|
}
|
}
|
|
//if (isRectSel)
|
//{//进行框选删除点
|
// Rectangle bounds = CalculateDiagramBounds();
|
// if (bounds.Contains(e.Location))
|
// {
|
// selCornerFirstPt = selCornerLastPt = e.Location;
|
// selRectangleIng = Rectangle.Empty;
|
// }
|
//}
|
}
|
|
private void chartControl1_MouseMove(object sender, MouseEventArgs e)
|
{
|
if (isMoveWorkRefLine)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refQ = coordPt.NumericalArgument;
|
CalcWorkPtByQ(refQ);
|
SetQHLineByWorkPt();
|
}
|
else if (isMoveSeriesQHline)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refH = coordPt.NumericalValue;
|
double refQ = 0;
|
if (CalcWorkQByH(refH, ref refQ))
|
{
|
CalcWorkPtByQ(refQ);
|
SetQHLineByWorkPt();
|
}
|
}
|
}
|
|
private void chartControl1_MouseUp(object sender, MouseEventArgs e)
|
{
|
if (isMoveWorkRefLine || isMoveSeriesQHline)
|
{
|
if (OnChangeWorkPt != null)
|
{
|
OnChangeWorkPt(this, new TagEventArgs(workPt));
|
}
|
}
|
|
isMoveWorkRefLine = false;
|
isMoveSeriesQHline = false;
|
//if (isRectSel)
|
//{
|
// isRectSel = false;
|
// #region 框选删除
|
// if (isRectSelDelPts)
|
// {//
|
// isRectSelDelPts = false;
|
|
// DiagramCoordinates firstCoordinate = theXYDiagram.PointToDiagram(selCornerFirstPt);
|
// DiagramCoordinates lastCoordinate = theXYDiagram.PointToDiagram(selCornerLastPt);
|
// if (firstCoordinate.IsEmpty || lastCoordinate.IsEmpty)
|
// return;
|
// PointF firstPoint = new PointF((float)firstCoordinate.NumericalArgument, (float)firstCoordinate.NumericalValue);
|
// PointF lastPoint = new PointF((float)lastCoordinate.NumericalArgument, (float)lastCoordinate.NumericalValue);
|
|
// //foreach (var pt in clickPointInfo)
|
// //{
|
// // if (pt.X < lastPoint.X && pt.X > firstPoint.X && pt.Y > lastPoint.Y && pt.Y < firstPoint.Y)
|
// // {
|
// // clickPointInfo.Remove(pt);
|
// // }
|
// //}
|
// for (int i = clickPointInfo.Count - 1; i >= 0; i--)
|
// {
|
// var pt = clickPointInfo[i];
|
// if (pt.X < lastPoint.X && pt.X > firstPoint.X && pt.Y > lastPoint.Y && pt.Y < firstPoint.Y)
|
// {
|
// clickPointInfo.Remove(pt);
|
// }
|
|
// }
|
|
// SeriesPoint.Points.Clear();
|
// foreach (var ftPoint in clickPointInfo)
|
// {
|
// SeriesPoint.Points.Add(new SeriesPoint(ftPoint.X, new double[] { ftPoint.Y }));
|
// }
|
// }
|
// #endregion
|
|
|
//}
|
//selCornerFirstPt = Point.Empty;
|
//selCornerLastPt = Point.Empty;
|
//selRectangleIng = Rectangle.Empty;
|
|
}
|
#endregion
|
|
#region 定位高效点
|
protected Model.CurvePoint ShowMaxEffPt()
|
{
|
if (SeriesQEcurve.Visible && CurveInfoQE != null && CurveInfoQE.Count > 3)
|
{
|
var maxE = Model.FitCurveHelper.GetMaxPoint(CurveExprQE);
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = TextAnnotationMaxE.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
paneAnchorPoint1.AxisXCoordinate.AxisValue = maxE.X.ToString();
|
paneAnchorPoint1.AxisYCoordinate.AxisValue = maxE.Y.ToString();
|
StringBuilder builder = new StringBuilder();
|
builder.AppendFormat("高效点 流量:{0:N1}; ", maxE.X);
|
double H = Model.FitCurveHelper.GetFitPointY(CurveExprQH, maxE.X);
|
|
if (_hIsPress)
|
{
|
builder.AppendFormat("压差:{0:N4}", H);
|
}
|
else
|
{
|
builder.AppendFormat("扬程:{0:N1}", H);
|
}
|
|
builder.AppendLine("");
|
builder.AppendFormat(" 效率:{0:N1}; ", maxE.Y);
|
|
if (CurveInfoQP != null)
|
{
|
double P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, maxE.X);
|
builder.AppendFormat("功率:{0:N1} ", P);
|
}
|
|
TextAnnotationMaxE.Visible = true;
|
TextAnnotationMaxE.Text = builder.ToString();
|
|
SetWorkPointQ(maxE.X);
|
return maxE;
|
}
|
return null;
|
}
|
|
private bool isDispMaxE = false;
|
|
private void 定位最高效率点MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispMaxE = !isDispMaxE;
|
if (isDispMaxE)
|
{
|
定位最高效率点MenuItem.Text = "不定位最高效率点";
|
ShowMaxEffPt();
|
|
定位最高流量点MenuItem.Text = "定位最高流量点";
|
isDispMaxH = false;
|
}
|
else
|
{
|
定位最高效率点MenuItem.Text = "定位最高效率点";
|
TextAnnotationMaxE.Visible = false;
|
}
|
}
|
|
|
#endregion
|
|
#region 定位最高流量点
|
|
private bool isDispMaxH = false;
|
private void 定位最高流量点MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispMaxH = !isDispMaxH;
|
if (isDispMaxH)
|
{
|
定位最高流量点MenuItem.Text = "不定位最高流量点";
|
ShowMaxQPoint();
|
|
定位最高效率点MenuItem.Text = "定位最高效率点";
|
isDispMaxE = false;
|
}
|
else
|
{
|
定位最高流量点MenuItem.Text = "定位最高流量点";
|
TextAnnotationMaxE.Visible = false;
|
}
|
}
|
|
protected Model.CurvePoint ShowMaxQPoint()
|
{
|
if (SeriesQEcurve.Visible && CurveExprQH != null && CurveInfoQH.Count > 3)
|
{
|
var maxQ = CurveInfoQH.OrderBy(x => x.X).Last();
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = TextAnnotationMaxE.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
paneAnchorPoint1.AxisXCoordinate.AxisValue = maxQ.X.ToString();
|
paneAnchorPoint1.AxisYCoordinate.AxisValue = maxQ.Y.ToString();
|
StringBuilder builder = new StringBuilder();
|
builder.AppendFormat("最大 流量:{0:N1}; ", maxQ.X);
|
double H = Model.FitCurveHelper.GetFitPointY(CurveExprQH, maxQ.X);
|
|
if (_hIsPress)
|
{
|
builder.AppendFormat("压差:{0:N4}", H);
|
}
|
else
|
{
|
builder.AppendFormat("扬程:{0:N1}", H);
|
}
|
|
builder.AppendLine("");
|
builder.AppendFormat(" 效率:{0:N1}; ", maxQ.Y);
|
|
if (CurveInfoQP != null)
|
{
|
double P = Model.FitCurveHelper.GetFitPointY(CurveExprQP, maxQ.X);
|
builder.AppendFormat("功率:{0:N1} ", P);
|
}
|
|
TextAnnotationMaxE.Visible = true;
|
TextAnnotationMaxE.Text = builder.ToString();
|
|
SetWorkPointQ(maxQ.X);
|
return maxQ;
|
}
|
return null;
|
}
|
#endregion
|
|
|
#region 压差曲线还是扬程曲线
|
private bool _hIsPress = false;//H表示是false扬程还是true压差
|
public bool HIsPress { get { return _hIsPress; } }
|
public TagEventHandler OnChangeAxisTypeH = null;
|
private void 转化为压差曲线MenuItem_Click(object sender, EventArgs e)
|
{
|
_hIsPress = !_hIsPress;
|
|
if (OnChangeAxisTypeH != null)
|
{
|
if (_hIsPress)
|
{
|
_unitH = Unit.eUnitH.MPa;
|
XtraChartHelper.SetAxisName(QHAxisY, "压差", _unitH);
|
}
|
else
|
{
|
_unitH = Unit.eUnitH.M;
|
XtraChartHelper.SetAxisName(QHAxisY, "扬程", _unitH);
|
}
|
OnChangeAxisTypeH(this, new TagEventArgs(_hIsPress));
|
}
|
}
|
#endregion
|
|
#region 装置曲线
|
//EquipCurveParas _equipmentCurveParas = null;
|
//bool isDispEquipmentCurve = false;
|
private void 设置装置曲线MenuItem_Click(object sender, EventArgs e)
|
{
|
SetEquipmentCurve();
|
}
|
private void 显示装置曲线MenuItem_Click(object sender, EventArgs e)
|
{
|
/* if (_equipmentCurveParas == null)
|
{
|
SetEquipmentCurve();
|
}
|
else
|
{
|
显示装置曲线MenuItem.Checked = !显示装置曲线MenuItem.Checked;
|
isDispEquipmentCurve = 显示装置曲线MenuItem.Checked;
|
TextAnnotationEquip.Visible = isDispEquipmentCurve;
|
设置装置曲线MenuItem.Visible = isDispEquipmentCurve;
|
chartControl1.Refresh();
|
}*/
|
}
|
|
|
|
public void SetEquipmentCurve()
|
{
|
//SetEquipmentCurveDlg theDlg = new SetEquipmentCurveDlg();
|
//if (_equipmentCurveParas != null)
|
//{
|
// theDlg.SetEquipmentCurve(_equipmentCurveParas);
|
//}
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// _equipmentCurveParas = theDlg.GetEquipmentCurve();
|
// if (!isDispEquipmentCurve)
|
// {
|
// 显示装置曲线MenuItem.Checked = true;
|
// 设置装置曲线MenuItem.Visible = true;
|
// isDispEquipmentCurve = true;
|
// }
|
|
// TextAnnotationEquip.Visible = true;
|
// DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = TextAnnotationEquip.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
// paneAnchorPoint1.AxisXCoordinate.AxisValue = _equipmentCurveParas.CurveInfo[2].X.ToString();
|
// paneAnchorPoint1.AxisYCoordinate.AxisValue = _equipmentCurveParas.CurveInfo[2].Y.ToString();
|
// chartControl1.Refresh();
|
//}
|
}
|
|
public void ClearEquipmentCurve()
|
{
|
//_equipmentCurveParas = null;
|
chartControl1.Refresh();
|
TextAnnotationEquip.Visible = false;
|
}
|
|
|
|
|
#endregion
|
|
#region 延长曲线
|
//public event EventHandler OnExtendCurve = null;
|
private void 延长曲线Item_Click(object sender, EventArgs e)
|
{
|
//if (_groupPoints == null || _groupPoints.Count < 4)
|
// return;
|
|
//var testPointMaxQ = (from x in _groupPoints select x.Q).Max();
|
//SetCurveExtendParasDlg theDlg = new SetCurveExtendParasDlg();
|
//theDlg.MaxQ = Convert.ToDecimal(Math.Round(_CurveMaxQ, 0));
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// double extendRatio = Convert.ToDouble(theDlg.MaxQ) / testPointMaxQ;
|
|
// List<Model.CurvePoint> PointInfoQH = new List<Model.CurvePoint>();
|
// List<Model.CurvePoint> PointInfoQE = new List<Model.CurvePoint>();
|
// List<Model.CurvePoint> PointInfoQP = new List<Model.CurvePoint>();
|
|
// foreach ( Model.GroupPoint pt in _groupPoints)
|
// {
|
// PointInfoQH.Add(new Model.CurvePoint(pt.Q, pt.H));
|
// PointInfoQE.Add(new Model.CurvePoint(pt.Q, pt.E));
|
// PointInfoQP.Add(new Model.CurvePoint(pt.Q, pt.P));
|
// }
|
|
// this.CurveInfoQH = Model.FitCurveHelper.GetFitPointsByExtend(PointInfoQH, extendRatio);
|
// this.CurveInfoQE = Model.FitCurveHelper.GetFitPointsByExtend(PointInfoQE, extendRatio);
|
// this.CurveInfoQP = Model.FitCurveHelper.GetFitPointsByExtend(PointInfoQP, extendRatio);
|
// this.CurveExprQH = CurveExpressConver.ToParameter(this.CurveInfoQH);
|
|
// _CurveMinQ = (from x in this.CurveInfoQH select x.X).Min();
|
// _CurveMaxQ = (from x in this.CurveInfoQH select x.X).Max();
|
// _CurveMinH = (from x in this.CurveInfoQH select x.Y).Min();
|
// _CurveMaxH = (from x in this.CurveInfoQH select x.Y).Max();
|
|
// UpdateChart(false);
|
|
// if (OnExtendCurve != null)
|
// OnExtendCurve(this, e);
|
//}
|
}
|
#endregion
|
|
|
private void MenuItem导出曲线上的点12个点_Click(object sender, EventArgs e)
|
{
|
ExportToXLS.Export(this.CurveExprQH, this.CurveExprQE, this.CurveExprQP, 12);
|
}
|
|
|
/// <summary>
|
/// 导出Excel
|
/// </summary>
|
public void ExportExcel()
|
{
|
IStation.WinFrmUI.Curve.ExportToXLS.Export(this.CurveExprQH, this.CurveExprQE, this.CurveExprQP, 12);
|
}
|
|
|
}
|
}
|