From adf7734a40dec76fc31590906eeadd02c782db90 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 08 十一月 2024 21:29:59 +0800 Subject: [PATCH] 优化导入,优化水流动画 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 262 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 226 insertions(+), 36 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs index 6ab634a..813ad8e 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -226,6 +226,15 @@ await Task.Delay(5000); await _bimfaceCtrl?.ClearBlinkComponents(); }; + + _propertyCtrl.ViewParterEvent += (parter) => + { + if (parter == null) + { + return; + } + _bimfaceCtrl?.ZoomToComponent(parter.Code); + }; _propertyCtrl.PropertyValueChangedEvent += (parter) => { if (parter == null) @@ -235,14 +244,24 @@ UpdateParterListProperty(parter); AutoApplyGrading(); }; - _propertyCtrl.ViewParterEvent += (parter) => + _propertyCtrl.MarkPropertyValueChangedEvent += (parter) => { - if (parter == null) - { - return; - } - _bimfaceCtrl?.ZoomToComponent(parter.Code); + //鏍囨敞灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇褰撳墠鏄惁鏈夋爣娉ㄥ睍绀猴紝鑻ユ湁鍒欐洿鏂版爣娉紝鏈�濂芥槸鏇存柊鍗曚釜鏍囨敞 }; + _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => + { + //鍒嗙骇灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇褰撳墠鏄惁鏈夊垎绾у睍绀猴紝鑻ユ湁鍒欐洿鏂板垎绾э紝鏈�濂芥槸鏇存柊鍗曚釜鍒嗙骇 + }; + _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (parter) => + { + //娴佸悜灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇娴佸悜鏄惁鍔犺浇锛屽鏋滃姞杞藉垯鏇存柊娴佸悜锛屾渶濂芥槸鏇存柊鍗曚釜娴佸悜 + UpdateFlowEffect(parter); + //await _bimfaceCtrl?.UnloadFlowEffectById(parter.Code); + }; + } return _propertyCtrl; } @@ -287,8 +306,6 @@ } } - - #endregion #region 閫夋嫨鏋勪欢 @@ -304,7 +321,6 @@ return; } _propertyCtrl?.UpdateProperty(); - } //鏇存柊閫夋嫨缁勪欢璁$畻灞炴�� @@ -507,8 +523,11 @@ #region 涓�閿樉闅� + //鏄鹃殣缂栫爜鍒楄〃 + private List<string> _fastShowHiddenCodeList = null; + //涓�閿樉闅� - private async Task FastShowHidden() + private async void FastShowHidden() { if (_hydroInfo == null) { @@ -530,13 +549,10 @@ } } - //鏄鹃殣缂栫爜鍒楄〃 - private List<string> _fastShowHiddenCodeList = null; - //瑙﹀彂涓�閿樉闅� - private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - await FastShowHidden(); + FastShowHidden(); } #endregion @@ -1254,6 +1270,7 @@ WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�..."); + //await Task.Delay(5000); var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); @@ -1319,6 +1336,8 @@ GetCalcuResultList(false); await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); + var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); + await _bimfaceCtrl?.ZoomAndSelectComponents(codes); } else { @@ -1561,17 +1580,31 @@ #region 鏋勪欢鏌ヨ //鏌ヨ缁勪欢 - private XhsProjectSimulationSearchCtrl _searchCtrl = null; + private HydroParterSearchListCtrl _searchCtrl = null; //鑾峰彇鏌ヨ缁勪欢 - private XhsProjectSimulationSearchCtrl GetSearchCtrl() + private HydroParterSearchListCtrl GetSearchCtrl() { if (_searchCtrl == null) { - _searchCtrl = new XhsProjectSimulationSearchCtrl(); + _searchCtrl = new HydroParterSearchListCtrl(); _searchCtrl.Dock = DockStyle.Fill; _searchCtrl.InitialData(() => _hydroInfo); - _searchCtrl.ApplySearchEvent += async (list) => + _searchCtrl.HydroClickEvent += async (parter) => + { + if (_hydroInfo == null) + { + return; + } + if (parter == null) + { + return; + } + _selectedParter = parter; + await _bimfaceCtrl?.ZoomAndSelectComponent(parter.Code); + ShowProperty(); + }; + _searchCtrl.HydroSearchEvent += async (list) => { if (_hydroInfo == null) { @@ -1580,9 +1613,7 @@ var elementIds = new List<string>(); if (list != null && list.Count > 0) { - var first = list.First(); - var allParterList = _hydroInfo.GetAllParters(); - _selectedParter = allParterList?.Find(x => x.Code == first.Code); + _selectedParter = list.First(); list.ForEach(x => elementIds.Add(x.Code)); } else @@ -1597,13 +1628,14 @@ } //鏄剧ず鏌ヨ鎺т欢 - private void ShowSearchCtrl() + private void ShowSearchCtrl(string content) { if (_hydroInfo == null) { return; } var searchCtrl = GetSearchCtrl(); + searchCtrl.SetBindingData(content); this.controlContainerBottom.Controls.Clear(); this.controlContainerBottom.Controls.Add(searchCtrl); this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; @@ -1611,10 +1643,36 @@ this.docPnlBottom.Height = 350; } + //鏄剧ず鏌ヨ绐椾綋 + private void ShowSearchDlg() + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroParterSearchListCtrl) + { + return; + } + } + } + var dlg = new InputHydroParterSearchListDlg(); + dlg.SearchEvent += (content) => + { + if (string.IsNullOrEmpty(content)) + { + return; + } + ShowSearchCtrl(content); + }; + dlg.SetBindingData(); + dlg.ShowDialog(); + } + //鏌ヨ private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - ShowSearchCtrl(); + ShowSearchDlg(); } #endregion @@ -3113,28 +3171,160 @@ #region 姘存祦鍔ㄧ敾 - //鍔犺浇娴佸悜 - private async void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //鎵�鏈夋祦鍚戝垪琛� + private List<Yw.WinFrmUI.Bimface.LogicFlowEffect> _allFlowEffectList = null; + + //鑾峰彇娴佸悜鍒楄〃 + private List<Yw.WinFrmUI.Bimface.LogicFlowEffect> GetFlowEffectList() { - var pipes = _hydroInfo.Pipes; - var list = pipes.Select(x => + if (_allFlowEffectList == null) { - return new Yw.WinFrmUI.Bimface.LogicFlowEffect() + if (_hydroInfo == null) { - Id = x.Code, - Rotation = 90, - Speed = 0.1d - }; - }).ToList(); - await _bimfaceCtrl?.LoadFlowEffect(list); + return default; + } + _allFlowEffectList = new List<LogicFlowEffect>(); + var allCalcuResultList = GetCalcuResultList(); + if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) + { + foreach (var parter in _hydroInfo.Pipes) + { + var flowEffect = new LogicFlowEffect(); + _allFlowEffectList.Add(flowEffect); + flowEffect.Id = parter.Code; + flowEffect.Rotation = 90; + flowEffect.SpeedX = 0.1; + if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.None) + { + flowEffect.SpeedX = 0; + } + else if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) + { + flowEffect.SpeedX = 0.1; + } + else + { + flowEffect.SpeedX = -0.1; + } + + if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.None) + { + flowEffect.SpeedY = 0; + } + else if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) + { + flowEffect.SpeedY = 0.1; + } + else + { + flowEffect.SpeedY = -0.1; + } + + var calcuResult = allCalcuResultList?.Find(x => x.Code == parter.Code) as HydroCalcuLinkResult; + if (calcuResult != null) + { + if (calcuResult.CalcuVelocity < 0) + { + flowEffect.SpeedX = -flowEffect.SpeedX; + } + } + } + } + } + return _allFlowEffectList; + } + + /// <summary> + /// 鍔犺浇姘存祦鍔ㄧ敾 + /// </summary> + private async void LoadFlowEffect() + { + if (_allFlowEffectList != null) + { + return; + } + var allFlowEffectList = GetFlowEffectList(); + await _bimfaceCtrl?.LoadFlowEffect(allFlowEffectList); } //鍗歌浇娴佸悜 - private async void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private async void UnloadFlowEffect() { + if (_allFlowEffectList == null) + { + return; + } + _allFlowEffectList = null; await _bimfaceCtrl?.UnloadFlowEffect(); } + //鏇存柊姘存祦鍔ㄧ敾 + private async void UpdateFlowEffect(Yw.Model.HydroParterInfo parter) + { + if (_allFlowEffectList == null) + { + return; + } + var visual = parter as Yw.Model.HydroVisualInfo; + if (visual == null) + { + return; + } + var flowEffect = _allFlowEffectList.Find(x => x.Id == parter.Code); + if (flowEffect == null) + { + return; + } + if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.None) + { + flowEffect.SpeedX = 0; + } + else if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) + { + flowEffect.SpeedX = 0.1; + } + else + { + flowEffect.SpeedX = -0.1; + } + + if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.None) + { + flowEffect.SpeedY = 0; + } + else if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) + { + flowEffect.SpeedY = 0.1; + } + else + { + flowEffect.SpeedY = -0.1; + } + + var allCalcuResultList = GetCalcuResultList(); + var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code) as HydroCalcuLinkResult; + if (calcuResult != null) + { + if (calcuResult.CalcuVelocity < 0) + { + flowEffect.SpeedX = -flowEffect.SpeedX; + } + } + await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); + } + + //鍔犺浇娴佸悜 + private void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + LoadFlowEffect(); + } + + //鍗歌浇娴佸悜 + private void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + UnloadFlowEffect(); + } + #endregion -- Gitblit v1.9.3