From a8e54743e599fa42d627cc97ab1468937e719c04 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期二, 15 十月 2024 14:19:08 +0800 Subject: [PATCH] 曲线 --- WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/02-chart/Perform2dExportHelper.cs | 54 +++++++++++++++++++++++++++--------------------------- 1 files changed, 27 insertions(+), 27 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/02-chart/Perform2dExportHelper.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/02-chart/Perform2dExportHelper.cs index 0f903f8..40a379e 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/02-chart/Perform2dExportHelper.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/02-chart/Perform2dExportHelper.cs @@ -12,11 +12,11 @@ /// <summary> /// 瀵煎嚭 /// </summary> - public static void ExportXLS(Yw.Geometry.CubicSpline2d cubic_spline_qh, Yw.Geometry.CubicSpline2d cubic_spline_qe, Yw.Geometry.CubicSpline2d cubic_spline_qp, int fitPointNum = 15) + public static void ExportXLS(Yw.Geometry.CubicSpline2d qh, Yw.Geometry.CubicSpline2d qe, Yw.Geometry.CubicSpline2d qp, int fitPointNum = 15) { try { - if (cubic_spline_qh == null) + if (qh == null) return; var dlg = new SaveFileDialog(); @@ -35,8 +35,8 @@ //鍧囧寑鎻掑�肩偣,璁$畻鐐瑰潗鏍� - double minQ = cubic_spline_qh.MinX; - double maxQ = cubic_spline_qh.MaxX; + double minQ = qh.MinX; + double maxQ = qh.MaxX; double space = (maxQ - minQ) / (fitPointNum - 1); double Q = minQ; double H, E, P; @@ -48,32 +48,32 @@ row.CreateCell(col).SetCellValue(Trans(Q)); col++; - H = cubic_spline_qh.GetPointY(Q); + H = qh.GetPointY(Q); row.CreateCell(col).SetCellValue(Trans(H)); col++; - if (cubic_spline_qe != null && Q <= cubic_spline_qe.MaxX && Q >= cubic_spline_qe.MinX) + if (qe != null && Q <= qe.MaxX && Q >= qe.MinX) { if (Q < 0.1) E = 0; else - E = cubic_spline_qe.GetPointY(Q); + E = qe.GetPointY(Q); row.CreateCell(col).SetCellValue(Trans(E)); col++; } - if (cubic_spline_qp != null && Q <= cubic_spline_qp.MaxX && Q >= cubic_spline_qp.MinX) + if (qp != null && Q <= qp.MaxX && Q >= qp.MinX) { - P = cubic_spline_qp.GetPointY(Q); + P = qp.GetPointY(Q); row.CreateCell(col).SetCellValue(Trans(P)); col++; } Q = Q + space; - if (Q > cubic_spline_qh.MaxX * 0.9999) - Q = cubic_spline_qh.MaxX * 0.9999; + if (Q > qh.MaxX * 0.9999) + Q = qh.MaxX * 0.9999; } //寮哄埗Excel鍦ㄦ墦寮�鏃堕噸鏂拌绠楁墍鏈夊叕寮� @@ -94,11 +94,11 @@ /// <summary> /// 瀵煎嚭瀹氫箟鐐� /// </summary> - public static void ExportDefinePoints(List<Yw.Geometry.Point2d> cubic_spline_qh, List<Yw.Geometry.Point2d> cubic_spline_qe, List<Yw.Geometry.Point2d> cubic_spline_qp, int fitPointNum = 15) + public static void ExportDefinePoints(List<Yw.Geometry.Point2d> qh, List<Yw.Geometry.Point2d> qe, List<Yw.Geometry.Point2d> qp, int fitPointNum = 15) { try { - if (cubic_spline_qh == null) + if (qh == null) return; var dlg = new SaveFileDialog(); @@ -116,53 +116,53 @@ rowTile.CreateCell(2).SetCellValue("鏁堢巼"); rowTile.CreateCell(3).SetCellValue("鍔熺巼"); - List<Yw.Geometry.Point2d> pt_qh_list = null, pt_qe_list = null, pt_qp_list = null; + List<Yw.Geometry.Point2d> qh_pt_list = null, qe_pt_list = null, qp_pt_list = null; - pt_qh_list = cubic_spline_qh; + qh_pt_list = qh; - if (pt_qh_list == null || pt_qh_list.Count < 4) + if (qh_pt_list == null || qh_pt_list.Count < 4) return; - pt_qe_list = cubic_spline_qe; - pt_qp_list = cubic_spline_qp; + qe_pt_list = qe; + qp_pt_list = qp; //鍧囧寑鎻掑�肩偣,璁$畻鐐瑰潗鏍� - double minQ = cubic_spline_qh.Min()?.X ?? 0; - double maxQ = cubic_spline_qh.Max()?.X ?? 0; + double minQ = qh.Min()?.X ?? 0; + double maxQ = qh.Max()?.X ?? 0; double space = (maxQ - minQ) / (fitPointNum - 1); double Q = 0; double H, E = 0, P = 0; int rowIndex = 1; - foreach (var pointQH in pt_qh_list) + foreach (var pointQH in qh_pt_list) { Q = pointQH.X; H = pointQH.Y; - if (pt_qe_list != null && pt_qe_list.Count > 0) + if (qe_pt_list != null && qe_pt_list.Count > 0) { - var pointQE = pt_qe_list.Find(x => x.X == Q); + var pointQE = qe_pt_list.Find(x => x.X == Q); if (pointQE != null) { E = pointQE.Y; } else { - E = pt_qe_list.GetPointIndexByX(Q); + E = qe_pt_list.GetPointIndexByX(Q); } } - if (pt_qp_list != null && pt_qp_list.Count > 0) + if (qp_pt_list != null && qp_pt_list.Count > 0) { - var pointQP = pt_qp_list.Find(x => x.X == Q); + var pointQP = qp_pt_list.Find(x => x.X == Q); if (pointQP != null) { P = pointQP.Y; } else { - P = cubic_spline_qp.GetPointIndexByX(Q); + P = qp.GetPointIndexByX(Q); } } -- Gitblit v1.9.3