| | |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | | using System.Windows.Media.Media3D; |
| | | using Yw.Pump; |
| | | using Yw.Vmo; |
| | |
| | | |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null;//检查结果 |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = obj; |
| | | ShowProperty(); |
| | | _selectedVisual = obj; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件属性 |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | |
| | | { |
| | | return; |
| | | } |
| | | UpdateParterListProperty(parter); |
| | | UpdateVisualListCtrl(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (parter) => |
| | |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | }; |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += (parter) => |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (parter) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | UpdateFlowEffect(parter); |
| | | //await _bimfaceCtrl?.UnloadFlowEffectById(parter.Code); |
| | | }; |
| | | |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | | |
| | | //显示属性面板 |
| | | //属性控件是否可见 |
| | | private bool IsPropertyCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示属性控件 |
| | | private void ShowPropertyCtrl() |
| | | { |
| | | if (IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var propertyCtrl = GetPropertyCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(propertyCtrl); |
| | |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty() |
| | | { |
| | | ShowSelectedProperty(_selectedVisual); |
| | | } |
| | | |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden) |
| | | ShowPropertyCtrl(); |
| | | _selectedVisual = visual; |
| | | if (_selectedVisual == null) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | if (_selectedParter == null) |
| | | { |
| | | _propertyCtrl?.CancelSelectParter(); |
| | | _propertyCtrl.SelectedObject = null; |
| | | return; |
| | | } |
| | | _propertyCtrl?.SelectParter(_selectedParter.Code); |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | } |
| | | _propertyCtrl.SelectedObject = GetVisualViewModel(_selectedVisual); |
| | | } |
| | | |
| | | |
| | | //更新选择属性 |
| | | private void UpdateSelectedProperty() |
| | | { |
| | | if (!IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | if (_selectedVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroParterInfo _selectedParter = null; |
| | | |
| | | //更新选择组件属性 |
| | | private void UpdateSelectedParterProperty() |
| | | { |
| | | if (_selectedParter == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateProperty(); |
| | | } |
| | | |
| | | //更新选择组件计算属性 |
| | | private void UpdateSelectedParterCalcuProperty() |
| | | { |
| | | if (_selectedParter == null) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code); |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty() |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | parterListCtrl.UpdateProperty(); |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty(Yw.Model.HydroParterInfo parter) |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | parterListCtrl.UpdateProperty(parter); |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty(List<Yw.Model.HydroParterInfo> parterList) |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | parterListCtrl.UpdateProperty(parterList); |
| | | } |
| | | |
| | | //更新构件列表计算属性 |
| | | private void UpdateParterListCalcuProperty() |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | parterListCtrl.UpdateCalcuProperty(allCalcuResultList); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_selectedParter != null) |
| | | if (_selectedVisual != null) |
| | | { |
| | | elementIds.Add(_selectedParter.Code); |
| | | elementIds.Add(_selectedVisual.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _selectedParter = null; |
| | | ShowProperty(); |
| | | _selectedVisual = null; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _unMatchingListCtrl; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 水力校验 |
| | | |
| | | //校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _selectedParter = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | if (_selectedParter != null) |
| | | { |
| | | elementIds.Add(_selectedParter.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | checkCtrl.SetBindingData(_checkResult); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | } |
| | | |
| | | //水力检查 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 保存信息 |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl() |
| | | { |
| | | if (_parterListCtrl == null) |
| | | { |
| | | _parterListCtrl = new HydroParterListCtrl(); |
| | | _parterListCtrl.Dock = DockStyle.Fill; |
| | | _parterListCtrl.HydroClickEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedParter.Code); |
| | | ShowProperty(); |
| | | }; |
| | | _parterListCtrl.HydroChangedEvent += (parterList) => |
| | | { |
| | | UpdateSelectedParterProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _parterListCtrl; |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowParterListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var parterListCtrl = GetParterListCtrl(); |
| | | parterListCtrl.SetBindingData(_hydroInfo, allCalcuResultList); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | parterListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | parterListCtrl.SetCalcuView(); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(parterListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowParterListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region INP导出 |
| | | |
| | |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroWaterboxListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickEvent += async (obj) => |
| | | { |
| | | if (obj == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = obj; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroChangedEvent += (obj) => |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroWaterboxListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroBluntheadListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickEvent += async (obj) => |
| | | { |
| | | if (obj == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = obj; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroChangedEvent += (obj) => |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroBluntheadListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroElbowListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickEvent += async (obj) => |
| | | { |
| | | if (obj == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = obj; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroChangedEvent += (obj) => |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroElbowListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowProperty(); |
| | | ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | |
| | | |
| | | #region 前提条件 |
| | | |
| | | //显示计算前提条件窗体 |
| | | private void ShowCalcuPrefixDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HStation.WinFrmUI.SetHydroCalcuPrefixDlg1(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | } |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async () => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //校验 |
| | | _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("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | |
| | | var dlg = new SetHydroWorkingInfoDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | _selectedVisual = parter as Yw.Model.HydroVisualInfo; |
| | | if (_selectedVisual != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedVisual.Code }); |
| | | } |
| | | ShowProperty(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (hydroInfo, workingInfo) => |
| | | { |
| | |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | UpdateParterListProperty(); |
| | | ShowProperty(); |
| | | UpdateVisualListCtrl(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | |
| | | #region 构件查询 |
| | | |
| | | //查询组件 |
| | | private HydroParterSearchListCtrl _searchCtrl = null; |
| | | private HydroVisualSearchListCtrl _searchCtrl = null; |
| | | |
| | | //获取查询组件 |
| | | private HydroParterSearchListCtrl GetSearchCtrl() |
| | | private HydroVisualSearchListCtrl GetSearchCtrl() |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | _searchCtrl = new HydroParterSearchListCtrl(); |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | _searchCtrl.InitialData(() => _hydroInfo); |
| | | _searchCtrl.HydroClickEvent += async (parter) => |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | _searchCtrl.InitialData(allVisualViewModelList); |
| | | _searchCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = parter; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(parter.Code); |
| | | ShowProperty(); |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | }; |
| | | _searchCtrl.HydroSearchEvent += async (list) => |
| | | _searchCtrl.HydroSearchInfoEvent += async (list) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | _selectedParter = list.First(); |
| | | _selectedVisual = list.First(); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _selectedParter = null; |
| | | _selectedVisual = null; |
| | | } |
| | | ShowSelectedProperty(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | | } |
| | | |
| | | //查询控件是否可见 |
| | | private bool IsSearchCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualSearchListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示查询控件 |
| | | private void ShowSearchCtrl(string content) |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | |
| | | //显示查询窗体 |
| | | private void ShowSearchDlg() |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroParterSearchListCtrl) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | var dlg = new InputHydroParterSearchListDlg(); |
| | | var dlg = new InputHydroVisualSearchListDlg(); |
| | | dlg.SearchEvent += (content) => |
| | | { |
| | | if (string.IsNullOrEmpty(content)) |
| | |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = Yw.Hydro.ParterProp.CalcuFlow |
| | | }); |
| | | } |
| | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _selectedParter = null; |
| | | _selectedVisual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | ShowProperty(); |
| | | ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | } |
| | | } |
| | |
| | | |
| | | #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 |
| | | |
| | | #region 可见视图 |
| | | |
| | | //所有可见视图列表 |
| | | private List<HydroVisualViewModel> _allVisualViewModelList = null; |
| | | |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelList == null) |
| | | { |
| | | _allVisualViewModelList = new List<HydroVisualViewModel>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList != null && allVisualList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | allVisualList.ForEach(x => |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(x, _hydroInfo); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | _allVisualViewModelList.Add(vm); |
| | | }); |
| | | } |
| | | } |
| | | return _allVisualViewModelList; |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(t => t.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | x.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == visual.Code); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _selectedVisual = null; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedVisual?.Code); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | UpdateSelectedProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | visualListCtrl.SetBindingData(allVisualViewModelList); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力校验 |
| | | |
| | | //校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _selectedVisual = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == code); |
| | | if (_selectedVisual != null) |
| | | { |
| | | elementIds.Add(_selectedVisual.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | checkCtrl.SetBindingData(_checkResult); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | } |
| | | |
| | | //水力检查 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |