From: rnc Date: Mon, 9 Jul 2012 14:28:50 +0000 (+0000) Subject: EDF 2281: Added the possibility to choose the orientation of the divided disk X-Git-Tag: V6_6_0a1~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a878bd540833e8164cec70ce481e9a021cb18e65;p=modules%2Fgeom.git EDF 2281: Added the possibility to choose the orientation of the divided disk --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index d61328dea..cf3d1bc68 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3765,7 +3765,7 @@ module GEOM * \param theRatio Relative size of the central square diagonal against the disk diameter * \return New GEOM_Object, containing the created shape. */ - GEOM_Object MakeDividedDisk (in double theR, in double theRatio); + GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index e7c538402..5f1295a4d 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -617,7 +617,7 @@ module GEOM in double theRF, in boolean theHexMesh, in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); - GEOM_Object MakeDividedDisk (in double theR, in double theRatio); + GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx index 13d45c6cf..6e34b8e4a 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -58,12 +58,21 @@ AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometry mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->close(); - GroupParams = new DlgRef_1Spin(centralWidget()); + GroupParams = new DlgRef_1Spin(centralWidget()); + GroupParams->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupParams->TextLabel1->setText(tr("GEOM_RADIUS")); + + GroupOrientation = new DlgRef_3Radio(centralWidget()); + GroupOrientation->GroupBox1->setTitle(tr("GEOM_ORIENTATION")); + GroupOrientation->RadioButton1->setText(tr("GEOM_WPLANE_OXY")); + GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ")); + GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX")); //@@ setup dialog box layout here @@// QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(GroupParams); + layout->addWidget(GroupOrientation); /***************************************************************/ setHelpFileName("create_divideddisk_page.html"); @@ -92,6 +101,9 @@ void AdvancedGUI_DividedDiskDlg::Init() // min, max, step and decimals for spin boxes & initial values initSpinBox(GroupParams->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" ); GroupParams->SpinBox_DX->setValue(100); + + GroupOrientation->RadioButton1->setChecked(true); + myOrientation = 1; // Signal/slot connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -100,6 +112,10 @@ void AdvancedGUI_DividedDiskDlg::Init() this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(GroupOrientation->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupOrientation->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupOrientation->RadioButton3, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); initName(tr("GEOM_DIVIDEDDISK")); @@ -160,6 +176,34 @@ void AdvancedGUI_DividedDiskDlg::enterEvent (QEvent*) ActivateThisDialog(); } +//================================================================================= +// function : RadioBittonClicked() +// purpose : Radio button management +//================================================================================= +void AdvancedGUI_DividedDiskDlg::RadioButtonClicked() +{ + if (GroupOrientation->RadioButton1->isChecked()) + myOrientation = 1; + else if (GroupOrientation->RadioButton2->isChecked()) + myOrientation = 2; + else if (GroupOrientation->RadioButton3->isChecked()) + myOrientation = 3; + +// gp_Pnt theOrigin = gp::Origin(); +// gp_Dir DirZ = gp::DZ(); +// gp_Dir DirX = gp::DX(); +// gp_Dir DirY = gp::DY(); +// +// if (GroupOrientation->RadioButton1->isChecked()) +// myWPlane = gp_Ax3(theOrigin, DirZ, DirX); +// else if (GroupOrientation->RadioButton2->isChecked()) +// myWPlane = gp_Ax3(theOrigin, DirX, DirY); +// else if (GroupOrientation->RadioButton3->isChecked()) +// myWPlane = gp_Ax3(theOrigin, DirY, DirZ); + + displayPreview(true); +} + //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -209,7 +253,7 @@ bool AdvancedGUI_DividedDiskDlg::execute (ObjectList& objects) CORBA::Double theRatio = 50; //@@ init parameter value from dialog box @@; // call engine function - anObj = anOper->MakeDividedDisk(theR, theRatio); + anObj = anOper->MakeDividedDisk(theR, theRatio, myOrientation); res = !anObj->_is_nil(); if (res && !IsPreview()) { diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h index 00da289da..5d3ff0a02 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.h @@ -25,6 +25,7 @@ #include class DlgRef_1Spin; +class DlgRef_3Radio; //================================================================================= // class : AdvancedGUI_DividedDiskDlg @@ -50,12 +51,15 @@ private: private: DlgRef_1Spin* GroupParams; + DlgRef_3Radio* GroupOrientation; + int myOrientation; private slots: void ClickOnOk(); bool ClickOnApply(); void ActivateThisDialog(); void ValueChangedInSpinBox(); + void RadioButtonClicked(); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx index c4869a941..40872d27b 100644 --- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx @@ -89,8 +89,9 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con if (aType == DIVIDEDDISK_R_RATIO) { // Getting data - double R = aData.GetR(); - double Ratio = aData.GetRatio(); + double R = aData.GetR(); + double Ratio = aData.GetRatio(); + int theOrientation = aData.GetOrientation(); // Geometry gp_Dir ZDir(0,0,1); @@ -218,8 +219,7 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con aBuilder.Add(S, F1); aBuilder.Add(S, F2); aBuilder.Add(S, F3); - - + // rotation V1=V1_60; V2=V2_60; @@ -238,7 +238,7 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con E8=E9; } - aShape = S; + aShape = TransformShape(S, theOrientation); } else { // other construction modes here @@ -253,6 +253,47 @@ Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) con return 1; } +//======================================================================= +//function : TrasformShape(int theOrientation) +//purpose : Perform shape transformation accordingly with specified +// orientation +//======================================================================= +TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape aShape, int theOrientation) const +{ + gp_Dir N, Vx; + gp_Pnt theOrigin = gp::Origin(); + + switch(theOrientation) + { + case 1: + { + N = gp::DZ(); + Vx = gp::DX(); + break; + } + case 2: + { + N = gp::DX(); + Vx = gp::DY(); + break; + } + case 3: + { + N = gp::DY(); + Vx = gp::DZ(); + break; + } + } + + gp_Ax3 aWPlane = gp_Ax3(theOrigin, N, Vx); + + gp_Trsf aTrans; + aTrans.SetTransformation(aWPlane); + aTrans.Invert(); + BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False); + return aTransformation.Shape(); +} + //======================================================================= //function : GEOMImpl_DividedDiskDriver_Type_ //purpose : diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx index 9ce52f7ed..b094969f6 100644 --- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx @@ -26,6 +26,7 @@ class Handle_Standard_Type; class GEOMImpl_DividedDiskDriver; +class TopoDS_Shape; Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver); @@ -116,6 +117,9 @@ public: { return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType)); } + +private: + TopoDS_Shape TransformShape(TopoDS_Shape aShape, int theOrientation) const; }; #endif // _GEOMImpl_DividedDiskDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 4f388aac2..97b56f1c4 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -2244,7 +2244,7 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou * \return New GEOM_Object, containing the created shape. */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio) +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio, int theOrientation) { SetErrorCode(KO); @@ -2262,6 +2262,7 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, aData.SetR(theR); aData.SetRatio(theRatio); + aData.SetOrientation(theOrientation); //Compute the resulting value try { @@ -2280,7 +2281,7 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, } //Make a Python command - GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theRatio << ")"; + GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ")"; SetErrorCode(OK); diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx index 627c2bef4..488301b4e 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -109,7 +109,7 @@ public: Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, Handle(GEOM_Object) P3 = 0); - Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio); + Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, int theOrientation); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx index 96eb5eec7..0f6b0205a 100644 --- a/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx +++ b/src/GEOMImpl/GEOMImpl_IDividedDisk.hxx @@ -24,8 +24,9 @@ #include "GEOM_Function.hxx" -#define DIVIDEDDISK_ARG_R 1 -#define DIVIDEDDISK_ARG_RATIO 2 +#define DIVIDEDDISK_ARG_R 1 +#define DIVIDEDDISK_ARG_RATIO 2 +#define DIVIDEDDISK_ARG_ORIENT 3 class GEOMImpl_IDividedDisk { @@ -37,6 +38,9 @@ public: void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); } double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); } + + void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); } + double GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); } private: Handle(GEOM_Function) _func; diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index 4f932f157..1bd4fc05a 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -330,7 +330,7 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO * \return New GEOM_Object, containing the created shape. */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio) +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation) { GEOM::GEOM_Object_var aGEOMObject; @@ -338,7 +338,7 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double GetOperations()->SetNotDone(); //Create the DividedDisk - Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio); + Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh index 52197095f..acf0e205f 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -63,7 +63,7 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i : CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Double theRF, CORBA::Boolean theHexMesh, GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); - GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio); + GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation); /*@@ insert new functions before this line @@ do not remove this line @@*/ ::GEOMImpl_IAdvancedOperations* GetOperations() diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index cac250787..817b79ded 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -3405,12 +3405,12 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::MakePipeTShapeFilletWithPosition //============================================================================= // MakeDividedDisk //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio, CORBA::Short theOrientation) { beginService( " GEOM_Superv_i::MakeDividedDisk" ); MESSAGE("GEOM_Superv_i::MakeDividedDisk"); getAdvancedOp(); - GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedDisk(theR, theRatio, theOrientation); endService( " GEOM_Superv_i::MakeDividedDisk" ); return anObj; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 3f968b961..0278160a6 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -706,7 +706,7 @@ public: CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Double theRF, CORBA::Boolean theHexMesh, GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); - GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio); + GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, CORBA::Double theRatio,CORBA::Short theOrientation ); /*@@ insert new functions before this line @@ do not remove this line @@*/ private: