From e98de937b28d42493de5dea6365c853d6b412d3c Mon Sep 17 00:00:00 2001 From: chenn <gu.beic@qq.com> Date: 星期五, 11 四月 2025 17:06:10 +0800 Subject: [PATCH] 解决冲突 --- WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs | 369 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 256 insertions(+), 113 deletions(-) diff --git a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs index 02f37f5..a2ec9e5 100644 --- a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs +++ b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs @@ -41,7 +41,10 @@ } + public virtual void SetDimVisible(bool isVisible) + { + } protected void OnMouseDown(object sender, MouseEventArgs e) @@ -145,45 +148,63 @@ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - public void RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle) + public List<int> RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle) { if (_isFirstSectShape18) { - CreateSectShape18(bundle); + _isFirstSectShape18 = false; + return CreateSectShape18(bundle); } else { - EditSectShape18(bundle); - } - _isFirstSectShape18 = false; + return EditSectShape18(bundle); + } } - + protected double _sectStartAngle = -HydrDisplayEngineBridge.PI_4; + public double SectStartAngle + { + get + { + return _sectStartAngle; + } + set + { + _sectStartAngle = value; + } + } + /// <summary> /// /// </summary> /// <param name="bundle"></param> - protected void CreateSectShape18(ViewModel.SectionBundleInfo bundle) + protected List<int> CreateSectShape18(ViewModel.SectionBundleInfo bundle) { - //pDisplayView.Update3DViews(_is3D); + List<int> error_sect = new List<int>(); - double dStartAngle = -HydrDisplayEngineBridge.PI_4; - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; + double dStartAngle = _sectStartAngle; + + double dDetAngle = HydrDisplayEngineBridge.PI / 4; for (int i = 8; i >= 1; i--) { var theSectionParam = bundle.ToSectionShapePara(i); - double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius; + double dGama_Left, dGama_Right, dH, dR_out, dBaseWidth, dBaseCircleRadius; dGama_Left = theSectionParam.Gama_Left; dGama_Right = theSectionParam.Gama_Right; dH = theSectionParam.H; dR_out = theSectionParam.R_out; - dR_Left = theSectionParam.R_Left; - dR_Right = theSectionParam.R_Right; + double dR_Left = theSectionParam.R_Left; + double dR_Right = theSectionParam.R_Right; + if (dR_Left < 1) + dR_Left = 1; + if (dR_Right < 1) + dR_Right = 1; + dBaseWidth = theSectionParam.BaseWidth; dBaseCircleRadius = theSectionParam.BaseCircleRadius; - + HydrProperties theHydrProperties = new HydrProperties(); @@ -200,49 +221,50 @@ pHydrGeomCurve.SetHydrProperties(theHydrProperties); pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); - //if (_is3D) - //{ - // BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); - // BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); - // theMatrix.postMult(theMatrix1); - // pHydrGeomCurve.SetMatrix(theMatrix); - //} - pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve); + ToolTips tt = pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve); + if (tt == null || tt.GetTipsId() != 1) + { + error_sect.Add(theSectionParam.Index); + } } Invalidate(true); pDisplayView.FitAll3DViews(true); - + return error_sect; } /// <summary> /// /// </summary> /// <param name="bundle"></param> - protected void EditSectShape18(ViewModel.SectionBundleInfo bundle) + public List<int> EditSectShape18(ViewModel.SectionBundleInfo bundle) { - pDisplayView.Update3DViews(_is3D); + List<int> error_sect = new List<int>(); - double dStartAngle = -HydrDisplayEngineBridge.PI_4; + double dStartAngle = _sectStartAngle; - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; + double dDetAngle = HydrDisplayEngineBridge.PI / 4; for (int i = 1; i <= 8; i++) { var theSectionParam = bundle.ToSectionShapePara(i); - double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius; + double dGama_Left, dGama_Right, dH, dR_out, dBaseWidth, dBaseCircleRadius; dGama_Left = theSectionParam.Gama_Left; dGama_Right = theSectionParam.Gama_Right; dH = theSectionParam.H; dR_out = theSectionParam.R_out; - dR_Left = theSectionParam.R_Left; - dR_Right = theSectionParam.R_Right; + double dR_Left = theSectionParam.R_Left; + double dR_Right = theSectionParam.R_Right; dBaseWidth = theSectionParam.BaseWidth; dBaseCircleRadius = theSectionParam.BaseCircleRadius; + if (dR_Left < 1) + dR_Left = 1; + if (dR_Right < 1) + dR_Right = 1; string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index); @@ -262,31 +284,39 @@ pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); //if (_is3D) - //{ - + //{ // BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); // BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); // theMatrix.postMult(theMatrix1); // pHydrGeomCurve.SetMatrix(theMatrix); //} - pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve); + ToolTips tt = pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve); + //pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve); + if (tt == null || tt.GetTipsId() != 1) + { + error_sect.Add(theSectionParam.Index); + } } Invalidate(true); - - + pDisplayView.ShowTopoShape(TopoTypeDisplay.ESectionCurve); + return error_sect; } + /// <summary> + /// + /// </summary> + /// <param name="theSectionParam"></param> public void RefreshSingleSectShape18(ViewModel.SectionShapePara theSectionParam) { pDisplayView.Update3DViews(true); - double dStartAngle = -HydrDisplayEngineBridge.PI_4; + double dStartAngle = _sectStartAngle; - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; + double dDetAngle = HydrDisplayEngineBridge.PI / 4; double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius; @@ -299,7 +329,7 @@ dBaseWidth = theSectionParam.BaseWidth; dBaseCircleRadius = theSectionParam.BaseCircleRadius; - + HydrProperties theHydrProperties = new HydrProperties(); HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection); HydrGeomSection pHydrGeomCurve = theHydrGeomCurve as HydrGeomSection; @@ -314,26 +344,59 @@ pHydrGeomCurve.SetHydrProperties(theHydrProperties); pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); - + pDisplayView.editVoluteCurve(GlobalParas.BuildSectShapeName(theSectionParam.Index), pHydrGeomCurve); Invalidate(true); } + /// <summary> + /// 显示/隐藏1-8断面 + /// </summary> + /// <param name="isVisible"></param> public void SetAllSectionCurveVisible(bool isVisible) { for (int i = 8; i >= 1; i--) { string wstrShapeNameI = string.Format("SectShape_{0}", i); - if(isVisible) + if (isVisible) pDisplayView.showVoluteCurve(wstrShapeNameI); else pDisplayView.hideVoluteCurve(wstrShapeNameI); } } + /// <summary> + /// 显示/隐藏9、10断面 + /// </summary> + /// <param name="isVisible"></param> + public void SetAllSection910CurveVisible(bool isVisible) + { + for (int i = 10; i >= 9; i--) + { + string wstrShapeNameI = string.Format("SectShape_{0}", i); + if (isVisible) + pDisplayView.showVoluteCurve(wstrShapeNameI); + else + pDisplayView.hideVoluteCurve(wstrShapeNameI); + } + } + /// <summary> + /// + /// </summary> + /// <param name="sectIndex"></param> + public void HightLightSectCurve(int sectIndex) + { + for (int i = 1; i <= 8; i++) + { + if (i == sectIndex) + this.pDisplayView.setVoluteCurveClr(i, 255, 20, 147); + else + this.pDisplayView.setVoluteCurveClr(i, 75, 0, 130); + } - + Invalidate(true); + } #endregion @@ -341,27 +404,17 @@ #region 水体 - public HydrGeomSplineParam Create2DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas ) + public bool Create2DWaterBody(HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomArcCurve) { if (this._is3D) - return null; - WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); - theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); - theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); - theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); - theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); - theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); - theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); - theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); - theWaterBodyOuterParam.SetH1(outflowParas.H1); - theWaterBodyOuterParam.SetH2(outflowParas.H2); - theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); + return false; - ToolTips theToolTips = pDisplayView.build2DMidCurve(theWaterBodyOuterParam); + + ToolTips theToolTips = this.pDisplayView.build2DMidCurve(pHydrGeomArcCurve); if (theToolTips == null) - return null; + return false; Invalidate(true); pDisplayView.FitAll3DViews(true); @@ -372,90 +425,180 @@ if (theToolTips.GetTipsId() == 1) { - return pDisplayView.getHydrGeomSplineParam(); + return true; } else { - return null; + pDisplayView.ClearTopoShape(TopoTypeDisplay.E2DMidCurve); + MessageBox.Show(theToolTips.GetToolTips(), "2D提示"); + return false; } } - - public void Create3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam) + public bool Create2DWaterBody(HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve) + { + if (this._is3D) + return false ; + + + + + ToolTips theToolTips = this.pDisplayView.build2DMidCurve(pHydrGeomCurve); + if (theToolTips == null) + return false ; + Invalidate(true); + pDisplayView.FitAll3DViews(true); + + pDisplayView.set2DMidCurveClr( + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.R, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.G, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.B); + + if (theToolTips.GetTipsId() == 1) + { + return true ; + } + else + { + pDisplayView.ClearTopoShape(TopoTypeDisplay.E2DMidCurve); + MessageBox.Show(theToolTips.GetToolTips(), "2D提示"); + return false ; + } + } + + public HydrEngineCSharp.ToolTips Create3DWaterBody(HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve) { if (!this._is3D) - return; - if (theHydrGeomSplineParam == null) - return; - - WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); - theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); - theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); - theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); - theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); - theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); - theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); - theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); - theWaterBodyOuterParam.SetH1(outflowParas.H1); - theWaterBodyOuterParam.SetH2(outflowParas.H2); - theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); - - - - // HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomCircle); + return null; + HydrProperties theHydrProperties = new HydrProperties(); theHydrProperties.SetShapeGuid(DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyShapeName); theHydrProperties.SetShapeColor( DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R, DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G, DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256); - // theHydrGeomCurve.SetHydrProperties(theHydrProperties); + if (pDisplayView.hasBuildThicknessBody()) - pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); - pDisplayView.buildWaterBody(theHydrProperties, theHydrGeomSplineParam, theWaterBodyOuterParam); + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); + var tt = pDisplayView.buildWaterBody(theHydrProperties, pHydrGeomCurve); + if (tt.GetTipsId() != 1) + { + MessageBox.Show(tt.GetToolTips(), "3D提示"); + } Invalidate(true); pDisplayView.FitAll3DViews(true); + return tt; } - - - - public void Edit3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam) + public HydrEngineCSharp.ToolTips Create3DWaterBody(HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomArcCurve) { if (!this._is3D) - return; + return null; + HydrProperties theHydrProperties = new HydrProperties(); + theHydrProperties.SetShapeGuid(DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyShapeName); + theHydrProperties.SetShapeColor( + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256); - if (theHydrGeomSplineParam != null) + if (pDisplayView.hasBuildThicknessBody()) + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); + var tt = pDisplayView.buildWaterBody(theHydrProperties, pHydrGeomArcCurve); + if (tt.GetTipsId() != 1) { - WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); - theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); - theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); - theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); - theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); - theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); - theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); - theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); - theWaterBodyOuterParam.SetH1(outflowParas.H1); - theWaterBodyOuterParam.SetH2(outflowParas.H2); - theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); - - if (pDisplayView.hasBuildThicknessBody()) - pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody);// - - pDisplayView.rebuildWaterBody(theHydrGeomSplineParam, theWaterBodyOuterParam); - Invalidate(true); - //pDisplayView.FitAll3DViews(true); + MessageBox.Show(tt.GetToolTips(), "3D提示"); } + Invalidate(true); + pDisplayView.FitAll3DViews(true); + + + return tt; } - /// <summary> - /// 割舌的角度 - /// </summary> - /// <returns></returns> - public double Get2DMidCurveAngleParam() + public HydrEngineCSharp.ToolTips Edit3DWaterBody(HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve) { - return pDisplayView.get2DMidCurveAngleParam(); + if (!this._is3D) + return null; + if (pDisplayView.hasBuildThicknessBody()) + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); + + var tt = pDisplayView.rebuildWaterBody(pHydrGeomCurve); + if (tt == null) + return null; + if (tt.GetTipsId() != 1) + { + pDisplayView.ClearTopoShape(TopoTypeDisplay.EWaterBody); + pDisplayView.FitAll3DViews(true); + MessageBox.Show(tt.GetToolTips(), "3D提示"); + } + Invalidate(true); + + return tt; } + + public HydrEngineCSharp.ToolTips Edit3DWaterBody(HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomArcCurve) + { + if (!this._is3D) + return null; + if (pDisplayView.hasBuildThicknessBody()) + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); + + var tt = pDisplayView.rebuildWaterBody(pHydrGeomArcCurve); + if (tt == null) + return null; + if (tt.GetTipsId() != 1) + { + pDisplayView.ClearTopoShape(TopoTypeDisplay.EWaterBody); + pDisplayView.FitAll3DViews(true); + MessageBox.Show(tt.GetToolTips(), "3D提示"); + } + Invalidate(true); + + return tt; + } + #endregion + public virtual bool RemoveThicknessBody() + { + return pDisplayView.RemoveShow(TopoTypeDisplay.EThicknessBody); + } + public virtual bool RemoveWaterBody() + { + return pDisplayView.RemoveShow(TopoTypeDisplay.EWaterBody); + } + public virtual bool RemoveMidCurve() + { + return pDisplayView.RemoveShow(TopoTypeDisplay.E2DMidCurve); + } + public virtual bool RemoveSectCurve910() + { + pDisplayView.removeOuterSectionCurve(10); + return pDisplayView.removeOuterSectionCurve( 9); + } + public virtual bool HideSectCurve18() + { + for (int i= 1;i <= 8;i++) + pDisplayView.hideOuterSectionCurve(i); + return true; + } + public bool HideAll() + { + var ret = pDisplayView.HideTopoShape(TopoTypeDisplay.EAllBody); + //bool bSucc = pDisplayView.BeginTurbopumpTopoShape(DPumpHydr.WinFrmUI.Volute.GlobalParas.RootTopoShapeName); + Invalidate(true); + + return ret; + } + public bool ClearAll() + { + _isFirstSectShape18 = true; + var ret = pDisplayView.ClearTopoShape(TopoTypeDisplay.EAllBody); + //bool bSucc = pDisplayView.BeginTurbopumpTopoShape(DPumpHydr.WinFrmUI.Volute.GlobalParas.RootTopoShapeName); + Invalidate(true); + return ret; + } - + public void FitView() + { + pDisplayView.FitAll3DViews(true); + } } } -- Gitblit v1.9.3