Back to index

salome-geom  6.5.0
TransformationGUI_RotationDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // GEOM GEOMGUI : GUI for Geometry component
00024 // File   : TransformationGUI_RotationDlg.cxx
00025 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
00026 
00027 #include "TransformationGUI_RotationDlg.h"
00028 
00029 #include <DlgRef.h>
00030 #include <GeometryGUI.h>
00031 #include <GEOMBase.h>
00032 
00033 #include <SUIT_Session.h>
00034 #include <SUIT_ResourceMgr.h>
00035 #include <SalomeApp_Application.h>
00036 #include <LightApp_SelectionMgr.h>
00037 
00038 // OCCT Includes
00039 #include <TopoDS_Shape.hxx>
00040 #include <TopoDS_Edge.hxx>
00041 #include <TopoDS.hxx>
00042 #include <TopExp.hxx>
00043 #include <TColStd_IndexedMapOfInteger.hxx>
00044 #include <TopTools_IndexedMapOfShape.hxx>
00045 
00046 #include <GEOMImpl_Types.hxx>
00047 
00048 //=================================================================================
00049 // class    : TransformationGUI_RotationDlg()
00050 // purpose  : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the
00051 //            name 'name' and widget flags set to 'f'.
00052 //            The dialog will by default be modeless, unless you set 'modal' to
00053 //            TRUE to construct a modal dialog.
00054 //=================================================================================
00055 TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
00056 (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl)
00057   : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
00058     myInitial(true)
00059 {
00060   SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
00061   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION")));
00062   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
00063   QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ROTATION_THREE_POINTS")));
00064 
00065   setWindowTitle(tr("GEOM_ROTATION_TITLE"));
00066 
00067   /***************************************************************/
00068   mainFrame()->GroupConstructors->setTitle(tr("GEOM_ROTATION"));
00069   mainFrame()->RadioButton1->setIcon(image0);
00070   mainFrame()->RadioButton2->setIcon(image2);
00071   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
00072   mainFrame()->RadioButton3->close();
00073 
00074   GroupPoints = new DlgRef_4Sel1Spin2Check(centralWidget());
00075   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
00076   GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
00077   GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
00078   GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
00079   GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
00080   GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
00081 
00082   GroupPoints->LineEdit1->setReadOnly(true);
00083   GroupPoints->LineEdit2->setReadOnly(true);
00084   GroupPoints->LineEdit4->setReadOnly(true);
00085   GroupPoints->LineEdit5->setReadOnly(true);
00086   GroupPoints->PushButton1->setIcon(image1);
00087   GroupPoints->PushButton2->setIcon(image1);
00088   GroupPoints->PushButton4->setIcon(image1);
00089   GroupPoints->PushButton5->setIcon(image1);
00090   GroupPoints->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
00091   GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
00092 
00093   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
00094   layout->setMargin(0); layout->setSpacing(6);
00095   layout->addWidget(GroupPoints);
00096   /***************************************************************/
00097 
00098   setHelpFileName("rotation_operation_page.html");
00099 
00100   // Activate Create a Copy mode
00101   GroupPoints->CheckButton1->setChecked(true);
00102   CreateCopyModeChanged();
00103 
00104   Init();
00105 }
00106 
00107 //=================================================================================
00108 // function : ~TransformationGUI_RotationDlg()
00109 // purpose  : Destroys the object and frees any allocated resources
00110 //=================================================================================
00111 TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
00112 {
00113   // no need to delete child widgets, Qt does it all for us
00114 }
00115 
00116 //=================================================================================
00117 // function : Init()
00118 // purpose  :
00119 //=================================================================================
00120 void TransformationGUI_RotationDlg::Init()
00121 {
00122   double anAngle = 0;
00123   double SpecificStep = 5;
00124 
00125   // min, max, step and decimals for spin boxes & initial values
00126   initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, "angle_precision" );
00127   GroupPoints->SpinBox_DX->setValue(anAngle);
00128 
00129   // init variables
00130   GroupPoints->LineEdit1->setText("");
00131   GroupPoints->LineEdit2->setText("");
00132   GroupPoints->LineEdit4->setText("");
00133   GroupPoints->LineEdit5->setText("");
00134 
00135   myObjects.clear();
00136   myAxis.nullify();
00137   myCentPoint.nullify();
00138   myPoint1.nullify();
00139   myPoint2.nullify();
00140 
00141   mainFrame()->GroupBoxPublish->show();
00142 
00143   // signals and slots connections
00144   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
00145   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
00146 
00147   connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
00148 
00149   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
00150   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
00151   connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
00152   connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
00153 
00154   connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
00155 
00156   connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )),
00157           this, SLOT(TextValueChangedInSpinBox( const QString&)));
00158 
00159   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged()));
00160   connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
00161 
00162   initName(tr("GEOM_ROTATION"));
00163 
00164   ConstructorsClicked(0);
00165 }
00166 
00167 //=================================================================================
00168 // function : ConstructorsClicked()
00169 // purpose  : Radio button management
00170 //=================================================================================
00171 void TransformationGUI_RotationDlg::ConstructorsClicked (int constructorId)
00172 {
00173   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
00174 
00175   switch (constructorId) {
00176   case 0: // rotation an object angle and axis
00177     {
00178       GroupPoints->ShowRows(2, 3, false);
00179       GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
00180       GroupPoints->LineEdit2->clear();
00181       GroupPoints->ShowRows(4, 4, true);
00182 
00183       myAxis.nullify();
00184 
00185       GroupPoints->PushButton1->click();
00186     }
00187     break;
00188   case 1: // rotation an object by 3 points
00189     {
00190       GroupPoints->ShowRows(4, 4, false);
00191       GroupPoints->ShowRows(2, 3, true);
00192       GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
00193       GroupPoints->TextLabel4->setText(tr("GEOM_POINT_I").arg(1));
00194       GroupPoints->TextLabel5->setText(tr("GEOM_POINT_I").arg(2));
00195 
00196       GroupPoints->LineEdit2->clear();
00197       GroupPoints->LineEdit4->clear();
00198       GroupPoints->LineEdit5->clear();
00199 
00200       myCentPoint.nullify();
00201       myPoint1.nullify();
00202       myPoint2.nullify();
00203 
00204       GroupPoints->PushButton1->click();
00205     }
00206     break;
00207   }
00208 
00209   qApp->processEvents();
00210   updateGeometry();
00211   resize(minimumSizeHint());
00212 
00213   if (myInitial) {
00214     myInitial = false;
00215     SelectionIntoArgument();
00216   }
00217   else {
00218     processPreview();
00219   }
00220 }
00221 
00222 //=================================================================================
00223 // function : ClickOnOk()
00224 // purpose  :
00225 //=================================================================================
00226 void TransformationGUI_RotationDlg::ClickOnOk()
00227 {
00228   setIsApplyAndClose( true );
00229   if (ClickOnApply())
00230     ClickOnCancel();
00231 }
00232 
00233 //=================================================================================
00234 // function : ClickOnApply()
00235 // purpose  :
00236 //=================================================================================
00237 bool TransformationGUI_RotationDlg::ClickOnApply()
00238 {
00239   if (!onAccept(GroupPoints->CheckButton1->isChecked()))
00240     return false;
00241 
00242   initName();
00243 
00244   // activate selection and connect selection manager
00245   ConstructorsClicked(getConstructorId());
00246   SelectionIntoArgument();
00247 
00248   return true;
00249 }
00250 
00251 //=================================================================================
00252 // function : SelectionIntoArgument()
00253 // purpose  : Called when selection is changed or on dialog initialization or activation
00254 //=================================================================================
00255 void TransformationGUI_RotationDlg::SelectionIntoArgument()
00256 {
00257   erasePreview();
00258 
00259   if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
00260     myObjects = getSelected( TopAbs_SHAPE, -1 );
00261     if ( !myObjects.isEmpty() ) {
00262       QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
00263       myEditCurrentArgument->setText( aName );
00264     }
00265     else {
00266       myEditCurrentArgument->setText("");
00267     }
00268   }
00269   else {
00270     TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0 ) ?
00271       TopAbs_EDGE : TopAbs_VERTEX;
00272     GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
00273     TopoDS_Shape aShape;
00274     if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
00275       QString aName = GEOMBase::GetName( aSelectedObject.get() );
00276       myEditCurrentArgument->setText( aName );
00277       if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
00278        if ( getConstructorId() == 0 ) {
00279          myAxis = aSelectedObject;
00280          if ( myObjects.isEmpty() )
00281            GroupPoints->PushButton1->click();
00282        }
00283        else if ( getConstructorId() == 1 ) {
00284          myCentPoint = aSelectedObject;
00285          if ( !myPoint1 )
00286            GroupPoints->PushButton4->click();
00287          else if ( !myPoint2 )
00288            GroupPoints->PushButton5->click();
00289          else if ( myObjects.isEmpty() )
00290            GroupPoints->PushButton1->click();
00291        }
00292       }
00293       else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) {
00294        myPoint1 = aSelectedObject;
00295        if ( !myPoint2 )
00296          GroupPoints->PushButton5->click();
00297        else if ( myObjects.isEmpty() )
00298          GroupPoints->PushButton1->click();
00299        else if ( !myCentPoint )
00300          GroupPoints->PushButton2->click();
00301       }
00302       else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) {
00303        myPoint2 = aSelectedObject;
00304        if ( myObjects.isEmpty() )
00305          GroupPoints->PushButton1->click();
00306        else if ( !myCentPoint )
00307          GroupPoints->PushButton2->click();
00308        else if ( !myPoint1 )
00309          GroupPoints->PushButton4->click();
00310       }
00311     }
00312     else {
00313       if (myEditCurrentArgument == GroupPoints->LineEdit2 ) {
00314        if ( getConstructorId() == 0 )
00315          myAxis.nullify();
00316        else if ( getConstructorId() == 1 )
00317          myCentPoint.nullify();
00318       }
00319       else if ( myEditCurrentArgument == GroupPoints->LineEdit4 ) {
00320        myPoint1.nullify();
00321       }
00322       else if ( myEditCurrentArgument == GroupPoints->LineEdit5 ) {
00323        myPoint2.nullify();
00324       }
00325       myEditCurrentArgument->setText("");
00326     }
00327   }
00328 
00329   processPreview();
00330 }
00331 
00332 //=================================================================================
00333 // function : SetEditCurrentArgument()
00334 // purpose  :
00335 //=================================================================================
00336 void TransformationGUI_RotationDlg::SetEditCurrentArgument()
00337 {
00338   QPushButton* send = (QPushButton*)sender();
00339 
00340   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
00341   globalSelection();
00342 
00343   if (send == GroupPoints->PushButton1) {
00344     myEditCurrentArgument = GroupPoints->LineEdit1;
00345 
00346     GroupPoints->PushButton2->setDown(false);
00347     GroupPoints->PushButton4->setDown(false);
00348     GroupPoints->PushButton5->setDown(false);
00349     GroupPoints->LineEdit2->setEnabled(false);
00350     GroupPoints->LineEdit4->setEnabled(false);
00351     GroupPoints->LineEdit5->setEnabled(false);
00352   }
00353   else if (send == GroupPoints->PushButton2) {
00354     myEditCurrentArgument = GroupPoints->LineEdit2;
00355 
00356     GroupPoints->PushButton1->setDown(false);
00357     GroupPoints->PushButton4->setDown(false);
00358     GroupPoints->PushButton5->setDown(false);
00359     GroupPoints->LineEdit1->setEnabled(false);
00360     GroupPoints->LineEdit4->setEnabled(false);
00361     GroupPoints->LineEdit5->setEnabled(false);
00362 
00363     if (getConstructorId() == 0)
00364       localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
00365     else
00366       localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
00367   }
00368   else if (send == GroupPoints->PushButton4) {
00369     myEditCurrentArgument = GroupPoints->LineEdit4;
00370 
00371     GroupPoints->PushButton1->setDown(false);
00372     GroupPoints->PushButton2->setDown(false);
00373     GroupPoints->PushButton5->setDown(false);
00374     GroupPoints->LineEdit1->setEnabled(false);
00375     GroupPoints->LineEdit2->setEnabled(false);
00376     GroupPoints->LineEdit5->setEnabled(false);
00377 
00378     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
00379   }
00380   else if (send == GroupPoints->PushButton5) {
00381     myEditCurrentArgument = GroupPoints->LineEdit5;
00382 
00383     GroupPoints->PushButton1->setDown(false);
00384     GroupPoints->PushButton2->setDown(false);
00385     GroupPoints->PushButton4->setDown(false);
00386     GroupPoints->LineEdit1->setEnabled(false);
00387     GroupPoints->LineEdit2->setEnabled(false);
00388     GroupPoints->LineEdit4->setEnabled(false);
00389 
00390     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
00391   }
00392   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
00393           this, SLOT(SelectionIntoArgument()));
00394 
00395   // enable line edit
00396   myEditCurrentArgument->setEnabled(true);
00397   myEditCurrentArgument->setFocus();
00398   // after setFocus(), because it will be setDown(false) when loses focus
00399   send->setDown(true);
00400 
00401   // seems we need it only to avoid preview disappearing, caused by selection mode change
00402   processPreview();
00403 }
00404 
00405 //=================================================================================
00406 // function : ActivateThisDialog()
00407 // purpose  :
00408 //=================================================================================
00409 void TransformationGUI_RotationDlg::ActivateThisDialog()
00410 {
00411   GEOMBase_Skeleton::ActivateThisDialog();
00412   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
00413            this, SLOT( SelectionIntoArgument() ) );
00414 
00415   ConstructorsClicked( getConstructorId() );
00416 }
00417 
00418 //=================================================================================
00419 // function : enterEvent()
00420 // purpose  :
00421 //=================================================================================
00422 void TransformationGUI_RotationDlg::enterEvent (QEvent*)
00423 {
00424   if (!mainFrame()->GroupConstructors->isEnabled())
00425     ActivateThisDialog();
00426 }
00427 
00428 void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
00429 {
00430   bool isDigit = true;
00431   s.toDouble(&isDigit);
00432   if(!isDigit) {
00433     GroupPoints->CheckButton2->setChecked(false);
00434   }
00435   GroupPoints->CheckButton2->setEnabled(isDigit); 
00436 }
00437 
00438 //=================================================================================
00439 // function : ValueChangedInSpinBox()
00440 // purpose  :
00441 //=================================================================================
00442 void TransformationGUI_RotationDlg::ValueChangedInSpinBox()
00443 {
00444   processPreview();
00445 }
00446 
00447 //=================================================================================
00448 // function : createOperation
00449 // purpose  :
00450 //=================================================================================
00451 GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
00452 {
00453   return getGeomEngine()->GetITransformOperations(getStudyId());
00454 }
00455 
00456 //=================================================================================
00457 // function : isValid
00458 // purpose  :
00459 //=================================================================================
00460 bool TransformationGUI_RotationDlg::isValid (QString& msg)
00461 {
00462   bool ok = false;
00463   switch (getConstructorId()) {
00464   case 0:
00465     ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty() && myAxis;
00466     break;
00467   case 1:
00468     ok = !myObjects.isEmpty() && myCentPoint && myPoint1 && myPoint2;
00469     break;
00470   default:
00471     break;
00472   }
00473   return ok;
00474 }
00475 
00476 //=================================================================================
00477 // function : execute
00478 // purpose  :
00479 //=================================================================================
00480 bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
00481 {
00482   bool res = false;
00483   bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
00484 
00485   GEOM::GEOM_Object_var anObj;
00486 
00487   GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
00488 
00489   switch (getConstructorId()) {
00490   case 0:
00491     {
00492       QStringList aParameters;
00493       aParameters<<GroupPoints->SpinBox_DX->text();
00494       if (toCreateCopy) {
00495         for (int i = 0; i < myObjects.count(); i++) {
00496           myCurrObject = myObjects[i];
00497           anObj = anOper->RotateCopy(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.);
00498           if (!anObj->_is_nil()) {
00499             if(!IsPreview()) {
00500               anObj->SetParameters(aParameters.join(":").toLatin1().constData());
00501             }
00502             objects.push_back(anObj._retn());
00503           }
00504         }
00505       }
00506       else {
00507         for (int i = 0; i < myObjects.count(); i++) {
00508           myCurrObject = myObjects[i];
00509           anObj = anOper->Rotate(myObjects[i].get(), myAxis.get(), GetAngle() * M_PI / 180.);
00510           if (!anObj->_is_nil()) {
00511             if(!IsPreview()) {
00512               anObj->SetParameters(aParameters.join(":").toLatin1().constData());
00513               updateAttributes(anObj, aParameters);
00514             }
00515             objects.push_back(anObj._retn());
00516           }
00517         }
00518       }
00519       res = true;
00520       break;
00521     }
00522   case 1:
00523     {
00524       if (toCreateCopy) {
00525         for (int i = 0; i < myObjects.count(); i++) {
00526           myCurrObject = myObjects[i];
00527           anObj = anOper->RotateThreePointsCopy(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get());
00528           if (!anObj->_is_nil())
00529             objects.push_back(anObj._retn());
00530         }
00531       }
00532       else {
00533         for (int i = 0; i < myObjects.count(); i++) {
00534           myCurrObject = myObjects[i];
00535           anObj = anOper->RotateThreePoints(myObjects[i].get(), myCentPoint.get(), myPoint1.get(), myPoint2.get());
00536           if (!anObj->_is_nil())
00537             objects.push_back(anObj._retn());
00538         }
00539       }
00540       res = true;
00541       break;
00542     }
00543   }
00544 
00545   return res;
00546 }
00547 
00548 //=================================================================================
00549 // function : restoreSubShapes
00550 // purpose  :
00551 //=================================================================================
00552 void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
00553                                                       SALOMEDS::SObject_ptr theSObject)
00554 {
00555   if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
00556     // we pass here the first operation argument (object) through the list of arguments
00557     // because the rotation operation place its arguments in the data structure in another order,
00558     // and we need to point the first argument directly
00559     GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
00560     anArgs->length(1);
00561     anArgs[0] = myCurrObject.copy();
00562     getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
00563                                         /*theFindMethod=*/GEOM::FSM_Transformed,
00564                                         /*theInheritFirstArg=*/true,
00565                                         mainFrame()->CheckBoxAddPrefix->isChecked());
00566   }
00567 }
00568 
00569 //=================================================================================
00570 // function : GetAngle()
00571 // purpose  :
00572 //=================================================================================
00573 double TransformationGUI_RotationDlg::GetAngle() const
00574 {
00575   return GroupPoints->SpinBox_DX->value();
00576 }
00577 
00578 //=================================================================================
00579 // function :  CreateCopyModeChanged()
00580 // purpose  :
00581 //=================================================================================
00582 void TransformationGUI_RotationDlg::CreateCopyModeChanged()
00583 {
00584   mainFrame()->GroupBoxName->setEnabled(GroupPoints->CheckButton1->isChecked());
00585 }
00586 
00587 //=================================================================================
00588 // function :  onReverse()
00589 // purpose  :
00590 //=================================================================================
00591 void TransformationGUI_RotationDlg::onReverse()
00592 {
00593   double anOldValue = GroupPoints->SpinBox_DX->value();
00594   GroupPoints->SpinBox_DX->setValue(-anOldValue);
00595 }
00596 
00597 //=================================================================================
00598 // function : addSubshapesToStudy
00599 // purpose  : virtual method to add new SubObjects if local selection
00600 //=================================================================================
00601 void TransformationGUI_RotationDlg::addSubshapesToStudy()
00602 {
00603   bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
00604   if (toCreateCopy) {
00605     switch (getConstructorId()) {
00606     case 0:
00607       GEOMBase::PublishSubObject( myAxis.get() );
00608       break;
00609     case 1:
00610       GEOMBase::PublishSubObject( myCentPoint.get() );
00611       GEOMBase::PublishSubObject( myPoint1.get() );
00612       GEOMBase::PublishSubObject( myPoint2.get() );
00613       break;
00614     default:
00615       break;
00616     }
00617   }
00618 }