Salome HOME
remove obsolete file
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RevolutionDlg.cxx
index 2f15f1882ba0d8de15098351db4472e3709a93e0..70614f5041b77031de0e2fcb4121be9c9fd4e38f 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -34,6 +34,7 @@
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_MeshEditPreview.h"
 
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
 #include "SMDS_Mesh.hxx"
 
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
+
+#include "LightApp_Application.h"
+#include "SalomeApp_Application.h"
 
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
 #include "SVTK_Selector.h"
 #include "SVTK_Selection.h"
 #include "SALOME_ListIO.hxx"
+#include "VTKViewer_CellLocationsArray.h"
 
 #include "utilities.h"
 
 // OCCT Includes
 #include <TColStd_MapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
 
 // QT Includes
 #include <qapplication.h>
@@ -71,6 +78,7 @@
 // IDL Headers
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(SMESH_Group)
+#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
 
 using namespace std;
 
@@ -78,6 +86,7 @@ using namespace std;
 // class    : SMESHGUI_RevolutionDlg()
 // purpose  :
 //=================================================================================
+
 SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* name,
                                                 bool modal, WFlags fl)
      : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
@@ -85,6 +94,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
      mySMESHGUI( theModule ),
      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
+  mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+
   SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
   QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
   QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
@@ -131,6 +142,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupButtonsLayout->setAlignment(Qt::AlignTop);
   GroupButtonsLayout->setSpacing(6);
   GroupButtonsLayout->setMargin(11);
+  buttonHelp = new QPushButton(GroupButtons, "buttonHelp");
+  buttonHelp->setText(tr("SMESH_BUT_HELP" ));
+  buttonHelp->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonHelp, 0, 4);
   buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
   buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
   buttonCancel->setAutoDefault(TRUE);
@@ -142,7 +157,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
   GroupButtonsLayout->addItem(spacer_9, 0, 2);
   buttonOk = new QPushButton(GroupButtons, "buttonOk");
-  buttonOk->setText(tr("SMESH_BUT_OK" ));
+  buttonOk->setText(tr("SMESH_BUT_APPLY_AND_CLOSE" ));
   buttonOk->setAutoDefault(TRUE);
   buttonOk->setDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
@@ -200,6 +215,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SelectPointButton, 0, 1);
 
   TextLabelX = new QLabel(GroupAxis, "TextLabelX");
+  TextLabelX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelX->setText(tr("SMESH_X"));
   GroupAxisLayout->addWidget(TextLabelX, 0, 2);
 
@@ -207,6 +223,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SpinBox_X, 0, 3);
 
   TextLabelY = new QLabel(GroupAxis, "TextLabelY");
+  TextLabelY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelY->setText(tr("SMESH_Y"));
   GroupAxisLayout->addWidget(TextLabelY, 0, 4);
 
@@ -214,6 +231,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SpinBox_Y, 0, 5);
 
   TextLabelZ = new QLabel(GroupAxis, "TextLabelZ");
+  TextLabelZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelZ->setText(tr("SMESH_Z"));
   GroupAxisLayout->addWidget(TextLabelZ, 0, 6);
 
@@ -229,6 +247,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SelectVectorButton, 1, 1);
 
   TextLabelDX = new QLabel(GroupAxis, "TextLabelDX");
+  TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelDX->setText(tr("SMESH_DX"));
   GroupAxisLayout->addWidget(TextLabelDX, 1, 2);
 
@@ -236,6 +255,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SpinBox_DX, 1, 3);
 
   TextLabelDY = new QLabel(GroupAxis, "TextLabelDY");
+  TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelDY->setText(tr("SMESH_DY"));
   GroupAxisLayout->addWidget(TextLabelDY, 1, 4);
 
@@ -243,6 +263,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupAxisLayout->addWidget(SpinBox_DY, 1, 5);
 
   TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ");
+  TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   TextLabelDZ->setText(tr("SMESH_DZ"));
   GroupAxisLayout->addWidget(TextLabelDZ, 1, 6);
 
@@ -252,46 +273,80 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
 
   // Controls for angle defining
-  TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
-  TextLabelAngle->setText(tr("SMESH_ANGLE" ));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
-
-  SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
-  GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
-
-  // Controls for nb. steps defining
-  TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
+  GroupAngle = new QButtonGroup(GroupArguments, "GroupAngle");
+  GroupAngle->setTitle(tr("SMESH_ANGLE"));
+  GroupAngle->setExclusive(TRUE);
+  GroupAngle->setColumnLayout(0, Qt::Horizontal);
+  GroupAngle->layout()->setSpacing(0);
+  GroupAngle->layout()->setMargin(0);
+  QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngle->layout());
+  GroupAngleLayout->setAlignment(Qt::AlignTop);
+  GroupAngleLayout->setSpacing(6);
+  GroupAngleLayout->setMargin(11);
+
+  RadioButton3 = new QRadioButton(GroupAngle, "RadioButton3");
+  RadioButton3->setText(tr("ANGLE_BY_STEP"));
+  GroupAngleLayout->addMultiCellWidget(RadioButton3, 0, 0, 0, 1);
+
+  RadioButton4 = new QRadioButton(GroupAngle, "RadioButton4");
+  RadioButton4->setText(tr("TOTAL_ANGLE"));
+  GroupAngleLayout->addWidget(RadioButton4, 0, 2);
+
+  TextLabelAngle = new QLabel(GroupAngle, "TextLabelAngle");
+  TextLabelAngle->setText(tr("SMESH_ANGLE"));
+  GroupAngleLayout->addWidget(TextLabelAngle, 1, 0);
+
+  SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngle, "SpinBox_Angle");
+  GroupAngleLayout->addMultiCellWidget(SpinBox_Angle, 1, 1, 1, 2);
+
+  // Controls for number of steps defining
+  TextLabelNbSteps = new QLabel(GroupAngle, "TextLabelNbSteps");
   TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 4, 4, 0, 1);
+  TextLabelNbSteps->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+  GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0);
+
+  SpinBox_NbSteps = new QSpinBox(GroupAngle, "SpinBox_NbSteps");
+  GroupAngleLayout->addMultiCellWidget(SpinBox_NbSteps, 2, 2, 1, 2);
 
-  SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
-  GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2);
+  GroupArgumentsLayout->addMultiCellWidget(GroupAngle, 3, 3, 0, 3);
 
   // Controls for tolerance defining
   TextLabelTolerance = new QLabel(GroupArguments, "TextLabelTolerance");
   TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelTolerance, 5, 5, 0, 1);
+  GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0);
 
   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
-  GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2);
+  GroupArgumentsLayout->addMultiCellWidget(SpinBox_Tolerance, 4, 4, 1, 3);
+
+  // CheckBox for groups generation
+  MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
+  MakeGroupsCheck->setChecked(true);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 6, 6, 0, 3);
+
+  // Control for mesh preview
+  CheckBoxPreview = new QCheckBox(GroupArguments, "CheckBoxPreview");
+  CheckBoxPreview->setText(tr("PREVIEW" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxPreview, 5, 5, 0, 3);
 
   SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0);
 
   /* Initialisations */
-  SpinBox_X->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  SpinBox_Y->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  SpinBox_Z->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  SpinBox_DX->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  SpinBox_DY->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
-  SpinBox_DZ->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
+  SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
+  SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
 
-  SpinBox_Angle->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3);
+  RadioButton3->setChecked(TRUE);
+
+  SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3);
 
   QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
   SpinBox_NbSteps->setValidator(anIntValidator);
   SpinBox_NbSteps->setRange(1, 999999);
 
-  SpinBox_Tolerance->RangeStepAndValidator(0.0, +999999.999, 0.1, 6);
+  SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 6);
 
   GroupArguments->show();
   RadioButton1->setChecked(TRUE);
@@ -311,18 +366,25 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   myMeshOrSubMeshOrGroupFilter =
     new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
 
+  myHelpFileName = "revolution_page.html";
+
   Init();
 
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()),     this, SLOT(ClickOnOk()));
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
   connect(buttonApply, SIGNAL(clicked()),  this, SLOT(ClickOnApply()));
+  connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
   connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
 
   connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
   connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
 
+  connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+
   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
@@ -334,13 +396,16 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
 
-  /* Move widget on the botton right corner of main widget */
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
+  connect(GroupAngle,        SIGNAL(clicked(int)),               SLOT(toDisplaySimulation()));
+  connect(SpinBox_Angle,     SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_NbSteps,   SIGNAL(valueChanged(int)),   this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(CheckBoxPreview,   SIGNAL(toggled(bool)),              SLOT(onDisplaySimulation(bool)));
+
   this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
+  SelectionIntoArgument();
   resize(0,0); // ??
 }
 
@@ -350,6 +415,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
 //=================================================================================
 SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
 {
+  delete mySimulation;
   // no need to delete child widgets, Qt does it all for us
 }
 
@@ -383,6 +449,8 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 
     CheckBoxMesh->setChecked(false);
     onSelectMesh(false);
+    CheckBoxPreview->setChecked(false);
+    onDisplaySimulation(false);
   }
 }
 
@@ -392,7 +460,17 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelectionMgr, 0, this, 0);
+  //disconnect(mySelectionMgr, 0, this, 0);
+
+  SALOME_ListIO io;
+  mySelectionMgr->selectedObjects( io );
+  SALOME_ListIO aList;
+  mySelectionMgr->setSelectedObjects( aList );
+//   LineEditElements->clear();
+  myNbOkElements = 0;
+  buttonApply->setEnabled(false);
+  buttonOk->setEnabled(false);
+  mySimulation->SetVisibility(false);
 
   Selection_Mode aSelMode = ActorSelection;
 
@@ -427,7 +505,8 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
 
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  mySelectionMgr->setSelectedObjects( io );
 }
 
 //=================================================================================
@@ -461,18 +540,30 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
     long aNbSteps = (long)SpinBox_NbSteps->value();
     double aTolerance = SpinBox_Tolerance->GetValue();
 
+    if (GroupAngle->selectedId() == 1)
+      anAngle = anAngle/aNbSteps;
+
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+
+      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+        SMESH::ListOfGroups_var groups = 
+          aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
+                                               anAngle, aNbSteps, aTolerance);
+      else
+        aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
+
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
-    mySelectionMgr->clearSelected();
     SMESH::UpdateView();
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+      mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
+    SelectionIntoArgument();
   }
 }
 
@@ -494,7 +585,7 @@ void SMESHGUI_RevolutionDlg::ClickOnCancel()
 {
   disconnect(mySelectionMgr, 0, this, 0);
   mySelectionMgr->clearFilters();
-  mySelectionMgr->clearSelected();
+  //mySelectionMgr->clearSelected();
   SMESH::SetPointRepresentation(false);
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
     aViewWindow->SetSelectionMode(ActorSelection);
@@ -502,6 +593,29 @@ void SMESHGUI_RevolutionDlg::ClickOnCancel()
   reject();
 }
 
+//=================================================================================
+// function : ClickOnHelp()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::ClickOnHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) 
+    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
+  else {
+               QString platform;
+#ifdef WIN32
+               platform = "winapplication";
+#else
+               platform = "application";
+#endif
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
+
 //=======================================================================
 // function : onTextChange()
 // purpose  :
@@ -551,6 +665,7 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+  onDisplaySimulation(true);
 
   myBusy = false;
 }
@@ -602,6 +717,14 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
 
+    // MakeGroups is available if there are groups
+    if ( myMesh->NbGroups() == 0 ) {
+      MakeGroupsCheck->setChecked(false);
+      MakeGroupsCheck->setEnabled(false);
+    } else {
+      MakeGroupsCheck->setEnabled(true);
+    }
+
     if (CheckBoxMesh->isChecked()) {
       int aConstructorId = GetConstructorId();
 
@@ -667,7 +790,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
         aNbUnits = anElementsIds->length();
       }
     } else {
-      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
+      aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
     }
 
@@ -676,7 +799,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
 
     myNbOkElements = true;
   } else {
-    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
+    aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
     if (aNbUnits != 1)
       return;
 
@@ -713,6 +836,8 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+
+  onDisplaySimulation(true);
 }
 
 //=================================================================================
@@ -728,6 +853,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
   mySelectionMgr->clearFilters();
 
   if (send == SelectElementsButton) {
+    mySimulation->SetVisibility(false);
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
     if (CheckBoxMesh->isChecked()) {
@@ -747,6 +873,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
            aViewWindow->SetSelectionMode(FaceSelection);
        }
     }
+    
   } else if (send == SelectPointButton) {
     myEditCurrentArgument = (QWidget*)SpinBox_X;
     SMESH::SetPointRepresentation(true);
@@ -841,6 +968,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
+    mySimulation->SetVisibility(false);
     return;
   }
 
@@ -867,6 +995,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
 
     LineEditElements->setReadOnly(false);
     onTextChange(LineEditElements->text());
+    mySimulation->SetVisibility(false);
   }
 
   SelectionIntoArgument();
@@ -907,4 +1036,89 @@ void SMESHGUI_RevolutionDlg::onVectorChanged()
     buttonOk->setEnabled(false);
     buttonApply->setEnabled(false);
   }
+  onDisplaySimulation(true);
+}
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
+{
+  QDialog::keyPressEvent( e );
+  if ( e->isAccepted() )
+    return;
+
+  if ( e->key() == Key_F1 )
+    {
+      e->accept();
+      ClickOnHelp();
+    }
+}
+
+//=================================================================================
+// function : toDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::toDisplaySimulation()
+{
+  onDisplaySimulation(true);
+}
+
+//=================================================================================
+// function : onDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
+{
+  if (CheckBoxPreview->isChecked() && toDisplayPreview)
+    {
+      //display preview
+      if (myNbOkElements && IsAxisOk()) {
+       QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+       SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+       anElementsId->length(aListElementsId.count());
+       for (int i = 0; i < aListElementsId.count(); i++)
+         anElementsId[i] = aListElementsId[i].toInt();
+
+       SMESH::AxisStruct anAxis;
+
+       anAxis.x =  SpinBox_X->GetValue();
+       anAxis.y =  SpinBox_Y->GetValue();
+       anAxis.z =  SpinBox_Z->GetValue();
+       anAxis.vx = SpinBox_DX->GetValue();
+       anAxis.vy = SpinBox_DY->GetValue();
+       anAxis.vz = SpinBox_DZ->GetValue();
+
+       double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+       long aNbSteps = (long)SpinBox_NbSteps->value();
+       double aTolerance = SpinBox_Tolerance->GetValue();
+
+       if (GroupAngle->selectedId() == 1)
+         anAngle = anAngle/aNbSteps;
+
+       try {
+          SUIT_OverrideCursor aWaitCursor;
+         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+          aMeshEditor->RotationSweep(anElementsId.inout(), 
+                                     anAxis, 
+                                     anAngle, 
+                                     aNbSteps, 
+                                     aTolerance);
+          SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+         mySimulation->SetData(aMeshPreviewStruct._retn());
+       } catch (...) {}
+      }
+      else
+       {
+         mySimulation->SetVisibility(false);
+       }
+    }
+  else
+    {
+      //erase preview
+      mySimulation->SetVisibility(false);
+    }
 }