| | |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | |
| | | _propertyCtrl.ViewParterEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateProperty(); |
| | | _propertyCtrl?.UpdateProperty(); |
| | | } |
| | | |
| | | //更新选择组件计算属性 |
| | |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //一键显隐 |
| | | private async Task FastShowHidden() |
| | | private async void FastShowHidden() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | //显隐编码列表 |
| | | 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 |
| | |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | |
| | | |
| | | //await Task.Delay(5000); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | |
| | | } |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | | { |
| | | var dlg = new SetHydroWorkingInfoDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | } |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (hydroInfo, workingInfo) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _hydroInfo.UpdateWorkingInfo(workingInfo); |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | |
| | | await Task.Delay(5000); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | GetCalcuResultList(false); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | UpdateParterListProperty(); |
| | | ShowProperty(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowCalcuPrefixDlg(); |
| | | //ShowCalcuPrefixDlg(); |
| | | ShowWorkingCalcuDlg(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | #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) |
| | | { |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | //显示查询控件 |
| | | 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; |
| | |
| | | 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 |
| | |
| | | |
| | | #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 |
| | | |
| | | |