From 75d091c0e2c334e622fc74bb3d0c5e2099a4c1f3 Mon Sep 17 00:00:00 2001 From: rnc Date: Fri, 27 Jul 2012 09:18:14 +0000 Subject: [PATCH] EDF 2281 : Possibility to choose the division pattern for the cylinder and missing translations --- idl/GEOM_Gen.idl | 4 ++- idl/GEOM_Superv.idl | 3 +- .../AdvancedGUI_DividedCylinderDlg.cxx | 33 ++++++++++++++++++- .../AdvancedGUI_DividedCylinderDlg.h | 4 +++ .../AdvancedGUI_DividedDiskDlg.cxx | 3 +- src/GEOMGUI/GEOM_msg_en.ts | 12 +++++++ src/GEOMGUI/GEOM_msg_fr.ts | 12 +++++++ src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx | 6 ++-- src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx | 5 ++- src/GEOM_I/GEOM_IAdvancedOperations_i.cc | 6 ++-- src/GEOM_I/GEOM_IAdvancedOperations_i.hh | 4 ++- src/GEOM_I_Superv/GEOM_Superv_i.cc | 6 ++-- src/GEOM_I_Superv/GEOM_Superv_i.hh | 4 ++- 13 files changed, 89 insertions(+), 13 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 551283a94..a3819178c 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3804,7 +3804,9 @@ module GEOM * \param theH Height of the cylinder * \return New GEOM_Object, containing the created shape. */ - GEOM_Object MakeDividedCylinder (in double theR, in double theH); + GEOM_Object MakeDividedCylinder (in double theR, + in double theH, + in pattern thePattern ); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index a07c1789f..36c204b1d 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -620,7 +620,8 @@ module GEOM GEOM_Object MakeDividedDisk (in double theR, in double theRatio, in short theOrientation, in pattern thePattern); - GEOM_Object MakeDividedCylinder (in double theR, in double theH); + GEOM_Object MakeDividedCylinder (in double theR, in double theH, + in pattern thePattern); /*@@ insert new functions before this line @@ do not remove this line @@*/ }; diff --git a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx index fdd172abc..1d6d55edb 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.cxx @@ -62,10 +62,18 @@ AdvancedGUI_DividedCylinderDlg::AdvancedGUI_DividedCylinderDlg (GeometryGUI* the GroupParams->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); GroupParams->TextLabel1->setText(tr("GEOM_RADIUS")); GroupParams->TextLabel2->setText(tr("GEOM_HEIGHT")); + + GroupPattern = new DlgRef_3Radio(centralWidget()); + GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN")); + GroupPattern->RadioButton1->setText(tr("GEOM_SQUARE")); + GroupPattern->RadioButton2->setText(tr("GEOM_HEXAGON")); + GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); + GroupPattern->RadioButton3->close(); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(GroupParams); + layout->addWidget(GroupPattern); /***************************************************************/ setHelpFileName("create_dividedcylinder_page.html"); @@ -100,6 +108,9 @@ void AdvancedGUI_DividedCylinderDlg::Init() double aHeight = 300; GroupParams->SpinBox_DX->setValue(aRadius); GroupParams->SpinBox_DY->setValue(aHeight); + + GroupPattern->RadioButton1->setChecked(true); + myPattern = GEOM::SQUARE; // Signal/slot connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -109,6 +120,9 @@ void AdvancedGUI_DividedCylinderDlg::Init() connect(GroupParams->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupParams->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + + connect(GroupPattern->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); + connect(GroupPattern->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked())); initName(tr("GEOM_DIVIDEDCYLINDER")); @@ -125,6 +139,23 @@ void AdvancedGUI_DividedCylinderDlg::SetDoubleSpinBoxStep (double step) //@@ set double spin box step for all spin boxes here @@// } +//================================================================================= +// function : RadioButtonClicked() +// purpose : Radio button management +//================================================================================= +void AdvancedGUI_DividedCylinderDlg::RadioButtonClicked() +{ + QRadioButton* send = (QRadioButton*)sender(); + + // Division pattern + if (send == GroupPattern->RadioButton1) + myPattern = GEOM::SQUARE; + else if (send == GroupPattern->RadioButton2) + myPattern = GEOM::HEXAGON; + + displayPreview(true); +} + //================================================================================= // function : ClickOnOk() // purpose : @@ -218,7 +249,7 @@ bool AdvancedGUI_DividedCylinderDlg::execute (ObjectList& objects) CORBA::Double theH = GroupParams->SpinBox_DY->value(); // call engine function - anObj = anOper->MakeDividedCylinder(theR, theH); + anObj = anOper->MakeDividedCylinder(theR, theH, myPattern); res = !anObj->_is_nil(); if (res && !IsPreview()) { diff --git a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h index 60624d2ef..6cbf0363e 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_DividedCylinderDlg.h @@ -25,6 +25,7 @@ #include class DlgRef_2Spin; +class DlgRef_3Radio; //================================================================================= // class : AdvancedGUI_DividedCylinderDlg @@ -50,6 +51,8 @@ private: private: DlgRef_2Spin* GroupParams; + DlgRef_3Radio* GroupPattern; + GEOM::pattern myPattern; private slots: void ClickOnOk(); @@ -57,6 +60,7 @@ private slots: void ActivateThisDialog(); void ValueChangedInSpinBox(); void SetDoubleSpinBoxStep( double ); + void RadioButtonClicked(); }; #endif // ADVANCEDGUI_DIVIDEDCYLINDERDLG_H diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx index 44bf52392..85a4d099d 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -79,10 +79,11 @@ AdvancedGUI_DividedDiskDlg::AdvancedGUI_DividedDiskDlg (GeometryGUI* theGeometry GroupPattern = new DlgRef_3Radio(centralWidget()); GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN")); + GroupPattern->RadioButton1->setText(tr("GEOM_SQUARE")); + GroupPattern->RadioButton2->setText(tr("GEOM_HEXAGON")); GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); GroupPattern->RadioButton3->close(); - GroupPntVecR = new DlgRef_2Sel1Spin(centralWidget()); GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT")); diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 6a1488952..1da62ff22 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -838,6 +838,10 @@ Please, select face, shell or solid and try again GEOM_HEIGHT Height : + + GEOM_HEXAGON + Hexagon + GEOM_HOLES Holes @@ -1146,6 +1150,10 @@ Please, select face, shell or solid and try again GEOM_OFFSET_TITLE Offset Surface + + GEOM_PATTERN + Division pattern + GEOM_PROJECTION Projection @@ -1850,6 +1858,10 @@ Please, select face, shell or solid and try again GEOM_SPLINE_TITLE Spline Construction + + GEOM_SQUARE + Square + GEOM_START_LCS Start LCS diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index c23bc423e..75db6a8ae 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -838,6 +838,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_HEIGHT Hauteur: + + GEOM_HEXAGON + Héxagone + GEOM_HOLES Trous @@ -1146,6 +1150,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_OFFSET_TITLE Décaler une surface + + GEOM_PATTERN + Schema de découpe + GEOM_PROJECTION Projection @@ -1850,6 +1858,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_SPLINE_TITLE Construction d'un spline + + GEOM_SQUARE + Carré + GEOM_START_LCS SCL du Début diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 017c849cb..1532c0bc3 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -2367,14 +2367,16 @@ Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle * \return New GEOM_Object, containing the created shape. */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR, double theH) +Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR, + double theH, + int thePattern) { SetErrorCode(KO); //Add a new object Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER); - Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 50.0, 1, 0); + Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 67.0, 1, thePattern); aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0); diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx index 278ab2b80..a7c11d6ff 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -118,7 +118,10 @@ public: double theRatio, int thePattern); - Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR, double theH); + Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR, + double theH, + int thePattern); + /*@@ insert new functions before this line @@ do not remove this line @@*/ }; #endif diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index f30bc23b0..77310827f 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -387,7 +387,9 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM:: * \return New GEOM_Object, containing the created shape. */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH) +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern) { GEOM::GEOM_Object_var aGEOMObject; @@ -395,7 +397,7 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Do GetOperations()->SetNotDone(); //Create the DividedCylinder - Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH); + Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH, thePattern); 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 9e87ee201..fde5fcfa5 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -75,7 +75,9 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i : CORBA::Double theRatio, GEOM::pattern thePattern); - GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH); + GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern); /*@@ 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 cfb7a01f8..684558c07 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -3419,12 +3419,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedDisk (CORBA::Double theR, CORBA: //============================================================================= // MakeDividedCylinder //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern) { beginService( " GEOM_Superv_i::MakeDividedCylinder" ); MESSAGE("GEOM_Superv_i::MakeDividedCylinder"); getAdvancedOp(); - GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedCylinder(theR, theH); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeDividedCylinder(theR, theH, thePattern); endService( " GEOM_Superv_i::MakeDividedCylinder" ); return anObj; } diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 880dfcec5..3dd0192fe 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -708,7 +708,9 @@ public: 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, CORBA::Short theOrientation, GEOM::pattern thePattern); - GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH); + GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, + CORBA::Double theH, + GEOM::pattern thePattern); /*@@ insert new functions before this line @@ do not remove this line @@*/ private: -- 2.39.2