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 |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 178 insertions(+), 0 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 c200425..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,5 +1,6 @@
 锘縰sing DevExpress.Office.Utils;
 using DevExpress.Xpo.Helpers;
+using Yw.WinFrmUI.Bimface;
 
 namespace HStation.WinFrmUI
 {
@@ -17,8 +18,16 @@
         /// </summary>
         public event Action<string> ClickParterEvent;
 
+        /// <summary>
+        /// 鑾峰彇姘村姏淇℃伅浜嬩欢
+        /// </summary>
+        public event Func<Yw.Model.HydroModelInfo> GetHydroInfoEvent;
+
         private HStation.Vmo.XhsProjectVmo _project = null;
         private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;
+
+
+
 
         /// <summary>
         /// 缁戝畾鏁版嵁
@@ -206,5 +215,174 @@
 
         #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