| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | #region 事件集 |
| | | |
| | | /// <summary> |
| | | /// 水力点击事件(包含左键和右键) |
| | | /// 水力点击事件 |
| | | /// 包含左键和右键 |
| | | /// </summary> |
| | | public event Action<Yw.Model.HydroVisualInfo> HydroClickEvent; |
| | | public event Action<string> HydroClickEvent; |
| | | /// <summary> |
| | | /// 水力点击事件(仅左键) |
| | | /// 水力点击事件 |
| | | /// 仅左键 |
| | | /// </summary> |
| | | public event Action<Yw.Model.HydroVisualInfo> HydroMouseLeftClickEvent; |
| | | public event Action<string> HydroMouseLeftClickEvent; |
| | | /// <summary> |
| | | /// 加载完成事件 |
| | | /// </summary> |
| | | public event Action LoadCompletedEvent; |
| | | |
| | | #endregion |
| | | |
| | | //项目 |
| | | private HStation.Vmo.XhsProjectVmo _project = null; |
| | | private XhsProjectVmo _project = null; |
| | | //项目站 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null; |
| | | //获取水力信息方法 |
| | | private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc = null; |
| | | private XhsProjectSiteVmo _projectSite = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// 仅支持调用一次 |
| | | /// </summary> |
| | | public async Task InitialData(XhsProjectVmo project, XhsProjectSiteVmo projectSite) |
| | | { |
| | | if (project == null) |
| | | { |
| | | return; |
| | | } |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | if (_projectSite == null) |
| | | { |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | } |
| | | var bimfaceInteropContainer = GetBimfaceInteropContainer(); |
| | | this.Controls.Clear(); |
| | | this.Controls.Add(bimfaceInteropContainer); |
| | | await bimfaceInteropContainer.InitialContainer(); |
| | | } |
| | | |
| | | #region 交互容器 |
| | | |
| | | //bimface 交互容器 |
| | | private BimfaceInterop3dContainer _bimfaceInteropContainer = null; |
| | | |
| | | //获取Bimface 交互容器 |
| | | private BimfaceInterop3dContainer GetBimfaceInteropContainer() |
| | |
| | | { |
| | | return; |
| | | } |
| | | if (this.HydroClickEvent != null) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = hydroInfo.GetAllVisuals(); |
| | | var parter = allParterList?.Find(x => x.Code == obj.ObjectId); |
| | | this.HydroClickEvent.Invoke(parter); |
| | | } |
| | | this.HydroClickEvent?.Invoke(obj.ObjectId); |
| | | }; |
| | | _bimfaceInteropContainer.ClickOutEvent += (obj) => |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | if (this.HydroMouseLeftClickEvent != null) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = hydroInfo.GetAllVisuals(); |
| | | var parter = allParterList?.Find(x => x.Code == obj.ObjectId); |
| | | this.HydroMouseLeftClickEvent.Invoke(parter); |
| | | } |
| | | this.HydroMouseLeftClickEvent?.Invoke(obj.ObjectId); |
| | | }; |
| | | _bimfaceInteropContainer.MouseLeftClickOutEvent += (obj) => |
| | | { |
| | |
| | | } |
| | | return _bimfaceInteropContainer; |
| | | } |
| | | //bimface 交互容器 |
| | | private BimfaceInterop3dContainer _bimfaceInteropContainer = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// 仅支持调用一次 |
| | | /// </summary> |
| | | public async Task InitialData |
| | | ( |
| | | HStation.Vmo.XhsProjectVmo project, |
| | | HStation.Vmo.XhsProjectSiteVmo projectSite, |
| | | Func<Yw.Model.HydroModelInfo> hydroInfoFunc |
| | | ) |
| | | { |
| | | if (project == null) |
| | | { |
| | | return; |
| | | } |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _hydroInfoFunc = hydroInfoFunc; |
| | | if (_projectSite == null) |
| | | { |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | } |
| | | var bimfaceInteropContainer = GetBimfaceInteropContainer(); |
| | | this.Controls.Clear(); |
| | | this.Controls.Add(bimfaceInteropContainer); |
| | | await bimfaceInteropContainer.InitialContainer(); |
| | | } |
| | | |
| | | |
| | | #region 构件的显示与隐藏 |
| | | #endregion |
| | | |
| | | #region 显示与隐藏 |
| | | |
| | | /// <summary> |
| | | /// 显示构件 |
| | |
| | | /// <summary> |
| | | /// 半透明构件 |
| | | /// </summary> |
| | | /// <param name="elementIds">构件id列表</param> |
| | | /// <returns></returns> |
| | | public async Task TranslucentComponents(List<string> elementIds) |
| | | { |
| | | if (_bimfaceInteropContainer == null) |
| | |
| | | /// <summary> |
| | | /// 取消构件半透明 |
| | | /// </summary> |
| | | /// <param name="elementIds">构件id列表</param> |
| | | /// <returns></returns> |
| | | public async Task OpaqueComponents(List<string> elementIds) |
| | | { |
| | | if (_bimfaceInteropContainer == null) |
| | |
| | | #region 业务计算自定义标签 |
| | | |
| | | /// <summary> |
| | | /// 显示业务计算自定义标签 |
| | | /// 设置业务计算自定义标签 |
| | | /// </summary> |
| | | public async Task SetLogicCalcuCustomLabelsCalcuResult(HydroCalcuResult calcuResult) |
| | | public async Task SetLogicCalcuCustomLabels(List<LogicCalcuCustomLabel> obj) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | await _bimfaceInteropContainer?.ClearLogicCalcuCustomLabels(); |
| | | return; |
| | | } |
| | | var obj = new List<LogicCalcuCustomLabel>(); |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | allParterList?.ForEach(x => |
| | | { |
| | | if (x is Yw.Model.HydroPumpInfo pump) |
| | | { |
| | | var hz = Math.Round(pump.RatedHz * pump.SpeedRatio); |
| | | var calcuPump = calcuResult.LinkList.Find(x => x.Code == pump.Code); |
| | | var calcuPumpStart = calcuResult.NodeList.Find(x => x.Code == pump.StartCode); |
| | | var calcuPumpEnd = calcuResult.NodeList.Find(x => x.Code == pump.EndCode); |
| | | var pumpCustomLabel = new LogicCalcuCustomLabel(); |
| | | pumpCustomLabel.Id = pump.Code; |
| | | pumpCustomLabel.Distance = 10000; |
| | | pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | 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.CalcuFlow.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStart.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEnd.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | }; |
| | | obj.Add(pumpCustomLabel); |
| | | } |
| | | else if (x is Yw.Model.HydroEmitterInfo emitter) |
| | | { |
| | | var calcuEmitter = calcuResult.NodeList.Find(x => x.Code == emitter.Code); |
| | | var emitterCustomLabel = new LogicCalcuCustomLabel(); |
| | | emitterCustomLabel.Id = emitter.Code; |
| | | emitterCustomLabel.Distance = 10000; |
| | | emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.CalcuDemand.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.CalcuDemand.Value,4).ToString(),Unit="m"} |
| | | }; |
| | | obj.Add(emitterCustomLabel); |
| | | } |
| | | }); |
| | | await _bimfaceInteropContainer?.SetLogicCalcuCustomLabels(obj); |
| | | } |
| | | |