lixiaojun
2024-09-27 1e5868571fdeb64bead897396ed38b44eda1bcaa
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs
@@ -10,29 +10,35 @@
        {
            InitializeComponent();
            this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
            this.bimfaceInterop3dContainer1.LoadViewCompletedEvent += BimfaceInterop3dContainer1_LoadViewCompletedEvent;
            this.bimfaceInterop3dContainer1.ClickInEvent += BimfaceInterop3dContainer1_ClickInEvent;
            this.bimfaceInterop3dContainer1.ClickOutEvent += BimfaceInterop3dContainer1_ClickOutEvent;
        }
        /// <summary>
        /// 点击组件事件
        /// 水力点击事件
        /// </summary>
        public event Action<string> ClickParterEvent;
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
        /// <summary>
        /// 获取水力信息事件
        /// 加载完成事件
        /// </summary>
        public event Func<Yw.Model.HydroModelInfo> GetHydroInfoEvent;
        public event Action LoadCompletedEvent;
        private HStation.Vmo.XhsProjectVmo _project = null;
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;
        private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc = null;
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData(HStation.Vmo.XhsProjectVmo project, HStation.Vmo.XhsProjectSiteVmo projectSite)
        public async Task SetBindingData
            (
                HStation.Vmo.XhsProjectVmo project,
                HStation.Vmo.XhsProjectSiteVmo projectSite,
                Func<Yw.Model.HydroModelInfo> hydroInfoFunc
            )
        {
            if (project == null)
            {
@@ -40,6 +46,7 @@
            }
            _project = project;
            _projectSite = projectSite;
            _hydroInfoFunc = hydroInfoFunc;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
@@ -77,15 +84,38 @@
            await this.bimfaceInterop3dContainer1.LoadView(viewToken);
        }
        //构件点击
        //页面视图加载完成后触发
        private void BimfaceInterop3dContainer1_LoadViewCompletedEvent()
        {
            this.LoadCompletedEvent?.Invoke();
        }
        //内部点击
        private void BimfaceInterop3dContainer1_ClickInEvent(Yw.WinFrmUI.Bimface.ClickIn3dInfo obj)
        {
            if (obj == null)
            {
                return;
            }
            this.ClickParterEvent?.Invoke(obj.ObjectId);
            if (HydroClickEvent != null)
            {
                var hydroInfo = _hydroInfoFunc?.Invoke();
                if (hydroInfo == null)
                {
                    return;
                }
                var allParterList = hydroInfo.GetAllParters();
                var parter = allParterList?.Find(x => x.Code == obj.ObjectId);
                this.HydroClickEvent.Invoke(parter);
            }
        }
        //外部点击
        private void BimfaceInterop3dContainer1_ClickOutEvent(ClickOut3dInfo obj)
        {
            this.HydroClickEvent?.Invoke(null);
        }
        #region 构件的显示与隐藏
@@ -278,7 +308,6 @@
        #region 业务
        #region 连接构件颜色
        private const string _linkComponentColor = "#008B00";
@@ -336,7 +365,7 @@
        /// </summary>
        public async Task ShowCalcuCustomLabels(CalcuResult calcuResult)
        {
            var hydroInfo = GetHydroInfoEvent?.Invoke();
            var hydroInfo = _hydroInfoFunc?.Invoke();
            if (hydroInfo == null)
            {
                return;