duheng
2024-12-20 0a7989934b6d561e32ae61d3af16cbf773074da2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using HStation.WinFrmUI.PhartRelation;
 
namespace HStation.WinFrmUI.Xhs
{
    public partial class ValveChartShowDlg : DevExpress.XtraEditors.XtraForm
    {
        public ValveChartShowDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
        }
 
        public async void SetBingingData(long MainID)
        {
            var model = await new BLL.AssetsValveMain().GetByID(MainID);
            if (model == null)
                return;
            var curveList = await new BLL.AssetsValveFactor().GetByMainID(MainID);
            if (model.ValveType == HStation.Assets.eValveType.GPV)
            {
                if (curveList != null && curveList.Count > 0)
                {
                    InitChart(curveList.First().MinorLossCurve, false);
                }
            }
            else if (model.ValveType == HStation.Assets.eValveType.TCV)
            {
                if (curveList != null && curveList.Count > 0)
                {
                    InitChart(curveList.First().OpenLossCurve, true);
                }
            }
        }
 
        //初始化图表数据
        public void InitChart(Vmo.PhartDiagramRelationExtensionsVmo dto)
        {
            /*    if (dto == null)
                {
                    return;
                }
                var diagram = dto.Diagram;
                if (diagram == null)
                {
                    return;
                }
                var graph_list = diagram.GraphList;
                if (graph_list == null || !graph_list.Any())
                {
                    return;
                }
 
                var graph_ql = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.QL);
                var graph_ol = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.OL);
                if (graph_ql == null && graph_ol == null)
                {
                    return;
                }
 
                List<Yw.Geometry.Point2d> points_ql = null;
                if (graph_ql != null)
                    points_ql = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 12, null);
 
                List<Yw.Geometry.Point2d> points_ol = null;
                if (graph_ol != null)
                    points_ol = PhartPerformCurveHelper.GetFeatPointList(graph_ol.GraphType, graph_ol.GeometryInfo, 12, null);
                Yw.Geometry.CubicSpline2d cubic_spline = null;
                if (points_ql != null)
                {
                    cubic_spline = new Yw.Geometry.CubicSpline2d(points_ql);
                }
                if (points_ol != null)
                {
                    cubic_spline = new Yw.Geometry.CubicSpline2d(points_ol);
                }
                var disp_paras = diagram.DispParas;
                var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
                this.xtrPerform2dchart1.SetBindingData(cubic_spline.ToDbString(), disp_paras, is_calc_disp_paras);
                if (graph_ol != null)
                {
                    this.xtrPerform2dchart1.SetAxisTitle("阀门开度", "损失系数");
                }
                else
                {
                    this.xtrPerform2dchart1.SetAxisTitle("流量(m³/h)", "水损/m");
                }*/
        }
 
        //初始化图表数据
        public void InitChart(string curveStr, bool isopen)
        {
            /*    this.xtrPerform2dchart1.SetBindingData(curveStr, null);
                if (isopen)
                {
                    this.xtrPerform2dchart1.SetAxisTitle("阀门开度", "损失系数");
                }
                else
                {
                    this.xtrPerform2dchart1.SetAxisTitle("流量", "损失系数");
                }*/
        }
    }
}