From f04e6ed843d66c22e08132ca23d2193d6800905c Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期四, 26 九月 2024 11:51:19 +0800 Subject: [PATCH] 增加窗体图标 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs | 306 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 295 insertions(+), 11 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs index a5856e1..9661642 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs @@ -1,4 +1,8 @@ -锘縩amespace HStation.WinFrmUI +锘縰sing DevExpress.Office.Utils; +using DevExpress.Xpo.Helpers; +using Yw.WinFrmUI.Bimface; + +namespace HStation.WinFrmUI { public partial class XhsProjectSimulationBimfaceCtrl : DevExpress.XtraEditors.XtraUserControl { @@ -14,28 +18,46 @@ /// </summary> public event Action<string> ClickParterEvent; - private long _projectId;//椤圭洰id + /// <summary> + /// 鑾峰彇姘村姏淇℃伅浜嬩欢 + /// </summary> + public event Func<Yw.Model.HydroModelInfo> GetHydroInfoEvent; + + 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 +87,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 +142,247 @@ 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 + + #region 缂╂斁 + + /// <summary> + /// 缂╂斁鑷虫瀯浠� + /// </summary> + public async Task ZoomToComponent(string elementId) + { + await this.bimfaceInterop3dContainer1.ZoomToComponent(elementId); + } + + /// <summary> + /// 缂╂斁鑷抽�夋嫨鏋勪欢 + /// </summary> + public async Task ZoomToSelectedComponents() + { + await this.bimfaceInterop3dContainer1.ZoomToSelectedComponents(); + } + + /// <summary> + /// 缂╂斁鑷抽�夋嫨鏋勪欢 + /// </summary> + public async Task ZoomAndSelectComponents(List<string> elementIds) + { + await this.bimfaceInterop3dContainer1.ZoomAndSelectComponents(elementIds); + } + + #endregion + + #region 寮鸿皟鏋勪欢 + + /// <summary> + /// 璁剧疆寮鸿皟鏋勪欢 + /// </summary> + public async Task SetBlinkComponents(List<string> elementIds, string color, double transparency) + { + await this.bimfaceInterop3dContainer1.SetBlinkComponents(elementIds, color, transparency); + } + + /// <summary> + /// 娓呴櫎寮鸿皟鏋勪欢 + /// </summary> + public async Task SetBlinkComponents() + { + await this.bimfaceInterop3dContainer1.ClearBlinkComponents(); + } + + #endregion + + #region 鏋勪欢鐫�鑹� + + /// <summary> + /// 璁剧疆寮鸿皟鏋勪欢 + /// </summary> + public async Task OverrideComponentsColor(List<string> elementIds, string color, double transparency) + { + await this.bimfaceInterop3dContainer1.OverrideComponentsColor(elementIds, color, transparency); + } + + /// <summary> + /// 鎭㈠鏋勪欢棰滆壊 + /// </summary> + public async Task SetBlinkComponents(List<string> elementIds) + { + await this.bimfaceInterop3dContainer1.RestoreComponentsColor(elementIds); + } + + #endregion + + #region 鑷畾涔夋爣绛� + + /// <summary> + /// 璁剧疆鑷畾涔夋爣绛� + /// </summary> + public async Task SetCustomLabels(List<CustomLabel> obj) + { + await this.bimfaceInterop3dContainer1.SetCustomLabels(obj); + } + + /// <summary> + /// 娓呴櫎鑷畾涔夋爣绛� + /// </summary> + public async Task ClearCustomLabels() + { + await this.bimfaceInterop3dContainer1.ClearCustomLabels(); + } + + + #endregion + + #region 涓氬姟 + + + #region 杩炴帴鏋勪欢棰滆壊 + + private const string _linkComponentColor = "#008B00"; + private const double _linkComponentTransparency = 0.8; + private List<string> _linkComponentIds = null;//杩炴帴鏋勪欢id鍒楄〃 + + /// <summary> + /// 璁剧疆杩炴帴鏋勪欢棰滆壊 + /// </summary> + public async Task SetLinkComponentsColor(List<string> elementIds) + { + if (_linkComponentIds != null && _linkComponentIds.Count > 0) + { + await this.bimfaceInterop3dContainer1.RestoreComponentsColor(_linkComponentIds); + } + _linkComponentIds = elementIds; + if (elementIds == null || elementIds.Count < 1) + { + return; + } + await this.bimfaceInterop3dContainer1.OverrideComponentsColor(elementIds, _linkComponentColor, _linkComponentTransparency); + } + + #endregion + + #region 璁剧疆Open鏋勪欢棰滆壊 + + private const string _openComponentColor = "#2E8B57"; + private const double _openComponentTransparency = 0.8; + private List<string> _openComponentIds = null;//Open鏋勪欢id鍒楄〃 + + /// <summary> + /// 璁剧疆Open鏋勪欢棰滆壊 + /// </summary> + public async Task SetOpenComponentsColor(List<string> elementIds) + { + if (_openComponentIds != null && _openComponentIds.Count > 0) + { + await this.bimfaceInterop3dContainer1.RestoreComponentsColor(_openComponentIds); + } + _openComponentIds = elementIds; + if (elementIds == null || elementIds.Count < 1) + { + return; + } + await this.bimfaceInterop3dContainer1.OverrideComponentsColor(elementIds, _openComponentColor, _openComponentTransparency); + } + + #endregion + + #region 鑷畾涔夋爣绛� + + /// <summary> + /// 鏄剧ず璁$畻鑷畾涔夋爣绛� + /// </summary> + public async Task ShowCalcuCustomLabels(CalcuResult calcuResult) + { + var hydroInfo = GetHydroInfoEvent?.Invoke(); + if (hydroInfo == null) + { + return; + } + if (calcuResult == null) + { + return; + } + if (!calcuResult.Succeed) + { + await this.bimfaceInterop3dContainer1.ClearCustomLabels(); + return; + } + var obj = new List<CustomLabel>(); + var allParterList = hydroInfo.GetAllParters(); + allParterList?.ForEach(x => + { + if (x is Yw.Model.HydroPumpInfo pump) + { + var calcuPump = calcuResult.LinkList.Find(x => x.Id == pump.Code); + var calcuPumpStart = calcuResult.NodeList.Find(x => x.Id == pump.StartCode); + var calcuPumpEnd = calcuResult.NodeList.Find(x => x.Id == pump.EndCode); + var pumpCustomLabel = new CustomLabel(); + pumpCustomLabel.Id = pump.Code; + pumpCustomLabel.Data = new List<CustomLabelItem>() + { + new CustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuPump.Flow,1).ToString(),Unit="m鲁/h"}, + new CustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpStart.Head,4).ToString(),Unit="m"}, + new CustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpEnd.Head,4).ToString(),Unit="m"}, + }; + obj.Add(pumpCustomLabel); + } + else if (x is Yw.Model.HydroEmitterInfo emitter) + { + + } + }); + + await this.bimfaceInterop3dContainer1.SetCustomLabels(obj); + } + + #endregion + + #endregion + + + } } -- Gitblit v1.9.3