| | |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | |
| | | private Yw.Model.HydroParterInfo _parter = null; |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null; |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null; |
| | | |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null;//检查结果 |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | #region Bimface |
| | | |
| | | //bimface控件 |
| | |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | |
| | | { |
| | | return; |
| | | } |
| | | _parter = obj; |
| | | _selectedParter = obj; |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | this.tabPageBimface.Controls.Clear(); |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | private void SelectBimfaceParter() |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | _selectedParter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | |
| | | _propertyCtrl.ViewParterEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateParterListProperty(parter); |
| | | AutoApplyGrading(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (parter) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | }; |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (parter) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | UpdateFlowEffect(parter); |
| | | //await _bimfaceCtrl?.UnloadFlowEffectById(parter.Code); |
| | | }; |
| | | |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //属性面板按钮 |
| | | private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | { |
| | |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | if (_parter == null) |
| | | if (_selectedParter == null) |
| | | { |
| | | _propertyCtrl?.SelectParter(null); |
| | | _propertyCtrl?.CancelSelectParter(); |
| | | return; |
| | | } |
| | | _propertyCtrl?.SelectParter(_parter.Code); |
| | | _propertyCtrl?.SelectParter(_selectedParter.Code); |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _parter.Code); |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #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 |
| | |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_parter != null) |
| | | if (_selectedParter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | elementIds.Add(_selectedParter.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | _selectedParter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _parter = null; |
| | | _selectedParter = null; |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | |
| | | |
| | | #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 |
| | |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _parter = null; |
| | | _selectedParter = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | if (_parter != null) |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | if (_selectedParter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | elementIds.Add(_selectedParter.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | |
| | | _parterListCtrl.Dock = DockStyle.Fill; |
| | | _parterListCtrl.HydroClickEvent += async (parter) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); |
| | | _selectedParter = parter; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedParter.Code); |
| | | ShowProperty(); |
| | | }; |
| | | _parterListCtrl.HydroChangedEvent += (parterList) => |
| | | { |
| | | UpdateSelectedParterProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _parterListCtrl; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var parterListCtrl = GetParterListCtrl(); |
| | | parterListCtrl.SetBindingData(_hydroInfo, GetCalcuResultList()); |
| | | 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.barBtnSetReservoirList.ItemClick += delegate |
| | | { |
| | | var dlg = new HydroReservoirBulkSetListDlg(); |
| | | dlg.ShowDialog(); |
| | | //var dlg = new HydroReservoirBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | { |
| | | var dlg = new HydroTankBulkSetListDlg(); |
| | | dlg.ShowDialog(); |
| | | //var dlg = new HydroTankBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ItemClick += delegate |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroWaterboxBulkSetListDlg(); |
| | | 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(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | | { |
| | | var dlg = new HydroJunctionBulkSetListDlg(); |
| | | dlg.ShowDialog(); |
| | | //var dlg = new HydroJunctionBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ItemClick += delegate |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroBluntheadBulkSetListDlg(); |
| | | 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(); |
| | | }; |
| | | //弯头 |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroElbowBulkSetListDlg(); |
| | | 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(); |
| | | }; |
| | | //三通 |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroThreelinkBulkSetListDlg(); |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroFourlinkBulkSetListDlg(); |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroMeterBulkSetListDlg(); |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroFlowmeterBulkSetListDlg(); |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroPressmeterBulkSetListDlg(); |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroPipeBulkSetListDlg(); |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroPumpBulkSetListDlg(); |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroValveBulkSetListDlg(); |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _parter = parter; |
| | | if (_parter != null) |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | } |
| | | ShowProperty(); |
| | | }; |
| | |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | await Task.Delay(5000); |
| | | |
| | | //await Task.Delay(5000); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | |
| | | } |
| | | |
| | | }; |
| | | 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(); |
| | | _parter = allParterList?.Find(x => x.Code == first.Code); |
| | | _selectedParter = list.First(); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _parter = null; |
| | | _selectedParter = null; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | |
| | | } |
| | | |
| | | //显示查询控件 |
| | | 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 |
| | |
| | | { |
| | | _allGradingList = list; |
| | | }; |
| | | dlg.ApplyDataEvent += () => |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | ShowApplyGradingDlg(); |
| | | ApplyGrading(catalog, propName); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | return _allGradingApplyList; |
| | | } |
| | | |
| | | //颜色分级应用结果列表 |
| | | private List<HydroGradingApplyResultViewModel> _allGradingApplyResultList = null; |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList() |
| | | { |
| | |
| | | return default; |
| | | } |
| | | |
| | | //所有计算结果列表 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | _allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | //所有应用结果列表 |
| | | var allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | allGradingApplyList.ForEach(x => |
| | | { |
| | | var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList(); |
| | |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | _allGradingApplyResultList.Add(result); |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | }); |
| | | |
| | | return _allGradingApplyResultList; |
| | | return allGradingApplyResultList; |
| | | } |
| | | |
| | | //颜色分级编码列表 |
| | | private List<string> _allGradingCodeList = null; |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var currentGradingList = allGradingList.Where(x => x.Catalog == catalog).ToList(); |
| | | if (currentGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //当前分级应用 |
| | | var gradingApply = allGradingApplyList.Find(x => x.Code == catalog); |
| | | if (gradingApply == null) |
| | | { |
| | | return default; |
| | | } |
| | | gradingApply.PropName = propName; |
| | | |
| | | //所有计算结果 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //应用结果列表 |
| | | var gradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | |
| | | switch (catalog) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | |
| | | return gradingApplyResultList; |
| | | } |
| | | |
| | | //颜色分级是否应用了 |
| | | private bool _isGradingApply = false; |
| | | //颜色分级应用编码列表 |
| | | private List<string> _allGradingApplyCodeList = null; |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading() |
| | |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(); |
| | | _allGradingCodeList = allGradingApplyResultList?.Select(x => x.Code).Distinct().ToList(); |
| | | var objGroupList = allGradingApplyResultList?.GroupBy(x => x.Color).ToList(); |
| | | objGroupList?.ForEach(async x => |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | CancelApplyGrading(); |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | _allGradingApplyCodeList = allGradingApplyResultList.Select(x => x.Code).Distinct().ToList(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(catalog, propName); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | var codeList = allGradingApplyResultList.Select(x => x.Code); |
| | | if (_allGradingApplyCodeList == null) |
| | | { |
| | | _allGradingApplyCodeList = new List<string>(); |
| | | } |
| | | _allGradingApplyCodeList.AddRange(codeList); |
| | | _allGradingApplyCodeList = _allGradingApplyCodeList.Distinct().ToList(); |
| | | } |
| | | |
| | | //自动应用颜色分级 |
| | | private void AutoApplyGrading() |
| | | { |
| | | if (!_isGradingApply) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | } |
| | | |
| | | //取消应用颜色分级 |
| | | private async void CancelApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = false; |
| | | if (_allGradingApplyCodeList != null && _allGradingApplyCodeList.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingApplyCodeList); |
| | | } |
| | | } |
| | | |
| | | //显示应用颜色分级窗体 |
| | |
| | | } |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(allGradingApplyList); |
| | | dlg.ReloadDataEvent += async (obj) => |
| | | dlg.ReloadDataEvent += (obj) => |
| | | { |
| | | _allGradingApplyList = obj; |
| | | ApplyGrading(); |
| | |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowApplyGradingDlg(); |
| | | } |
| | | |
| | | //取消应用分级 |
| | | private void batBtnCancelGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | CancelApplyGrading(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _parter = null; |
| | | _selectedParter = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | ShowProperty(); |
| | | 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 |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |