lixiaojun
2024-09-20 abbe29e54421c136aa6eb4ef11935c70d818101a
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs
@@ -14,28 +14,38 @@
        /// </summary>
        public event Action<string> ClickParterEvent;
        private long _projectId;//项目id
        private HStation.Vmo.XhsProjectVmo _project = null;
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async void SetBindingData(long projectId)
        public async Task SetBindingData(HStation.Vmo.XhsProjectVmo project, HStation.Vmo.XhsProjectSiteVmo projectSite)
        {
            _projectId = projectId;
            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();
        }
        //页面加载完成后触发
        private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
        {
            var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_projectId);
            if (projectSite == null)
            if (_projectSite == null)
            {
                return;
            }
            var relation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
                .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, HStation.Xhs.Purpose.Simulation);
                .GetDefaultByObjectTypeAndObjectIDOfPurpose
                    (HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
            if (relation == null)
            {
                return;
@@ -65,20 +75,40 @@
            this.ClickParterEvent?.Invoke(obj.ObjectId);
        }
        public async Task HideComponents(List<string> elementIds)
        {
            await this.bimfaceInterop3dContainer1.HideComponents(elementIds);
        }
        #region 构件的显示与隐藏
        /// <summary>
        /// 显示构件
        /// </summary>
        /// <param name="elementIds">构件id列表</param>
        /// <returns></returns>
        public async Task ShowComponents(List<string> elementIds)
        {
            await this.bimfaceInterop3dContainer1.ShowComponents(elementIds);
        }
        /// <summary>
        /// 隐藏构件
        /// </summary>
        /// <param name="elementIds">构件id列表</param>
        /// <returns></returns>
        public async Task HideComponents(List<string> elementIds)
        {
            await this.bimfaceInterop3dContainer1.HideComponents(elementIds);
        }
        /// <summary>
        /// 显示所有构件
        /// </summary>
        /// <returns></returns>
        public async Task ShowAllComponents()
        {
            await this.bimfaceInterop3dContainer1.ShowAllComponents();
        }
        #endregion
        #region 构件的半透明与取消
        /// <summary>
        /// 半透明构件
@@ -100,5 +130,50 @@
            await this.bimfaceInterop3dContainer1.OpaqueComponents(elementIds);
        }
        #endregion
        #region 构件的选中与取消
        /// <summary>
        /// 设置选择的构件
        /// </summary>
        /// <returns></returns>
        public async Task SetSelectedComponents(List<string> elements)
        {
            await this.bimfaceInterop3dContainer1.SetSelectedComponents(elements);
        }
        /// <summary>
        /// 增加选择的构件
        /// </summary>
        /// <param name="elements"></param>
        /// <returns></returns>
        public async Task AddSelectedComponents(List<string> elements)
        {
            await this.bimfaceInterop3dContainer1.AddSelectedComponents(elements);
        }
        /// <summary>
        /// 移除选择的构件
        /// </summary>
        /// <param name="elements"></param>
        /// <returns></returns>
        public async Task RemoveSelectedComponents(List<string> elements)
        {
            await this.bimfaceInterop3dContainer1.RemoveSelectedComponents(elements);
        }
        /// <summary>
        /// 清除选择的构件
        /// </summary>
        /// <param name="elements"></param>
        /// <returns></returns>
        public async Task ClearSelectedComponents()
        {
            await this.bimfaceInterop3dContainer1.ClearSelectedComponents();
        }
        #endregion
    }
}