using DPumpHydr.OpenFwUI.Volute.截面面积; using DPumpHydr.OpenModel; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace DPumpHydr.OpenFwUI.Volute { public partial class StepForm1 : Form { OccDesign3DCtrl _occDesign3dCtrl; OccDesign2DCtrl _occDesign2dCtrl; OccDesignBaseCtrl _occDesignCtrl; DPumpHydr.OpenFwUI.Volute.HdrBaseInfo _hdrBaseInfo = null; DPumpHydr.OpenFwUI.Volute.GeomBaseInfo _geomBaseInfo = null; DPumpHydr.OpenFwUI.Volute.SectionBundleInfo _sectionBundleInfo = null; public StepForm1() { InitializeComponent(); InitialDesginPanel(); //ctrlSectionBundleInfo1.ShowPage(_hdrBaseInfo, _geomBaseInfo, DPumpHydr.OpenFwUI.Volute.eWizardStepDiretion.前进, true); } public void SetBindingData(DesignParameter designParameter) { if (_hdrBaseInfo == null) _hdrBaseInfo = new HdrBaseInfo(); if (_geomBaseInfo == null) _geomBaseInfo = new GeomBaseInfo(); _hdrBaseInfo.ModelToThis(designParameter.HdrBaseInfo); _geomBaseInfo.ModelToThis(designParameter.GeomBaseInfo); if(_hdrBaseInfo.ns == 0) { _hdrBaseInfo.CalcNs(); } if(designParameter.SectionBundleInfo != null) { _sectionBundleInfo.ModelToThis(designParameter.SectionBundleInfo); } EnterStep2(); SaveParaStep2(); this.sectAreaDockPanel11.SetArea18(_sectionBundleInfo); sectAreaDockPanel11.OnRefreshSingleSectArea += (sect_index, sect_area) => { this.ctrlSectionBundleInfo1.RefreshSingleSectArea(sect_index, sect_area); }; } public ApiResult GetBindingData() { ApiResult apiResult = new ApiResult(); apiResult.DesignParameter = new DesignParameter(); apiResult.DesignParameter.HdrBaseInfo = new OpenModel.HdrBaseInfo(); apiResult.DesignParameter.GeomBaseInfo = new OpenModel.GeomBaseInfo(); apiResult.DesignParameter.SectionBundleInfo = new OpenModel.SectionBundleInfo(); apiResult.DesignParameter.HdrBaseInfo = _hdrBaseInfo.ThisToModel(); apiResult.DesignParameter.GeomBaseInfo = _geomBaseInfo.ThisToModel(); apiResult.DesignParameter.SectionBundleInfo = _sectionBundleInfo.ThisToModel(); var OccAllVoluteCurve = _occDesign3dCtrl.GetBindingData(1); apiResult.ComponentTree = new ComponentTree(); apiResult.ComponentTree.ComponentTreeSection(OccAllVoluteCurve); //apiResult.ComponentTree.Section1 = _occDesign3dCtrl.GetBindingData(1); return apiResult; } //private void EnterStep2(long last_step_id) private void EnterStep2() { if (_hdrBaseInfo == null || _geomBaseInfo == null) return; this._occDesign2dCtrl.RemoveThicknessBody(); this._occDesign2dCtrl.RemoveWaterBody(); this._occDesign2dCtrl.RemoveSectCurve910(); this._occDesign2dCtrl.RemoveMidCurve(); this._occDesign2dCtrl.SetAllSectionCurveVisible(true); this._occDesign2dCtrl.FitView(); this._occDesign3dCtrl.RemoveThicknessBody(); this._occDesign3dCtrl.RemoveWaterBody(); this._occDesign3dCtrl.RemoveSectCurve910(); this._occDesign3dCtrl.RemoveMidCurve(); this._occDesign3dCtrl.SetAllSectionCurveVisible(true); this._occDesign3dCtrl.FitView(); CreateSectionStepCtrl(); //_isHaveCreateWaterBody3d = false; DPumpHydr.OpenFwUI.Volute.eWizardStepDiretion step_direction = DPumpHydr.OpenFwUI.Volute.eWizardStepDiretion.前进; //if (last_step_id > this._stepTreeDockPanel.Step_ID_Section18_Full) // step_direction = DPumpHydr.ViewModel.eWizardStepDiretion.后退; ctrlSectionBundleInfo1.ShowPage(_hdrBaseInfo, _geomBaseInfo, step_direction, true); //DockStepParaCtrl(_ctrlSectionBundleInfo); this.sectAreaDockPanel11.RefreshControl(); this.sectAreaDockPanel11.Visible = true; } private void InitialDesginPanel() { this._occDesign3dCtrl = new OccDesign3DCtrl(); this._occDesign3dCtrl.Size = new System.Drawing.Size(1000, 1000); this._occDesign3dCtrl.Name = "OccDesignCtrl3d"; this._occDesign3dCtrl.Dock = DockStyle.Fill; this._occDesign3dCtrl.Initial(); this._occDesign2dCtrl = new OccDesign2DCtrl(); this._occDesign2dCtrl.Size = new System.Drawing.Size(1000, 1000); this._occDesign2dCtrl.Name = "OccDesignCtrl2d"; this._occDesign2dCtrl.Dock = DockStyle.Fill; this._occDesign2dCtrl.Initial(); panel4.Controls.Add(_occDesign3dCtrl); panel5.Controls.Add(_occDesign2dCtrl); } private bool SaveParaStep2() { string error_info; var sectionBaseInfo = ctrlSectionBundleInfo1.GetBindingData(out error_info); if (sectionBaseInfo == null) { MessageBox.Show(error_info); return false; } _sectionBundleInfo = sectionBaseInfo; return true; } private void CreateSectionStepCtrl() { //ctrlSectionBundleInfo1 = new ctrlSectionBundleInfo(); //ctrlSectionBundleInfo1.Name = "ctrlSectionBaseInfo"; ctrlSectionBundleInfo1.OnRefreshShape += RefreshSectShapeWhole18; ctrlSectionBundleInfo1.OnHightLightSectCurve += HightLightSectCurve; //ctrlSectionBundleInfo1.OnNextStep += () => //{ // GoNextStep(); //}; } /// /// 更新1-8 /// /// private List RefreshSectShapeWhole18(DPumpHydr.OpenFwUI.Volute.SectionBundleInfo bundle) { var ret = this._occDesign3dCtrl.RefreshAllSectShape18(bundle); this._occDesign2dCtrl.RefreshAllSectShape18(bundle); this.sectAreaDockPanel11.SetArea18(bundle); if (ret == null || ret.Count() == 0) { this._sectionBundleInfo = bundle; } return ret; } /// /// 高亮某个截面 /// /// private void HightLightSectCurve(int sectIndex) { this._occDesign2dCtrl.HightLightSectCurve(sectIndex); this._occDesign3dCtrl.HightLightSectCurve(sectIndex); } //更新单个断面 private void RefreshSectShapeSingle18(DPumpHydr.OpenFwUI.Volute.SectionShapePara para) { this._sectionBundleInfo.FromSectionShapePara(para); this._occDesign3dCtrl.RefreshSingleSectShape18(para); this._occDesign2dCtrl.RefreshSingleSectShape18(para); this.sectAreaDockPanel11.SetArea18(para); } private void Form1_Load(object sender, EventArgs e) { this.CancelButton = button取消; } private void button确定_Click(object sender, EventArgs e) { var data = ctrlSectionBundleInfo1.GetBindingData(out string error); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); return; } _sectionBundleInfo = data; this.DialogResult = DialogResult.OK; this.Close(); } private void button取消_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; // 显式设置返回值 this.Close(); } } }