| | |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | HydroWorkingVmo working |
| | | ) |
| | | { |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | _working = working; |
| | | _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); |
| | | this.PageTitle.Caption = $"水力模拟\r\n{_working.Name}"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | HydroWorkingVmo working |
| | |
| | | _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | _working = working; |
| | | _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); |
| | | this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}"; |
| | | if (_scheme == null) |
| | | { |
| | | this.PageTitle.Caption = $"水力模拟\r\n{_working.Name}"; |
| | | } |
| | | else |
| | | { |
| | | this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private HydroVisualPropertyViewCtrl _propertyCtrl = null; |
| | | private SimulationPropertyCtrl _propertyCtrl = null; |
| | | |
| | | //获取属性控件 |
| | | private HydroVisualPropertyViewCtrl GetPropertyCtrl() |
| | | private SimulationPropertyCtrl GetPropertyCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new HydroVisualPropertyViewCtrl(); |
| | | _propertyCtrl = new SimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.HydroViewEvent += (visualViewModel) => |
| | | _propertyCtrl.AllowEdit = false; |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(GetVisual(visualViewModel), eVisualSource.Property); |
| | | SelectVisual(visual, eVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | //清理属性控件 |
| | | private void ClearPropertyCtrl() |
| | | { |
| | | if (_propertyCtrl != null) |
| | | { |
| | | _propertyCtrl.SelectedObject = null; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | //获取可见构件 |
| | | private Yw.Model.HydroVisualInfo GetVisual(string code) |
| | | //重置可见列表 |
| | | private void ResetVisualList() |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return default; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | return visualListHelper.GetVisual(code); |
| | | var helper = GetVisualListHelper(); |
| | | helper.InitialData(_hydroInfo); |
| | | } |
| | | |
| | | //获取可见构件 |
| | | private Yw.Model.HydroVisualInfo GetVisual(HydroVisualViewModel visualViewModel) |
| | | private Yw.Model.HydroVisualInfo GetVisual(string code) |
| | | { |
| | | return GetVisual(visualViewModel?.Code); |
| | | var helper = GetVisualListHelper(); |
| | | var visual = helper.GetVisual(code); |
| | | return visual; |
| | | } |
| | | |
| | | //获取可见列表 |
| | | private List<Yw.Model.HydroVisualInfo> GetVisualList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | //获取水源列表 |
| | | private List<Yw.Model.HydroSourceInfo> GetSourceList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetSourceList(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 工况分析 |
| | | |
| | | //选择进口水源 |
| | | private void SelectInputSource() |
| | | { |
| | | var sources = GetSourceList(); |
| | | if (sources != null) |
| | | { |
| | | if (sources.Count == 1) |
| | | { |
| | | SelectVisual(sources[0], eVisualSource.None); |
| | | } |
| | | else |
| | | { |
| | | var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.进口)); |
| | | if (source != null) |
| | | { |
| | | SelectVisual(source, eVisualSource.None); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //精度评估 |
| | | private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | //dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //损失曲线 |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | SelectInputSource(); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowError("工况计算失败!"); |
| | | return; |
| | | } |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |