using System; using System.Collections.Generic; using System.Windows.Forms; using System.IO; using System.Text; using System.Linq; using HydrEngineCSharp; namespace DPumpHydr.WinFrmUI.Volute { public partial class MainViewPage { OccDesign3DCtrl _occDesign3dCtrl; OccDesign2DCtrl _occDesign2dCtrl; DesignMainDockPanel _designMainDockPanel; 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( ); this._designMainDockPanel = new DesignMainDockPanel(); this._designMainDockPanel.Size = new System.Drawing.Size(1000, 1000); this._designMainDockPanel.Name = "OccDesignCtrl"; this._designMainDockPanel.Dock = DockStyle.Fill; this._designMainDockPanel.DockText = "设计视图"; _designMainDockPanel.SetOccCtrl(_occDesign3dCtrl, _occDesign2dCtrl); MainDockPanel.AddContent(_designMainDockPanel); } /// /// 更新1-8 /// /// private List RefreshSectShapeWhole18(ViewModel.SectionBundleInfo bundle) { var ret = this._occDesign3dCtrl.RefreshAllSectShape18(bundle); this._occDesign2dCtrl.RefreshAllSectShape18(bundle); this._sectAreaDockPanel.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(ViewModel.SectionShapePara para) { this._sectionBundleInfo.FromSectionShapePara(para); this._occDesign3dCtrl.RefreshSingleSectShape18(para); this._occDesign2dCtrl.RefreshSingleSectShape18(para); this._sectAreaDockPanel.SetArea18(para); } private bool _isHaveCreateWaterBody2d = false; private ViewModel.OtuflowParasCalcReponse EditWaterBody2D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas) { if (outflowParas == null || outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 || outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0) return null; HydrGeomSplineParam hydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(outflowParas); if (hydrGeomSplineParam != null && !hydrGeomSplineParam.IsEmpty()) { ViewModel.OtuflowParasCalcReponse rep = new ViewModel.OtuflowParasCalcReponse(); rep.GeSheAngle = this._occDesign2dCtrl.Get2DMidCurveAngleParam(); return rep; } else { return null; } } private ViewModel.OtuflowParasCalcReponse RefreshWaterBody2D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas) { if (outflowParas == null || outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 || outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0) return null; if (_isHaveCreateWaterBody2d == true) { return EditWaterBody2D(outflowParas); } var hydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(outflowParas); if (hydrGeomSplineParam != null && !hydrGeomSplineParam.IsEmpty()) { _isHaveCreateWaterBody2d = true; ViewModel.OtuflowParasCalcReponse rep = new ViewModel.OtuflowParasCalcReponse(); rep.GeSheAngle = this._occDesign2dCtrl.Get2DMidCurveAngleParam(); return rep; } else { return null; } } private bool _isHaveCreateWaterBody3d = false; private ViewModel.OtuflowParasCalcReponse RefreshWaterBody3D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas) { if (outflowParas == null || outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 || outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0) return null; this._sectAreaDockPanel.SetAreaOutletDia(outflowParas.Dia); this._outflowParas = outflowParas; if (_isHaveCreateWaterBody3d == true) { var theHydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(outflowParas); if (theHydrGeomSplineParam != null) { this._occDesign3dCtrl.Edit3DWaterBody(outflowParas, theHydrGeomSplineParam); //this._occDesign3dCtrl.SetWaterBodyVisible(true); return BuildRefreshWaterBodyReponse(); } return null; } var hydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(outflowParas); if (hydrGeomSplineParam != null && !hydrGeomSplineParam.IsEmpty()) { _isHaveCreateWaterBody3d = true; //ViewModel.OtuflowParasCalcReponse rep = new ViewModel.OtuflowParasCalcReponse(); //rep.GeSheAngle = this._occDesign2dCtrl.Get2DMidCurveAngleParam(); this._occDesign3dCtrl.Create3DWaterBody(outflowParas, hydrGeomSplineParam); this._occDesign3dCtrl.SetWaterBodyVisible(true); return BuildRefreshWaterBodyReponse(); } else { return null; } } private double _sect9Posi = 0.25; private double _sect10Posi = 0.65; private ViewModel.OtuflowParasCalcReponse BuildRefreshWaterBodyReponse() { ViewModel.OtuflowParasCalcReponse rep = new ViewModel.OtuflowParasCalcReponse(); rep.GeSheAngle = this._occDesign2dCtrl.Get2DMidCurveAngleParam(); rep.SectArea9 = this._occDesign3dCtrl.GetSectArea9(_sect9Posi); rep.SectArea10 = this._occDesign3dCtrl.GetSectArea10(_sect10Posi); this._sectAreaDockPanel.SetArea9 (rep.SectArea9); this._sectAreaDockPanel.SetArea10(rep.SectArea10); return rep; } } }