WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs
@@ -19,6 +19,9 @@ private HStation.Vmo.XhsProjectVmo _project = null; private HStation.Vmo.XhsProjectSiteVmo _projectSite = null; private const string _linkComponentColor = "#008B00"; private const double _linkComponentTransparency = 0.8; private List<string> _linkComponentIds = null;//è¿æ¥æä»¶idå表 /// <summary> /// ç»å®æ°æ® @@ -206,5 +209,66 @@ #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 ä¸å¡ 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 } } WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
@@ -284,14 +284,14 @@ pageQ3d.Caption = "æ°´åæ¨¡å"; pageQ3d.Controls.Add(xhsProjectSimulationQ3dCtrl1); pageQ3d.Name = "pageQ3d"; pageQ3d.Size = new Size(776, 301); pageQ3d.Size = new Size(886, 185); // // xhsProjectSimulationQ3dCtrl1 // xhsProjectSimulationQ3dCtrl1.Dock = DockStyle.Fill; xhsProjectSimulationQ3dCtrl1.Location = new Point(0, 0); xhsProjectSimulationQ3dCtrl1.Name = "xhsProjectSimulationQ3dCtrl1"; xhsProjectSimulationQ3dCtrl1.Size = new Size(776, 301); xhsProjectSimulationQ3dCtrl1.Size = new Size(886, 185); xhsProjectSimulationQ3dCtrl1.TabIndex = 0; // // tabPageL3d WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -171,67 +171,9 @@ //bimface æä»¶ç¹å» private void xhsProjectSimulationBimfaceCtrl1_ClickParterEvent(string objectId) { if (_hydroInfo == null) { return; } var allParterList = _hydroInfo.GetAllParters(); _parter = allParterList.Find(x => x.Code == objectId); ShowProperty(); } //æ¾ç¤ºå±æ§ private void ShowProperty() { if (_hydroInfo == null) { return; } if (_parter == null) { return; } var allParterList = _hydroInfo.GetAllParters(); this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter, allParterList); if (_calcuResult != null) { if (_calcuResult.Succeed) { var allCalcuParterList = _calcuResult.GetParterList(); var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); if (calcuParter != null) { IHydroCalcuProperty calcuProperty = null; if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) { var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeProperty(); calcuNodeProperty.ID = _parter.ID; calcuNodeProperty.CalcuPress = calcuNode.Press; calcuNodeProperty.CalcuDemand = calcuNode.Demand; calcuNodeProperty.CalcuHead = calcuNode.Head; calcuProperty = calcuNodeProperty; } else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) { var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkProperty(); calcuLinkProperty.ID = _parter.ID; calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; calcuLinkProperty.CalcuFlow = calcuLink.Flow; calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; calcuProperty = calcuLinkProperty; } if (calcuProperty != null) { this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty); } } } } } @@ -339,6 +281,24 @@ ShowProperty(); } #region Bimface //bimface æä»¶ç¹å» private void xhsProjectSimulationBimfaceCtrl1_ClickParterEvent(string objectId) { if (_hydroInfo == null) { return; } var allParterList = _hydroInfo.GetAllParters(); _parter = allParterList.Find(x => x.Code == objectId); ShowProperty(); SetBimfaceLinkColor(); } #endregion #region æ°´åæ ¡éª //æ°´åéªè¯ @@ -446,5 +406,77 @@ #endregion #region ä¸å¡æ¹æ³ //æ¾ç¤ºå±æ§ private void ShowProperty() { if (_hydroInfo == null) { return; } if (_parter == null) { this.xhsProjectSimulationPropertyCtrl1.SelectParter(null); return; } this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code); if (_calcuResult != null) { if (_calcuResult.Succeed) { var allCalcuParterList = _calcuResult.GetParterList(); var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); if (calcuParter != null) { IHydroCalcuProperty calcuProperty = null; if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) { var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeProperty(); calcuNodeProperty.ID = _parter.ID; calcuNodeProperty.CalcuPress = calcuNode.Press; calcuNodeProperty.CalcuDemand = calcuNode.Demand; calcuNodeProperty.CalcuHead = calcuNode.Head; calcuProperty = calcuNodeProperty; } else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) { var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkProperty(); calcuLinkProperty.ID = _parter.ID; calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; calcuLinkProperty.CalcuFlow = calcuLink.Flow; calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; calcuProperty = calcuLinkProperty; } if (calcuProperty != null) { this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty); } } } } } //设置Bimfaceè¿æ¥é¢è² private async void SetBimfaceLinkColor() { if (_hydroInfo == null) { return; } List<string> elementIds = null; if (_parter != null) { if (_parter is Yw.Model.HydroLinkInfo linker) { elementIds = new List<string>() { linker.StartCode, linker.EndCode }; } } await this.xhsProjectSimulationBimfaceCtrl1.SetLinkComponentsColor(elementIds); } #endregion } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/ComponentsColor.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Yw.WinFrmUI.Bimface { /// <summary> /// æä»¶é¢è² /// </summary> public class ComponentsColor { /// <summary> /// æä»¶idå表 /// </summary> [JsonProperty("ids", NullValueHandling = NullValueHandling.Ignore)] public List<string> Ids { get; set; } /// <summary> /// é¢è² /// </summary> [JsonProperty("color", NullValueHandling = NullValueHandling.Ignore)] public string Color { get; set; } /// <summary> /// éæåº¦ /// </summary> [JsonProperty("transparency", NullValueHandling = NullValueHandling.Ignore)] public double Transparency { get; set; } } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/BimfaceInterop3dContainer.cs
@@ -1,4 +1,7 @@ namespace Yw.WinFrmUI using DevExpress.Xpo.DB.Helpers; using DevExpress.XtraDiagram.Base; namespace Yw.WinFrmUI { public partial class BimfaceInterop3dContainer : UserControl, IBimfaceInterop3dContainer { @@ -340,5 +343,74 @@ } #endregion #region å¼ºè°æä»¶ /// <summary> /// è®¾ç½®å¼ºè°æä»¶ /// </summary> /// <param name="ids">æä»¶idå表</param> /// <param name="color">#32D3A6</param> /// <param name="transparency">0.8</param> /// <returns></returns> public async Task SetBlinkComponents(List<string> ids, string color, double transparency) { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("setBlinkComponents", ids, color, transparency); } /// <summary> /// æ¸ é¤å¼ºè°æä»¶ /// </summary> /// <returns></returns> public async Task ClearBlinkComponents() { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("clearBlinkComponents()"); } #endregion #region æä»¶çè² /// <summary> /// æ¹åæä»¶é¢è² /// </summary> /// <param name="ids">æä»¶idå表</param> /// <param name="color">#32D3A6</param> /// <param name="transparency">0.8</param> /// <returns></returns> public async Task OverrideComponentsColor(List<string> ids, string color, double transparency) { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("overrideComponentsColor", new ComponentsColor() { Ids = ids, Color = color, Transparency = transparency }); } /// <summary> /// /// </summary> /// <param name="ids">æä»¶idå表</param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public async Task RestoreComponentsColor(List<string> ids) { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("restoreComponentsColor", ids); } #endregion } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/IBimfaceInterop3dContainer.cs
@@ -1,4 +1,5 @@ using DevExpress.Xpo.Helpers; using DevExpress.CodeParser; using DevExpress.Xpo.Helpers; using DevExpress.XtraDiagram.Base; using Yw.WinFrmUI.Bimface; @@ -117,5 +118,44 @@ #endregion #region å¼ºè°æä»¶ /// <summary> /// è®¾ç½®å¼ºè°æä»¶ /// </summary> /// <param name="ids">æä»¶idå表</param> /// <param name="color">#32D3A6</param> /// <param name="transparency">0.8</param> /// <returns></returns> Task SetBlinkComponents(List<string> ids, string color, double transparency); /// <summary> /// æ¸ é¤å¼ºè°æä»¶ /// </summary> /// <returns></returns> Task ClearBlinkComponents(); #endregion #region æä»¶çè² /// <summary> /// æ¹åæä»¶é¢è² /// </summary> /// <param name="ids">æä»¶idå表</param> /// <param name="color">#32D3A6</param> /// <param name="transparency">0.8</param> /// <returns></returns> Task OverrideComponentsColor(List<string> ids, string color, double transparency); /// <summary> /// æ¢å¤é¨ä»¶é¢è² /// </summary> /// <param name="ids">æä»¶idå表</param> /// <returns></returns> Task RestoreComponentsColor(List<string> ids); #endregion } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/html/Interop3d.html
@@ -116,10 +116,11 @@ <script src="../js/ComponentsVisible.js"></script> <script src="../js/ComponentsSelected.js"></script> <script src="../js/Zoom.js"></script> <script src="../js/ComponentsBlink.js"></script> <script src="../js/ComponentsColor.js"></script> <script src="js/Background.js"></script> <script src="js/CameraStatus.js"></script> <script src="js/ComponentsColor.js"></script> <script src="js/ContextMenu.js"></script> <script src="js/GetComponents.js"></script> <script src="js/Layer.js"></script> WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/js/ComponentsColor.js
@@ -1,16 +1,13 @@ // *************** æä»¶çè² *************** //æ¹åé¨ä»¶é¢è² function overrideComponentsColor(colorSettings) { for (var i = 0; i < colorSettings.length; i++) { var item = colorSettings[i]; var ids = item.ComponentIds; var color = new Glodon.Web.Graphics.Color(item.DisplayHtmlColor, item.ColorTransparency); _viewer.overrideComponentsColorById(ids, color); } function overrideComponentsColor(obj) { _viewer.overrideComponentsColorById(obj.ids, new Glodon.Web.Graphics.Color(obj.color, obj.transparency)); _viewer.render(); } //æ¢å¤é¨ä»¶é¢è² function restoreComponentsColor(ids) { _viewer.restoreComponentsColorById(ids); WinFrmUI/Yw.WinFrmUI.Hydro.L3d.Core/00-core/BoundingBox3d.cs
@@ -49,5 +49,7 @@ Z = (this.Min.Z + this.Max.Z) / 2f }; } } }