using Yw.WinFrmUI.Phart;
namespace HStation.WinFrmUI
{
public partial class UniversalChartExcelImportCtrl : DevExpress.XtraEditors.XtraUserControl
{
public UniversalChartExcelImportCtrl()
{
InitializeComponent();
}
private Yw.Ahart.eCurveType _curve_type;
///
/// 绑定数据
///
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 list);
if (!string.IsNullOrEmpty(err_msg))
{
XtraMessageBox.Show(err_msg);
return;
}
this.universalChartExcelEditCtrl.SetBindingData(curve_type, list);
}
///
/// 获取
///
public Yw.Vmo.PhartDiagramExGraphListVmo Get()
{
if (!this.universalChartExcelEditCtrl.Get(out Yw.Ahart.eFeatType feat_type, out List 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()
{
new ()
{
GraphType =(int) _curve_type,
GeometryParas= geometry_paras.ToJson(),
GeometryStyle = (int) HStation.PhartRelation.eGeometryStyle.FeatCurve,
GeometryInfo = ds_stirng
}
};
return vmo;
}
}
}