duheng
2024-10-14 3b08b5c772ffc0c10644c1aaa9f7b2447582c858
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
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationBimfaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public XhsProjectSimulationBimfaceInfoCtrl()
        {
            InitializeComponent();
            this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
        }
 
        private HStation.Vmo.XhsProjectVmo _project = null;//项目
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Vmo.BimfaceFileRelationVmo _bimfaceFileRelation = null;//bimface关联
        private Yw.Vmo.BimfaceFileVmo _bimfaceFile = null;//bimface文件
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData(XhsProjectVmo project, XhsProjectSiteVmo projectSite)
        {
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            await this.bimfaceInterop3dContainer1.InitialContainer();
        }
 
        /// <summary>
        /// 页面加载完成后触发
        /// </summary>
        private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
        {
            if (_project == null)
            {
                return;
            }
            if (_projectSite == null)
            {
                return;
            }
 
            _bimfaceFileRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
                .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
            if (_bimfaceFileRelation == null)
            {
                return;
            }
 
            _bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(_bimfaceFileRelation.BimfaceFileID);
            if (_bimfaceFile == null)
            {
                return;
            }
 
            var viewToken = await BimfaceHelper.GetViewToken(_bimfaceFile.BimfaceId);
            if (string.IsNullOrEmpty(viewToken))
            {
                return;
            }
            await this.bimfaceInterop3dContainer1.LoadView(viewToken);
 
        }
 
    }
}