Back to index

salome-smesh  6.5.0
SMESHGUI_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 //  File   : SMESHGUI_RotationDlg.cxx
00023 //  Author : Michael ZORIN, Open CASCADE S.A.S.
00024 //  SMESH includes
00025 
00026 #include "SMESHGUI_RotationDlg.h"
00027 
00028 #include "SMESHGUI.h"
00029 #include "SMESHGUI_SpinBox.h"
00030 #include "SMESHGUI_Utils.h"
00031 #include "SMESHGUI_VTKUtils.h"
00032 #include "SMESHGUI_MeshUtils.h"
00033 #include "SMESHGUI_IdValidator.h"
00034 #include "SMESHGUI_FilterDlg.h"
00035 #include "SMESHGUI_MeshEditPreview.h"
00036 
00037 #include <SMESH_Actor.h>
00038 #include <SMESH_TypeFilter.hxx>
00039 #include <SMESH_LogicalFilter.hxx>
00040 #include <SMDS_Mesh.hxx>
00041 
00042 // SALOME GUI includes
00043 #include <SUIT_Desktop.h>
00044 #include <SUIT_Session.h>
00045 #include <SUIT_MessageBox.h>
00046 #include <SUIT_ResourceMgr.h>
00047 #include <SUIT_OverrideCursor.h>
00048 
00049 #include <LightApp_Application.h>
00050 #include <LightApp_SelectionMgr.h>
00051 
00052 #include <SVTK_ViewModel.h>
00053 #include <SVTK_ViewWindow.h>
00054 #include <SALOME_ListIO.hxx>
00055 
00056 // SALOME KERNEL includes
00057 #include <SALOMEDSClient_SObject.hxx>
00058 
00059 // OCCT includes
00060 #include <TColStd_MapOfInteger.hxx>
00061 
00062 // Qt includes
00063 #include <QApplication>
00064 #include <QButtonGroup>
00065 #include <QGroupBox>
00066 #include <QLabel>
00067 #include <QLineEdit>
00068 #include <QPushButton>
00069 #include <QRadioButton>
00070 #include <QCheckBox>
00071 #include <QHBoxLayout>
00072 #include <QVBoxLayout>
00073 #include <QGridLayout>
00074 #include <QKeyEvent>
00075 
00076 // IDL includes
00077 #include <SALOMEconfig.h>
00078 #include CORBA_SERVER_HEADER(SMESH_Group)
00079 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
00080 
00081 enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; 
00082 
00083 #define SPACING 8
00084 #define MARGIN  11
00085 
00086 //To disable automatic genericobj management, the following line should be commented.
00087 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
00088 #define WITHGENERICOBJ
00089 
00090 //=================================================================================
00091 // class    : SMESHGUI_RotationDlg()
00092 // purpose  :
00093 //=================================================================================
00094 SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) :
00095     SMESHGUI_PreviewDlg( theModule ),
00096     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
00097     myFilterDlg(0),
00098     mySelectedObject(SMESH::SMESH_IDSource::_nil())
00099 {
00100   QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
00101   QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
00102 
00103   setModal(false);
00104   setAttribute(Qt::WA_DeleteOnClose, true);
00105   setWindowTitle(tr("SMESH_ROTATION_TITLE"));
00106   setSizeGripEnabled(true);
00107 
00108   QVBoxLayout* SMESHGUI_RotationDlgLayout = new QVBoxLayout(this);
00109   SMESHGUI_RotationDlgLayout->setSpacing(SPACING);
00110   SMESHGUI_RotationDlgLayout->setMargin(MARGIN);
00111 
00112   /***************************************************************/
00113   GroupConstructors = new QGroupBox(tr("SMESH_ROTATION"), this);
00114   QButtonGroup* ButtonGroup = new QButtonGroup(this);
00115   QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors);
00116   GroupConstructorsLayout->setSpacing(SPACING);
00117   GroupConstructorsLayout->setMargin(MARGIN);
00118 
00119   RadioButton1= new QRadioButton(GroupConstructors);
00120   RadioButton1->setIcon(image0);
00121 
00122   GroupConstructorsLayout->addWidget(RadioButton1);
00123   ButtonGroup->addButton(RadioButton1, 0);
00124 
00125   /***************************************************************/
00126   GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
00127   QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
00128   GroupArgumentsLayout->setSpacing(SPACING);
00129   GroupArgumentsLayout->setMargin(MARGIN);
00130 
00131   myIdValidator = new SMESHGUI_IdValidator(this);
00132 
00133   // Controls for elements selection
00134   TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
00135   SelectElementsButton  = new QPushButton(GroupArguments);
00136   SelectElementsButton->setIcon(image1);
00137   LineEditElements = new QLineEdit(GroupArguments);
00138   LineEditElements->setValidator(myIdValidator);
00139   LineEditElements->setMaxLength(-1);
00140   myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
00141   connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
00142 
00143   // Control for the whole mesh selection
00144   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
00145 
00146   // Controls for axis defining
00147   GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments);
00148   QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis);
00149   GroupAxisLayout->setSpacing(SPACING);
00150   GroupAxisLayout->setMargin(MARGIN);
00151 
00152   TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis);
00153   SelectPointButton  = new QPushButton(GroupAxis);
00154   SelectPointButton->setIcon(image1);
00155 
00156   TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis);
00157   SpinBox_X = new SMESHGUI_SpinBox(GroupAxis);
00158   TextLabelY = new QLabel(tr("SMESH_Y"), GroupAxis);
00159   SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis);
00160   TextLabelZ = new QLabel(tr("SMESH_Z"), GroupAxis);
00161   SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis);
00162 
00163   TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis);
00164   SelectVectorButton = new QPushButton(GroupAxis);
00165   SelectVectorButton->setIcon(image1);
00166 
00167   TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis);
00168   SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis);
00169   TextLabelDY = new QLabel(tr("SMESH_DY"), GroupAxis);
00170   SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis);
00171   TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupAxis);
00172   SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis);
00173 
00174   GroupAxisLayout->addWidget(TextLabelPoint,     0, 0);
00175   GroupAxisLayout->addWidget(SelectPointButton,  0, 1);
00176   GroupAxisLayout->addWidget(TextLabelX,         0, 2);
00177   GroupAxisLayout->addWidget(SpinBox_X,          0, 3);
00178   GroupAxisLayout->addWidget(TextLabelY,         0, 4);
00179   GroupAxisLayout->addWidget(SpinBox_Y,          0, 5);
00180   GroupAxisLayout->addWidget(TextLabelZ,         0, 6);
00181   GroupAxisLayout->addWidget(SpinBox_Z,          0, 7);
00182   GroupAxisLayout->addWidget(TextLabelVector,    1, 0);
00183   GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
00184   GroupAxisLayout->addWidget(TextLabelDX,        1, 2);
00185   GroupAxisLayout->addWidget(SpinBox_DX,         1, 3);
00186   GroupAxisLayout->addWidget(TextLabelDY,        1, 4);
00187   GroupAxisLayout->addWidget(SpinBox_DY,         1, 5);
00188   GroupAxisLayout->addWidget(TextLabelDZ,        1, 6);
00189   GroupAxisLayout->addWidget(SpinBox_DZ,         1, 7);
00190 
00191   // Controls for angle defining
00192   TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments);
00193   SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments);
00194 
00195   // action switch
00196   ActionBox = new QGroupBox(GroupArguments);
00197   ActionGroup = new QButtonGroup(GroupArguments);
00198   QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox);
00199   ActionBoxLayout->setSpacing(SPACING);
00200   ActionBoxLayout->setMargin(MARGIN);
00201 
00202   QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox);
00203   QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox);
00204   QRadioButton* aCreateMesh   = new QRadioButton(tr("SMESH_CREATE_MESH"),   ActionBox);
00205 
00206   ActionBoxLayout->addWidget(aMoveElements);
00207   ActionBoxLayout->addWidget(aCopyElements);
00208   ActionBoxLayout->addWidget(aCreateMesh);
00209   ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON);
00210   ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON);
00211   ActionGroup->addButton(aCreateMesh,   MAKE_MESH_BUTTON);
00212 
00213   // CheckBox for groups generation
00214   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
00215 
00216   // Name of a mesh to create
00217   LineEditNewMesh = new QLineEdit(GroupArguments);
00218 
00219 
00220   //Preview check box
00221   myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
00222 
00223   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
00224   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
00225   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 1);
00226   GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
00227   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
00228   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 4);
00229   GroupArgumentsLayout->addWidget(TextLabelAngle,       3, 0, 1, 2);
00230   GroupArgumentsLayout->addWidget(SpinBox_Angle,        3, 2);
00231   GroupArgumentsLayout->addWidget(ActionBox,            4, 0, 3, 3);
00232   GroupArgumentsLayout->addWidget(MakeGroupsCheck,      5, 3);
00233   GroupArgumentsLayout->addWidget(LineEditNewMesh,      6, 3);
00234   GroupArgumentsLayout->addWidget(myPreviewCheckBox,    7, 0);
00235 
00236 
00237   /***************************************************************/
00238   GroupButtons = new QGroupBox(this);
00239   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
00240   GroupButtonsLayout->setSpacing(SPACING);
00241   GroupButtonsLayout->setMargin(MARGIN);
00242 
00243   buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
00244   buttonOk->setAutoDefault(true);
00245   buttonOk->setDefault(true);
00246   buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
00247   buttonApply->setAutoDefault(true);
00248   buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
00249   buttonCancel->setAutoDefault(true);
00250   buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
00251   buttonHelp->setAutoDefault(true);
00252 
00253   GroupButtonsLayout->addWidget(buttonOk);
00254   GroupButtonsLayout->addSpacing(10);
00255   GroupButtonsLayout->addWidget(buttonApply);
00256   GroupButtonsLayout->addSpacing(10);
00257   GroupButtonsLayout->addStretch();
00258   GroupButtonsLayout->addWidget(buttonCancel);
00259   GroupButtonsLayout->addWidget(buttonHelp);
00260 
00261   /***************************************************************/
00262   SMESHGUI_RotationDlgLayout->addWidget(GroupConstructors);
00263   SMESHGUI_RotationDlgLayout->addWidget(GroupArguments);
00264   SMESHGUI_RotationDlgLayout->addWidget(GroupButtons);
00265 
00266   /* Initialisations */
00267   SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00268   SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00269   SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00270   SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00271   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00272   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
00273 
00274   SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, "angle_precision");
00275 
00276   myConstructorId = 0;
00277   RadioButton1->setChecked(true);
00278 
00279   mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
00280 
00281   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
00282 
00283   // Costruction of the logical filter
00284   SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
00285   SMESH_TypeFilter* aSmeshGroupFilter    = new SMESH_TypeFilter (GROUP);
00286 
00287   QList<SUIT_SelectionFilter*> aListOfFilters;
00288   if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
00289   if (aSmeshGroupFilter)    aListOfFilters.append(aSmeshGroupFilter);
00290 
00291   myMeshOrSubMeshOrGroupFilter =
00292     new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
00293 
00294   myHelpFileName = "rotation_page.html";
00295 
00296   Init();
00297 
00298   /* signals and slots connections */
00299   connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
00300   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
00301   connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
00302   connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
00303 
00304   connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
00305   connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
00306   connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
00307 
00308   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
00309   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
00310   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
00311 
00312   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
00313   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),   this, SLOT(SelectionIntoArgument()));
00314   /* to close dialog if study change */
00315   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
00316   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
00317   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
00318   connect(ActionGroup,      SIGNAL(buttonClicked(int)),             SLOT(onActionClicked(int)));
00319 
00320   connect(SpinBox_X,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00321   connect(SpinBox_Y,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00322   connect(SpinBox_Z,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00323   connect(SpinBox_DX,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00324   connect(SpinBox_DY,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00325   connect(SpinBox_DZ,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00326   connect(SpinBox_Angle,  SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
00327 
00328   //To Connect preview check box
00329   connectPreviewControl();
00330 
00331   onActionClicked(MOVE_ELEMS_BUTTON);
00332 }
00333 
00334 //=================================================================================
00335 // function : ~SMESHGUI_RotationDlg()
00336 // purpose  : Destroys the object and frees any allocated resources
00337 //=================================================================================
00338 SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
00339 {
00340   if ( myFilterDlg ) {
00341     myFilterDlg->setParent( 0 );
00342     delete myFilterDlg;
00343     myFilterDlg = 0;
00344   }
00345 }
00346 
00347 //=================================================================================
00348 // function : Init()
00349 // purpose  :
00350 //=================================================================================
00351 void SMESHGUI_RotationDlg::Init (bool ResetControls)
00352 {
00353   myBusy = false;
00354 
00355   myEditCurrentArgument = (QWidget*)LineEditElements;
00356   LineEditElements->setFocus();
00357   myElementsId = "";
00358   myNbOkElements = 0;
00359 
00360   buttonOk->setEnabled(false);
00361   buttonApply->setEnabled(false);
00362 
00363   myActor = 0;
00364   myMesh = SMESH::SMESH_Mesh::_nil();
00365 
00366   if (ResetControls) {
00367     SpinBox_X->SetValue(0.0);
00368     SpinBox_Y->SetValue(0.0);
00369     SpinBox_Z->SetValue(0.0);
00370     SpinBox_DX->SetValue(0.0);
00371     SpinBox_DY->SetValue(0.0);
00372     SpinBox_DZ->SetValue(0.0);
00373 
00374     SpinBox_Angle->SetValue(45);
00375 
00376     ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
00377     CheckBoxMesh->setChecked(false);
00378     myPreviewCheckBox->setChecked(false);
00379     onDisplaySimulation(false);
00380 
00381 //     MakeGroupsCheck->setChecked(false);
00382 //     MakeGroupsCheck->setEnabled(false);
00383 //    onSelectMesh(false);
00384   }
00385 
00386   onSelectMesh(CheckBoxMesh->isChecked());
00387 }
00388 
00389 //=================================================================================
00390 // function : ClickOnApply()
00391 // purpose  :
00392 //=================================================================================
00393 bool SMESHGUI_RotationDlg::ClickOnApply()
00394 {
00395   if (mySMESHGUI->isActiveStudyLocked())
00396     return false;
00397 
00398   if( !isValid() )
00399     return false;
00400 
00401   if (myNbOkElements && IsAxisOk()) {
00402     QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
00403 
00404     SMESH::long_array_var anElementsId = new SMESH::long_array;
00405 
00406     anElementsId->length(aListElementsId.count());
00407     for (int i = 0; i < aListElementsId.count(); i++)
00408       anElementsId[i] = aListElementsId[i].toInt();
00409 
00410     SMESH::AxisStruct anAxis;
00411 
00412     anAxis.x =  SpinBox_X->GetValue();
00413     anAxis.y =  SpinBox_Y->GetValue();
00414     anAxis.z =  SpinBox_Z->GetValue();;
00415     anAxis.vx = SpinBox_DX->GetValue();
00416     anAxis.vy = SpinBox_DY->GetValue();
00417     anAxis.vz = SpinBox_DZ->GetValue();
00418 
00419     double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
00420 
00421     QStringList aParameters;
00422     aParameters << SpinBox_X->text();
00423     aParameters << SpinBox_Y->text();
00424     aParameters << SpinBox_Z->text();
00425     aParameters << SpinBox_DX->text();
00426     aParameters << SpinBox_DY->text();
00427     aParameters << SpinBox_DZ->text();
00428     aParameters << SpinBox_Angle->text();
00429 
00430     int actionButton = ActionGroup->checkedId();
00431     bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
00432     QStringList anEntryList;
00433     try {
00434       SUIT_OverrideCursor aWaitCursor;
00435       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
00436 
00437       myMesh->SetParameters(aParameters.join(":").toLatin1().constData());
00438 
00439       switch ( actionButton ) {
00440       case MOVE_ELEMS_BUTTON:
00441         if(CheckBoxMesh->isChecked())
00442           aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, false);
00443         else
00444             aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
00445         break;
00446       case COPY_ELEMS_BUTTON:
00447         if ( makeGroups ) {
00448           SMESH::ListOfGroups_var groups;
00449           if(CheckBoxMesh->isChecked())
00450             groups = aMeshEditor->RotateObjectMakeGroups(mySelectedObject, anAxis, anAngle);
00451           else
00452             groups = aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
00453         }
00454         else {
00455           if(CheckBoxMesh->isChecked())
00456             aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, true);
00457           else
00458             aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
00459         }
00460         break;
00461       case MAKE_MESH_BUTTON: {
00462         SMESH::SMESH_Mesh_var mesh;
00463         if (CheckBoxMesh->isChecked())
00464           mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
00465                                                    LineEditNewMesh->text().toLatin1().data());
00466         else
00467           mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
00468                                              LineEditNewMesh->text().toLatin1().data());
00469         if (!mesh->_is_nil()) {
00470           if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
00471             anEntryList.append( aSObject->GetID().c_str() );
00472 #ifdef WITHGENERICOBJ
00473           // obj has been published in study. Its refcount has been incremented.
00474           // It is safe to decrement its refcount
00475           // so that it will be destroyed when the entry in study will be removed
00476           mesh->UnRegister();
00477 #endif
00478         }
00479         break;
00480       }
00481       }
00482     } catch (...) {
00483     }
00484 
00485     SMESH::UpdateView();
00486     if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
00487          actionButton == MAKE_MESH_BUTTON ) {
00488       mySMESHGUI->updateObjBrowser(true); // new groups may appear
00489       if( LightApp_Application* anApp =
00490           dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
00491         anApp->browseObjects( anEntryList, isApplyAndClose() );
00492     }
00493     Init(false);
00494     mySelectedObject = SMESH::SMESH_IDSource::_nil();
00495     SelectionIntoArgument();
00496 
00497     SMESHGUI::Modified();
00498   }
00499 
00500   return true;
00501 }
00502 
00503 //=================================================================================
00504 // function : ClickOnOk()
00505 // purpose  :
00506 //=================================================================================
00507 void SMESHGUI_RotationDlg::ClickOnOk()
00508 {
00509   setIsApplyAndClose( true );
00510   if( ClickOnApply() )
00511     ClickOnCancel();
00512 }
00513 
00514 //=================================================================================
00515 // function : ClickOnCancel()
00516 // purpose  :
00517 //=================================================================================
00518 void SMESHGUI_RotationDlg::ClickOnCancel()
00519 {
00520   disconnect(mySelectionMgr, 0, this, 0);
00521   mySelectionMgr->clearFilters();
00522   //mySelectionMgr->clearSelected();
00523   if (SMESH::GetCurrentVtkView()) {
00524     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
00525     SMESH::SetPointRepresentation(false);
00526   }
00527   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00528     aViewWindow->SetSelectionMode(ActorSelection);
00529   mySMESHGUI->ResetState();
00530   reject();
00531 }
00532 
00533 //=================================================================================
00534 // function : ClickOnHelp()
00535 // purpose  :
00536 //=================================================================================
00537 void SMESHGUI_RotationDlg::ClickOnHelp()
00538 {
00539   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
00540   if (app)
00541     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
00542   else {
00543     QString platform;
00544 #ifdef WIN32
00545     platform = "winapplication";
00546 #else
00547     platform = "application";
00548 #endif
00549     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
00550                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
00551                              arg(app->resourceMgr()->stringValue("ExternalBrowser",
00552                                                                  platform)).
00553                              arg(myHelpFileName));
00554   }
00555 }
00556 
00557 //=======================================================================
00558 // function : onTextChange()
00559 // purpose  :
00560 //=======================================================================
00561 void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
00562 {
00563   QLineEdit* send = (QLineEdit*)sender();
00564 
00565   if (myBusy) return;
00566   myBusy = true;
00567 
00568   if (send == LineEditElements)
00569     myNbOkElements = 0;
00570 
00571   buttonOk->setEnabled(false);
00572   buttonApply->setEnabled(false);
00573 
00574   // hilight entered elements
00575   SMDS_Mesh* aMesh = 0;
00576   if (myActor)
00577     aMesh = myActor->GetObject()->GetMesh();
00578 
00579   if (aMesh) {
00580     if (send == LineEditElements) {
00581       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
00582 
00583       TColStd_MapOfInteger newIndices;
00584 
00585       QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
00586       for (int i = 0; i < aListId.count(); i++) {
00587         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
00588         if (e)
00589           newIndices.Add(e->GetID());
00590         myNbOkElements++;
00591       }
00592 
00593       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
00594       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00595         aViewWindow->highlight( anIO, true, true );
00596 
00597       myElementsId = theNewText;
00598     }
00599   }
00600 
00601   if (myNbOkElements && IsAxisOk()) {
00602     buttonOk->setEnabled(true);
00603     buttonApply->setEnabled(true);
00604   }
00605 
00606   myBusy = false;
00607 }
00608 
00609 //=================================================================================
00610 // function : SelectionIntoArgument()
00611 // purpose  : Called when selection as changed or other case
00612 //=================================================================================
00613 void SMESHGUI_RotationDlg::SelectionIntoArgument()
00614 {
00615   if (myBusy) return;
00616 
00617   // clear
00618   myActor = 0;
00619   QString aString = "";
00620 
00621   myBusy = true;
00622   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
00623     LineEditElements->setText(aString);
00624     myNbOkElements = 0;
00625     buttonOk->setEnabled(false);
00626     buttonApply->setEnabled(false);
00627   }
00628   myBusy = false;
00629 
00630   if (!GroupButtons->isEnabled()) // inactive
00631     return;
00632 
00633   // get selected mesh
00634   SALOME_ListIO aList;
00635   mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
00636 
00637   int nbSel = aList.Extent();
00638   if (nbSel != 1)
00639     return;
00640 
00641   Handle(SALOME_InteractiveObject) IO = aList.First();
00642   myMesh = SMESH::GetMeshByIO(IO);
00643   if (myMesh->_is_nil())
00644     return;
00645 
00646   myActor = SMESH::FindActorByObject(myMesh);
00647   if (!myActor)
00648     myActor = SMESH::FindActorByEntry(IO->getEntry());
00649   if (!myActor && !CheckBoxMesh->isChecked())
00650     return;
00651 
00652   int aNbUnits = 0;
00653 
00654   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
00655     myElementsId = "";
00656 
00657     // MakeGroups is available if there are groups and "Copy"
00658     if ( myMesh->NbGroups() == 0 ) {
00659       MakeGroupsCheck->setChecked(false);
00660       MakeGroupsCheck->setEnabled(false);
00661     }
00662     else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
00663       MakeGroupsCheck->setEnabled(true);
00664     }
00665     if (CheckBoxMesh->isChecked()) {
00666       SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
00667 
00668       if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH
00669         mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
00670       }
00671       else
00672         return;
00673         // get IDs from mesh
00674         /*
00675           SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
00676           if (!aSMDSMesh)
00677           return;
00678 
00679           for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
00680           const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
00681           if (e) {
00682             myElementsId += QString(" %1").arg(i);
00683             aNbUnits++;
00684           }
00685         }
00686       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
00687       // get submesh
00688         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
00689 
00690         // get IDs from submesh
00691         SMESH::long_array_var anElementsIds = new SMESH::long_array;
00692         anElementsIds = aSubMesh->GetElementsId();
00693         for (int i = 0; i < anElementsIds->length(); i++) {
00694         myElementsId += QString(" %1").arg(anElementsIds[i]);
00695           }
00696         aNbUnits = anElementsIds->length();
00697       } else { // GROUP
00698         // get smesh group
00699         SMESH::SMESH_GroupBase_var aGroup =
00700         SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
00701         if (aGroup->_is_nil())
00702         return;
00703 
00704           // get IDs from smesh group
00705         SMESH::long_array_var anElementsIds = new SMESH::long_array;
00706         anElementsIds = aGroup->GetListOfID();
00707         for (int i = 0; i < anElementsIds->length(); i++) {
00708         myElementsId += QString(" %1").arg(anElementsIds[i]);
00709           }
00710         aNbUnits = anElementsIds->length();
00711         }
00712         */
00713       } else {
00714       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
00715       myElementsId = aString;
00716       if (aNbUnits < 1)
00717         return;
00718       }
00719 
00720     myNbOkElements = true;
00721 
00722   } else {
00723     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
00724     if (aNbUnits != 1)
00725       return;
00726 
00727     SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
00728     if (!aMesh)
00729       return;
00730 
00731     const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
00732     if (!n)
00733       return;
00734 
00735     double x = n->X();
00736     double y = n->Y();
00737     double z = n->Z();
00738 
00739     if (myEditCurrentArgument == (QWidget*)SpinBox_X) {
00740       SpinBox_X->SetValue(x);
00741       SpinBox_Y->SetValue(y);
00742       SpinBox_Z->SetValue(z);
00743     } else if (myEditCurrentArgument == (QWidget*)SpinBox_DX) {
00744       SpinBox_DX->SetValue(x - SpinBox_X->GetValue());
00745       SpinBox_DY->SetValue(y - SpinBox_Y->GetValue());
00746       SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
00747     }
00748   }
00749 
00750   myBusy = true;
00751   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
00752     LineEditElements->setText(aString);
00753     LineEditElements->repaint();
00754     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
00755     LineEditElements->setEnabled(true);
00756     setNewMeshName();
00757   }
00758   myBusy = false;
00759 
00760   // OK
00761   if (myNbOkElements && IsAxisOk()) {
00762     buttonOk->setEnabled(true);
00763     buttonApply->setEnabled(true);
00764   }
00765   onDisplaySimulation(true);
00766 }
00767 
00768 //=================================================================================
00769 // function : SetEditCurrentArgument()
00770 // purpose  :
00771 //=================================================================================
00772 void SMESHGUI_RotationDlg::SetEditCurrentArgument()
00773 {
00774   QPushButton* send = (QPushButton*)sender();
00775 
00776   disconnect(mySelectionMgr, 0, this, 0);
00777   mySelectionMgr->clearSelected();
00778   mySelectionMgr->clearFilters();
00779 
00780   switch (myConstructorId) {
00781   case 0: /* default constructor */
00782     {
00783       SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
00784       if (send == SelectElementsButton) {
00785         myEditCurrentArgument = (QWidget*)LineEditElements;
00786         SMESH::SetPointRepresentation(false);
00787         if (CheckBoxMesh->isChecked()) {
00788           if ( aViewWindow )
00789             aViewWindow->SetSelectionMode(ActorSelection);
00790           mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
00791         } else {
00792           if ( aViewWindow )
00793             aViewWindow->SetSelectionMode( CellSelection );
00794         }
00795       } else if (send == SelectPointButton) {
00796         myEditCurrentArgument = (QWidget*)SpinBox_X;
00797         SMESH::SetPointRepresentation(true);
00798         if ( aViewWindow )
00799           aViewWindow->SetSelectionMode( NodeSelection );
00800       } else if (send == SelectVectorButton) {
00801         myEditCurrentArgument = (QWidget*)SpinBox_DX;
00802         SMESH::SetPointRepresentation(true);
00803         if ( aViewWindow )
00804           aViewWindow->SetSelectionMode( NodeSelection );
00805       }
00806       break;
00807     }
00808 
00809   }
00810 
00811   myEditCurrentArgument->setFocus();
00812   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
00813   SelectionIntoArgument();
00814 }
00815 
00816 //=================================================================================
00817 // function : DeactivateActiveDialog()
00818 // purpose  :
00819 //=================================================================================
00820 void SMESHGUI_RotationDlg::DeactivateActiveDialog()
00821 {
00822   if (GroupConstructors->isEnabled()) {
00823     GroupConstructors->setEnabled(false);
00824     GroupArguments->setEnabled(false);
00825     GroupButtons->setEnabled(false);
00826     mySMESHGUI->ResetState();
00827     mySMESHGUI->SetActiveDialogBox(0);
00828   }
00829 }
00830 
00831 //=================================================================================
00832 // function : ActivateThisDialog()
00833 // purpose  :
00834 //=================================================================================
00835 void SMESHGUI_RotationDlg::ActivateThisDialog()
00836 {
00837   /* Emit a signal to deactivate the active dialog */
00838   mySMESHGUI->EmitSignalDeactivateDialog();
00839   GroupConstructors->setEnabled(true);
00840   GroupArguments->setEnabled(true);
00841   GroupButtons->setEnabled(true);
00842 
00843   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
00844 
00845   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00846     aViewWindow->SetSelectionMode( CellSelection );
00847   SelectionIntoArgument();
00848 }
00849 
00850 //=================================================================================
00851 // function : enterEvent()
00852 // purpose  :
00853 //=================================================================================
00854 void SMESHGUI_RotationDlg::enterEvent (QEvent*)
00855 {
00856   if (!GroupConstructors->isEnabled())
00857     ActivateThisDialog();
00858 }
00859 
00860 //=================================================================================
00861 // function : closeEvent()
00862 // purpose  :
00863 //=================================================================================
00864 void SMESHGUI_RotationDlg::closeEvent (QCloseEvent*)
00865 {
00866   /* same than click on cancel button */
00867   ClickOnCancel();
00868 }
00869 
00870 //=================================================================================
00871 // function : hideEvent()
00872 // purpose  : caused by ESC key
00873 //=================================================================================
00874 void SMESHGUI_RotationDlg::hideEvent (QHideEvent*)
00875 {
00876   if (!isMinimized())
00877     ClickOnCancel();
00878 }
00879 
00880 //=================================================================================
00881 // function : onSelectMesh()
00882 // purpose  :
00883 //=================================================================================
00884 void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
00885 {
00886   if (toSelectMesh)
00887     TextLabelElements->setText(tr("SMESH_NAME"));
00888   else
00889     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
00890   myFilterBtn->setEnabled(!toSelectMesh);
00891 
00892   if (myEditCurrentArgument != LineEditElements) {
00893     LineEditElements->clear();
00894     return;
00895   }
00896 
00897   mySelectionMgr->clearFilters();
00898   SMESH::SetPointRepresentation(false);
00899 
00900   if (toSelectMesh) {
00901     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00902       aViewWindow->SetSelectionMode(ActorSelection);
00903     mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
00904     LineEditElements->setReadOnly(true);
00905     LineEditElements->setValidator(0);
00906   } else {
00907     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00908       aViewWindow->SetSelectionMode( CellSelection );
00909     LineEditElements->setReadOnly(false);
00910     LineEditElements->setValidator(myIdValidator);
00911     onTextChange(LineEditElements->text());
00912     hidePreview();
00913   }
00914 
00915   SelectionIntoArgument();
00916 }
00917 
00918 //=================================================================================
00919 // function : IsAxisOk()
00920 // purpose  :
00921 //=================================================================================
00922 bool SMESHGUI_RotationDlg::IsAxisOk()
00923 {
00924   return (SpinBox_DX->GetValue() != 0 ||
00925           SpinBox_DY->GetValue() != 0 ||
00926           SpinBox_DZ->GetValue() != 0);
00927 }
00928 
00929 //=================================================================================
00930 // function : onVectorChanged()
00931 // purpose  :
00932 //=================================================================================
00933 void SMESHGUI_RotationDlg::onVectorChanged()
00934 {
00935   if (IsAxisOk()) {
00936     buttonOk->setEnabled(true);
00937     buttonApply->setEnabled(true);
00938   } else {
00939     buttonOk->setEnabled(false);
00940     buttonApply->setEnabled(false);
00941   }
00942 }
00943 
00944 
00945 //=======================================================================
00946 //function : onActionClicked
00947 //purpose  : slot called when an action type changed
00948 //=======================================================================
00949 
00950 void SMESHGUI_RotationDlg::onActionClicked(int button)
00951 {
00952   switch ( button ) {
00953   case MOVE_ELEMS_BUTTON:
00954     MakeGroupsCheck->setEnabled(false);
00955     LineEditNewMesh->setEnabled(false);
00956     break;
00957   case COPY_ELEMS_BUTTON:
00958     LineEditNewMesh->setEnabled(false);
00959     MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
00960     if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
00961       MakeGroupsCheck->setEnabled(true);
00962     else
00963       MakeGroupsCheck->setEnabled(false);
00964     break;
00965   case MAKE_MESH_BUTTON:
00966     LineEditNewMesh->setEnabled(true);
00967     MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
00968     if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
00969       MakeGroupsCheck->setEnabled(true);
00970     else
00971       MakeGroupsCheck->setEnabled(false);
00972     break;
00973   }
00974   setNewMeshName();
00975   toDisplaySimulation();
00976 }
00977 
00978 //=======================================================================
00979 //function : setNewMeshName
00980 //purpose  : update contents of LineEditNewMesh
00981 //=======================================================================
00982 
00983 void SMESHGUI_RotationDlg::setNewMeshName()
00984 {
00985   LineEditNewMesh->setText("");
00986   if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
00987     QString name;
00988     if ( CheckBoxMesh->isChecked() ) {
00989       name = LineEditElements->text();
00990     }
00991     else {
00992       _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
00993       name = meshSO->GetName().c_str();
00994     }
00995     if ( !name.isEmpty() )
00996       LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "rotated"));
00997   }
00998 }
00999 
01000 //=================================================================================
01001 // function : keyPressEvent()
01002 // purpose  :
01003 //=================================================================================
01004 void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e )
01005 {
01006   QDialog::keyPressEvent( e );
01007   if ( e->isAccepted() )
01008     return;
01009 
01010   if ( e->key() == Qt::Key_F1 ) {
01011     e->accept();
01012     ClickOnHelp();
01013   }
01014 }
01015 
01016 //=================================================================================
01017 // function : setFilters()
01018 // purpose  : SLOT. Called when "Filter" button pressed.
01019 //=================================================================================
01020 void SMESHGUI_RotationDlg::setFilters()
01021 {
01022   if(myMesh->_is_nil()) {
01023     SUIT_MessageBox::critical(this,
01024                               tr("SMESH_ERROR"),
01025                               tr("NO_MESH_SELECTED"));
01026    return;
01027   }
01028   if ( !myFilterDlg )
01029     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
01030 
01031   myFilterDlg->SetSelection();
01032   myFilterDlg->SetMesh( myMesh );
01033   myFilterDlg->SetSourceWg( LineEditElements );
01034 
01035   myFilterDlg->show();
01036 }
01037 
01038 //=================================================================================
01039 // function : isValid
01040 // purpose  :
01041 //=================================================================================
01042 bool SMESHGUI_RotationDlg::isValid()
01043 {
01044   bool ok = true;
01045   QString msg;
01046 
01047   ok = SpinBox_X->isValid( msg, true ) && ok;
01048   ok = SpinBox_Y->isValid( msg, true ) && ok;
01049   ok = SpinBox_Z->isValid( msg, true ) && ok;
01050   ok = SpinBox_DX->isValid( msg, true ) && ok;
01051   ok = SpinBox_DY->isValid( msg, true ) && ok;
01052   ok = SpinBox_DZ->isValid( msg, true ) && ok;
01053   ok = SpinBox_Angle->isValid( msg, true ) && ok;
01054 
01055   if( !ok ) {
01056     QString str( tr( "SMESH_INCORRECT_INPUT" ) );
01057     if ( !msg.isEmpty() )
01058       str += "\n" + msg;
01059     SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
01060     return false;
01061   }
01062   return true;
01063 }
01064 
01065 
01066 //=================================================================================
01067 // function : onDisplaySimulation
01068 // purpose  : Show/Hide preview
01069 //=================================================================================
01070 void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) {
01071   if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
01072     if(myNbOkElements && isValid() && IsAxisOk()) {
01073       QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
01074       SMESH::long_array_var anElementsId = new SMESH::long_array;
01075       
01076       anElementsId->length(aListElementsId.count());
01077       for (int i = 0; i < aListElementsId.count(); i++)
01078         anElementsId[i] = aListElementsId[i].toInt();
01079       
01080       SMESH::AxisStruct anAxis;
01081       
01082       anAxis.x =  SpinBox_X->GetValue();
01083       anAxis.y =  SpinBox_Y->GetValue();
01084       anAxis.z =  SpinBox_Z->GetValue();;
01085       anAxis.vx = SpinBox_DX->GetValue();
01086       anAxis.vy = SpinBox_DY->GetValue();
01087       anAxis.vz = SpinBox_DZ->GetValue();
01088       double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
01089       
01090       try {
01091         SUIT_OverrideCursor aWaitCursor;
01092         bool copy = ( ActionGroup->checkedId() == COPY_ELEMS_BUTTON  ||
01093                       ActionGroup->checkedId() == MAKE_MESH_BUTTON );
01094         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
01095         if(CheckBoxMesh->isChecked())
01096           aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, copy);
01097         else
01098           aMeshEditor->Rotate(anElementsId, anAxis, anAngle, copy);
01099 
01100         SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
01101         mySimulation->SetData(aMeshPreviewStruct._retn());      
01102       } catch (...) {
01103         hidePreview();
01104       }
01105     }
01106     else {
01107       hidePreview();
01108     }
01109   } else {
01110     hidePreview();
01111   }
01112 }