namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectSimulationBimfaceCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectSimulationBimfaceCtrl()
|
{
|
InitializeComponent();
|
this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
|
this.bimfaceInterop3dContainer1.ClickInEvent += BimfaceInterop3dContainer1_ClickInEvent;
|
}
|
|
/// <summary>
|
/// 点击组件事件
|
/// </summary>
|
public event Action<string> ClickParterEvent;
|
|
private HStation.Vmo.XhsProjectVmo _project = null;
|
private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public async Task SetBindingData(HStation.Vmo.XhsProjectVmo project, HStation.Vmo.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();
|
}
|
|
//页面加载完成后触发
|
private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
|
{
|
if (_projectSite == null)
|
{
|
return;
|
}
|
|
var relation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
|
.GetDefaultByObjectTypeAndObjectIDOfPurpose
|
(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
|
if (relation == null)
|
{
|
return;
|
}
|
|
var bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(relation.BimfaceFileID);
|
if (bimfaceFile == null)
|
{
|
return;
|
}
|
|
var viewToken = await BimfaceHelper.GetViewToken(bimfaceFile.BimfaceId);
|
if (string.IsNullOrEmpty(viewToken))
|
{
|
return;
|
}
|
await this.bimfaceInterop3dContainer1.LoadView(viewToken);
|
}
|
|
//构件点击
|
private void BimfaceInterop3dContainer1_ClickInEvent(Yw.WinFrmUI.Bimface.ClickIn3dInfo obj)
|
{
|
if (obj == null)
|
{
|
return;
|
}
|
this.ClickParterEvent?.Invoke(obj.ObjectId);
|
}
|
|
/// <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();
|
}
|
|
/// <summary>
|
/// 半透明构件
|
/// </summary>
|
/// <param name="elementIds">构件id列表</param>
|
/// <returns></returns>
|
public async Task TranslucentComponents(List<string> elementIds)
|
{
|
await this.bimfaceInterop3dContainer1.TranslucentComponents(elementIds);
|
}
|
|
/// <summary>
|
/// 取消构件半透明
|
/// </summary>
|
/// <param name="elementIds">构件id列表</param>
|
/// <returns></returns>
|
public async Task OpaqueComponents(List<string> elementIds)
|
{
|
await this.bimfaceInterop3dContainer1.OpaqueComponents(elementIds);
|
}
|
|
}
|
}
|