lixiaojun
2024-09-24 22e1f3211a078ba498f35069c3db420dc388b164
bimface 优化
已修改8个文件
已添加1个文件
384 ■■■■ 文件已修改
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/ComponentsColor.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/BimfaceInterop3dContainer.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/IBimfaceInterop3dContainer.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/html/Interop3d.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/js/ComponentsColor.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Hydro.L3d.Core/00-core/BoundingBox3d.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
            };
        }
    }
}