lixiaojun
2024-10-31 abf1e3b3334ab47c38aa92405a11a6ec92b7847a
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs
@@ -334,28 +334,31 @@
        #region 强调构件
        private const string _blinkColor = "#32D3A6";//强调构件颜色
        private const double _blinkTransparency = 0.8d; //强调构件透明度
        /// <summary>
        /// 设置强调构件
        /// </summary>
        public async Task SetBlinkComponents(List<string> elementIds, string color, double transparency)
        {
            if (_bimfaceInteropContainer == null)
            {
                return;
            }
            await _bimfaceInteropContainer.SetBlinkComponents(elementIds, color, transparency);
            await _bimfaceInteropContainer?.SetBlinkComponents(elementIds, color, transparency);
        }
        /// <summary>
        /// 设置强调构件
        /// </summary>
        public async Task SetBlinkComponents(List<string> elementIds)
        {
            await _bimfaceInteropContainer?.SetBlinkComponents(elementIds, _blinkColor, _blinkTransparency);
        }
        /// <summary>
        /// 清除强调构件
        /// </summary>
        public async Task SetBlinkComponents()
        public async Task ClearBlinkComponents()
        {
            if (_bimfaceInteropContainer == null)
            {
                return;
            }
            await _bimfaceInteropContainer.ClearBlinkComponents();
            await _bimfaceInteropContainer?.ClearBlinkComponents();
        }
        #endregion
@@ -377,7 +380,7 @@
        /// <summary>
        /// 恢复构件颜色
        /// </summary>
        public async Task SetBlinkComponents(List<string> elementIds)
        public async Task RestoreComponentsColor(List<string> elementIds)
        {
            if (_bimfaceInteropContainer == null)
            {
@@ -409,37 +412,39 @@
                await _bimfaceInteropContainer?.ClearLogicCalcuCustomLabels();
                return;
            }
            var obj = new List<CustomLabel>();
            var obj = new List<LogicCalcuCustomLabel>();
            var allParterList = hydroInfo.GetAllParters();
            allParterList?.ForEach(x =>
            {
                if (x is Yw.Model.HydroPumpInfo pump)
                {
                    var hz = pump.RatedHz * pump.SpeedRatio;
                    var hz = Math.Round(pump.RatedHz * pump.SpeedRatio);
                    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();
                    var pumpCustomLabel = new LogicCalcuCustomLabel();
                    pumpCustomLabel.Id = pump.Code;
                    pumpCustomLabel.Data = new List<CustomLabelItem>()
                    pumpCustomLabel.Distance = 10000;
                    pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>()
                    {
                        new CustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(pump.LinkStatus),Unit=string.Empty},
                        new CustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty},
                        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"},
                        new LogicCalcuCustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(pump.LinkStatus),Unit=string.Empty},
                        new LogicCalcuCustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty},
                        new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuPump.Flow,1).ToString(),Unit="m³/h"},
                        new LogicCalcuCustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStart.Head,4).ToString(),Unit="m"},
                        new LogicCalcuCustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEnd.Head,4).ToString(),Unit="m"},
                    };
                    obj.Add(pumpCustomLabel);
                }
                else if (x is Yw.Model.HydroEmitterInfo emitter)
                {
                    var calcuEmitter = calcuResult.NodeList.Find(x => x.Id == emitter.Code);
                    var emitterCustomLabel = new CustomLabel();
                    var emitterCustomLabel = new LogicCalcuCustomLabel();
                    emitterCustomLabel.Id = emitter.Code;
                    emitterCustomLabel.Data = new List<CustomLabelItem>()
                    emitterCustomLabel.Distance = 10000;
                    emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>()
                    {
                        new CustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.Demand,1).ToString(),Unit="m³/h"},
                        new CustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.Head,4).ToString(),Unit="m"}
                        new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.Demand,1).ToString(),Unit="m³/h"},
                        new LogicCalcuCustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.Head,4).ToString(),Unit="m"}
                    };
                    obj.Add(emitterCustomLabel);
                }
@@ -477,8 +482,17 @@
        #endregion
        #region 业务
        #region 业务水流动画
        /// <summary>
        ///
        /// </summary>
        public async Task LoadAllFlowMaterialList(List<LogicFlowEffect> obj)
        {
            await _bimfaceInteropContainer?.LoadAllFlowMaterialList(obj);
        }
        #endregion
        #region 连接构件颜色
@@ -547,40 +561,6 @@
            _linkComponentIds.AddRange(elementIds);
            await _bimfaceInteropContainer?.OverrideComponentsColor(elementIds, _linkEndComponentColor, _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 _bimfaceInteropContainer.RestoreComponentsColor(_openComponentIds);
            }
            _openComponentIds = elementIds;
            if (elementIds == null || elementIds.Count < 1)
            {
                return;
            }
            if (_bimfaceInteropContainer == null)
            {
                return;
            }
            await _bimfaceInteropContainer.OverrideComponentsColor(elementIds, _openComponentColor, _openComponentTransparency);
        }
        #endregion
        #endregion