11
Shuxia Ning
2024-11-08 7ae4a1016ac49599caa7dacb2c3256e9744175c4
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
104
105
106
107
using DevExpress.XtraBars;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace HStation.WinFrmUI
{
    public partial class AddXhsSchemeDlg : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public AddXhsSchemeDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.ribbon.SetFormStyle();
 
        }
 
 
        private HStation.Vmo.XhsProjectVmo _project = null;//项目
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData
            (
                HStation.Vmo.XhsProjectVmo project,
                HStation.Vmo.XhsProjectSiteVmo projectSite,
                Yw.Model.HydroModelInfo hydroInfo
            )
        {
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            _hydroInfo = hydroInfo;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            if (_hydroInfo == null)
            {
                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
            }
 
            ShowBimfaceCtrl();
        }
 
        #region Bimface
 
        //bimface控件
        private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null;
 
        //获取 bimface 控件
        private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl()
        {
            if (_bimfaceCtrl == null)
            {
                _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
                _bimfaceCtrl.Dock = DockStyle.Fill;
                await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo);
                _bimfaceCtrl.LoadCompletedEvent += () =>
                {
                    //view加载完成事件
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                };
                _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) =>
                {//鼠标左键点击事件
                    if (_hydroInfo == null)
                    {
                        return;
                    } 
                };
            }
            return _bimfaceCtrl;
        }
 
        //显示 bimface 控件
        private async void ShowBimfaceCtrl()
        {
            var bimfaceCtrl = await GetBimfaceCtrl();
            this.sidePanel3dModel.Controls.Clear();
            this.sidePanel3dModel.Controls.Add(bimfaceCtrl);
        }
 
        private void SelectBimfaceParter()
        {
 
        }
 
        #endregion
    }
}