From 22e1f3211a078ba498f35069c3db420dc388b164 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 24 九月 2024 13:09:51 +0800 Subject: [PATCH] bimface 优化 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 323 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 188 insertions(+), 135 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs index ff8c49f..dacb9a8 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -4,6 +4,7 @@ using HStation.WinFrmUI.Xhs.Core; using NPOI.SS.Formula.Functions; using Yw.WinFrmUI.HydroL2d; +using Yw.WinFrmUI.HydroL3d; namespace HStation.WinFrmUI { @@ -95,7 +96,7 @@ } if (_fastShowHideCodeList == null) { - _fastShowHideCodeList = _hydroInfo.Waterboxs.Select(x => x.Code).ToList(); + _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); await this.xhsProjectSimulationBimfaceCtrl1.HideComponents(_fastShowHideCodeList); } else @@ -105,29 +106,7 @@ } } - //姘村姏楠岃瘉 - private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); - _checkResult = netWork.Check(); - if (_checkResult.Succeed) - { - TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�"); - return; - } - this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList); - this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlHydroCheck.Height = 350; - } //姘村姏璁$畻 private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -190,102 +169,13 @@ TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛"); } - //鏈尮閰嶅垪琛� - private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.xhsProjectSimulationUnMatchingListCtrl1.SetBindingData(_hydroInfo); - this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlUnMatchingList.Height = 350; - } - //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); - } - } - } - } - } - //淇濆瓨 - private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); - if (id < 1) - { - TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); - return; - } - _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); - //this.xhsProjectSimulationPropertyCtrl1.SetMatching(_hydroInfo); - TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); - } + + //鑷姩鍖归厤 private void barBtnAllAutoMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -328,7 +218,7 @@ DbId = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, - //Caliber = x.Caliber, + Caliber = x.Caliber, Material = x.Material }).ToList(); input.FourLinkMatchingModels = _hydroInfo.Fourlinks?.Select(x => new FourLinkMatchingViewModel() @@ -339,7 +229,7 @@ Dbid = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, - // Caliber = x.Caliber, + Caliber = x.Caliber, Material = x.Material }).ToList(); input.PipeLineMatchingModels = _hydroInfo.Pipes?.Select(x => new PipeLineMatchingViewModel() @@ -380,24 +270,7 @@ }; } - private void BtnPerformChart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - var dlg = new PerformChart(); - dlg.ShowDialog(); - } - //姘村姏鏍¢獙鐐瑰嚮 - private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string obj) - { - if (_hydroInfo == null) - { - return; - } - await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { obj }); - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList.Find(x => x.Code == obj); - ShowProperty(); - } //姘村姏鏋勪欢鏄庣粏闈㈡澘鐐瑰嚮浜嬩欢 private async void hydroParterListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter) @@ -408,12 +281,94 @@ 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 姘村姏鏍¢獙 + + //姘村姏楠岃瘉 + private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); + _checkResult = netWork.Check(); + if (_checkResult.Succeed) + { + TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�"); + return; + } + this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList); + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlHydroCheck.Height = 350; + } + + //姘村姏鏍¢獙鐐瑰嚮 + private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string code) + { + if (_hydroInfo == null) + { + return; + } + var allParterList = _hydroInfo.GetAllParters(); + _parter = allParterList.Find(x => x.Code == code); + var elementIds = new List<string>() { _parter.Code }; + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); + ShowProperty(); + } + + #endregion + + #region 鏈尮閰嶅垪琛� + + //鏈尮閰嶅垪琛� + private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + this.xhsProjectSimulationUnMatchingListCtrl1.SetBindingData(_hydroInfo); + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlUnMatchingList.Height = 350; + } + //鏈尮閰嶅垪琛ㄧ偣鍑讳簨浠� private async void xhsProjectSimulationUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter) { var allParterList = _hydroInfo.GetAllParters(); _parter = allParterList.Find(x => x.ID == parter.ID); - await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { _parter.Code }); + var elementIds = new List<string>() { _parter.Code }; + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); ShowProperty(); } @@ -421,9 +376,107 @@ private async void xhsProjectSimulationUnMatchingListCtrl1_ViewModelEvent(List<Yw.Model.HydroParterInfo> parters) { var codes = parters?.Select(x => x.Code).Distinct().ToList(); - await this.xhsProjectSimulationBimfaceCtrl1.AddSelectedComponents(codes); + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(codes); _parter = null; ShowProperty(); } + + + #endregion + + #region 淇濆瓨姘村姏淇℃伅 + + //淇濆瓨 + private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); + if (id < 1) + { + TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); + return; + } + _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); + TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); + } + + + #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 + } } \ No newline at end of file -- Gitblit v1.9.3