Shuxia Ning
2024-12-20 1bf6b7a300e21e9b8996f9ebeeb55a1eccda7a02
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/02-universal/03-import/01-excel/UniversalChartExcelImportCtrl.cs
@@ -1,4 +1,6 @@
namespace HStation.WinFrmUI
using Yw.WinFrmUI.Phart;
namespace HStation.WinFrmUI
{
    public partial class UniversalChartExcelImportCtrl : DevExpress.XtraEditors.XtraUserControl
    {
@@ -8,12 +10,20 @@
        }
        private Yw.Ahart.eCurveType _curve_type;
        /// <summary>
        /// 绑定数据
        /// </summary>  
        public void SetBindingData(string file_path, Yw.Ahart.eCurveType curve_type)
        {
            _curve_type = curve_type;
            var err_msg = Yw.WinFrmUI.PhartExcelHelper.ParseUniversalExcel(file_path, out List<Yw.Geometry.Point2d> list);
            if (!string.IsNullOrEmpty(err_msg))
            {
                XtraMessageBox.Show(err_msg);
                return;
            }
            this.universalChartExcelEditCtrl.SetBindingData(curve_type, list);
        }
@@ -22,8 +32,29 @@
        /// </summary> 
        public Yw.Vmo.PhartDiagramExGraphListVmo Get()
        {
            return new ();
        }
            if (!this.universalChartExcelEditCtrl.Get(out Yw.Ahart.eFeatType feat_type, out List<Yw.Geometry.Point2d> pt_list))
                return default;
            var ds_stirng = pt_list.ToDbString(_curve_type, feat_type);
            if (string.IsNullOrEmpty(ds_stirng))
                return default;
            var geometry_paras = new HStation.Model.FeatCurveGeometryParasModel();
            geometry_paras.DefinePoints = pt_list;
            var vmo = new Yw.Vmo.PhartDiagramExGraphListVmo();
            vmo.DiagramType = (int)HStation.PhartRelation.eDiagramType.Feat;
            vmo.GraphList = new List<Yw.Vmo.PhartGraphVmo>()
            {
                new ()
                {
                      GraphType =(int) _curve_type,
                      GeometryParas= geometry_paras.ToJson(),
                      GeometryStyle = (int) HStation.PhartRelation.eGeometryStyle.FeatCurve,
                      GeometryInfo = ds_stirng
                }
            };
            return vmo;
        }
    }