Salome HOME
*** empty log message ***
authorasl <asl@opencascade.com>
Thu, 14 Jul 2005 11:26:09 +0000 (11:26 +0000)
committerasl <asl@opencascade.com>
Thu, 14 Jul 2005 11:26:09 +0000 (11:26 +0000)
src/SMESHGUI/Makefile.in
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_MoveNodesDlg.h
src/SMESHGUI/SMESHGUI_MoveNodesOp.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_MoveNodesOp.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx
src/SMESHGUI/SMESHGUI_RenumberingDlg.h
src/SMESHGUI/SMESHGUI_RenumberingOp.cxx [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_RenumberingOp.h [new file with mode: 0644]

index 1aa77135798bf6dc65424a7a2ee43cab78541718..15799cdd31a2e6214087d3832403f67b8daba19a 100644 (file)
@@ -80,6 +80,7 @@ LIB_SRC =     SMESHGUI.cxx \
                SMESHGUI_aParameterDlg.cxx \
                SMESHGUI_Swig.cxx \
                SMESHGUI_MoveNodesDlg.cxx \
+               SMESHGUI_MoveNodesOp.cxx \
                SMESHGUI_EditHypothesesDlg.cxx \
                SMESHGUI_EditHypothesesOp.cxx \
                SMESHGUI_CreateHypothesesDlg.cxx \
@@ -95,6 +96,7 @@ LIB_SRC =     SMESHGUI.cxx \
                SMESHGUI_GroupOp.cxx \
                SMESHGUI_SmoothingDlg.cxx \
                SMESHGUI_RenumberingDlg.cxx \
+               SMESHGUI_RenumberingOp.cxx \
                SMESHGUI_ExtrusionDlg.cxx \
                SMESHGUI_ExtrusionAlongPathDlg.cxx \
                SMESHGUI_RevolutionDlg.cxx \
@@ -146,6 +148,7 @@ LIB_MOC = \
                SMESHGUI_Preferences_SelectionDlg.h \
                SMESHGUI_aParameterDlg.h \
                SMESHGUI_MoveNodesDlg.h \
+               SMESHGUI_MoveNodesOp.h \
                SMESHGUI_EditHypothesesDlg.h \
                SMESHGUI_EditHypothesesOp.h \
                SMESHGUI_CreateHypothesesDlg.h \
@@ -158,6 +161,7 @@ LIB_MOC = \
                SMESHGUI_GroupOp.h \
                SMESHGUI_SmoothingDlg.h \
                SMESHGUI_RenumberingDlg.h \
+               SMESHGUI_RenumberingOp.h \
                SMESHGUI_ExtrusionDlg.h \
                SMESHGUI_ExtrusionAlongPathDlg.h \
                SMESHGUI_RevolutionDlg.h \
index 6b2d1e1cd43b0e91d8411a2d3c0df6d7f77988de..3156375b442ccfe343824d82de0e5cc1a8cde22d 100644 (file)
@@ -41,7 +41,7 @@
 #include "SMESHGUI_Preferences_SelectionDlg.h"
 #include "SMESHGUI_Hypotheses.h"
 #include "SMESHGUI_HypothesesUtils.h"
-#include "SMESHGUI_MoveNodesDlg.h"
+#include "SMESHGUI_MoveNodesOp.h"
 #include "SMESHGUI_AddMeshElementOp.h"
 #include "SMESHGUI_EditHypothesesOp.h"
 #include "SMESHGUI_CreateHypothesesDlg.h"
@@ -52,7 +52,7 @@
 #include "SMESHGUI_GroupOp.h"
 #include "SMESHGUI_DeleteGroupDlg.h"
 #include "SMESHGUI_SmoothingDlg.h"
-#include "SMESHGUI_RenumberingDlg.h"
+#include "SMESHGUI_RenumberingOp.h"
 #include "SMESHGUI_ExtrusionDlg.h"
 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
 #include "SMESHGUI_RevolutionDlg.h"
@@ -1146,15 +1146,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
   case 406:                                    // MOVE NODE
     {
-      if ( !vtkwnd )
+/*      if ( !vtkwnd )
       {
         SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
           tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
         break;
-      }
+      }*/
 
       if(checkLock(aStudy)) break;
-      new SMESHGUI_MoveNodesDlg(this);
+      startOperation( 406 );
+//      new SMESHGUI_MoveNodesDlg(this);
       break;
     }
 
@@ -1952,7 +1953,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 4051:                                   // RENUMBERING NODES
     {
       if(checkLock(aStudy)) break;
-      if( vtkwnd ) {
+      startOperation( 4051 );
+/*      if( vtkwnd ) {
        EmitSignalDeactivateDialog();
        new SMESHGUI_RenumberingDlg( this, "", 0);
       }
@@ -1961,13 +1963,14 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          SUIT_MessageBox::warn1(desktop(),
                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                                tr("SMESH_BUT_OK"));
-       }
+       }*/
       break;
     }
   case 4052:                                   // RENUMBERING ELEMENTS
     {
       if(checkLock(aStudy)) break;
-      if ( vtkwnd ) {
+      startOperation( 4052 );
+/*      if ( vtkwnd ) {
        EmitSignalDeactivateDialog();
        new SMESHGUI_RenumberingDlg( this, "", 1);
       }
@@ -1976,7 +1979,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
          SUIT_MessageBox::warn1(desktop(),
                                tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
                                tr("SMESH_BUT_OK"));
-       }
+       }*/
       break;
     }
   case 4061:                                   // TRANSLATION
@@ -3195,6 +3198,10 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
     case 401:
       op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Edge, 2 );
       break;
+
+    case 406:  // MOVE NODE
+      op = new SMESHGUI_MoveNodesOp();
+      break;
       
     case 4021:
       op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Face, 3 );
@@ -3219,7 +3226,15 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
     case 4041:
       op = new SMESHGUI_RemoveNodesOp();
       break;
-      
+
+    case 4051:  // RENUMBERING NODES
+      op = new SMESHGUI_RenumberingOp( 0 );
+      break;
+
+    case 4052:  // RENUMBERING ELEMENTS
+      op = new SMESHGUI_RenumberingOp( 1 );
+      break;
+            
     case 702:
       op = new SMESHGUI_AddSubMeshOp();
       break;
index f249535c87a3e4a6521ab88218941b9aa069233b..3b36976fcbeabef71e4003c65d81272c792fab3c 100644 (file)
 //  $Header$
 
 #include "SMESHGUI_MoveNodesDlg.h"
+#include <SMESHGUI_SpinBox.h>
 
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-#include "SMESHGUI_IdValidator.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
-#include "SMESHGUI_MeshUtils.h"
+#include <SUIT_ResourceMgr.h>
 
-#include "SMESH_Actor.h"
-#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
+#include <SMDSAbs_ElementType.hxx>
 
-#include "SalomeApp_SelectionMgr.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Desktop.h"
-
-#include "SVTK_Selector.h"
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "SALOME_ListIO.hxx"
-
-#include "SVTK_ViewWindow.h"
-
-#include "utilities.h"
-
-// OCCT includes
-#include <TColStd_MapOfInteger.hxx>
-
-// VTK includes
-#include <vtkCell.h>
-#include <vtkIdList.h>
-#include <vtkIntArray.h>
-#include <vtkCellArray.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDataSetMapper.h>
-
-// QT includes
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
 #include <qlayout.h>
-#include <qpixmap.h>
-#include <qmessagebox.h>
 #include <qbuttongroup.h>
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-
-#define MARGIN  10
-#define SPACING 5
-
+#include <qradiobutton.h>
+#include <qlabel.h>
 
 //=================================================================================
 // name    : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
 // Purpose :
 //=================================================================================
-SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, 
-                                             const char* theName):
-  QDialog(SMESH::GetDesktop(theModule), 
-         theName, 
-         false,
-         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
-  mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
-  mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
-  myViewWindow(SMESH::GetViewWindow(theModule)),
-  mySMESHGUI(theModule)
-{
-  myPreviewActor = 0;
-  myBusy = false;
-
-  setCaption(tr("CAPTION"));
-
-  QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
-
-  QFrame* aMainFrame = createMainFrame  (this);
-  QFrame* aBtnFrame  = createButtonFrame(this);
-
-  aDlgLay->addWidget(aMainFrame);
-  aDlgLay->addWidget(aBtnFrame);
-
-  aDlgLay->setStretchFactor(aMainFrame, 1);
-
-  Init();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
-QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
-{
-  QFrame* aFrame = new QFrame(theParent);
-  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
-  myOkBtn     = new QPushButton(tr("SMESH_BUT_OK"   ), aFrame);
-  myApplyBtn  = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
-  myCloseBtn  = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
-
-  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
-  QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
-
-  aLay->addWidget(myOkBtn);
-  aLay->addWidget(myApplyBtn);
-  aLay->addItem(aSpacer);
-  aLay->addWidget(myCloseBtn);
-
-  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
-  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
-  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
-
-  return aFrame;
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
-QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
+SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg()
+: SMESHGUI_Dialog()
 {
-  QFrame* aFrame = new QFrame(theParent);
+  setCaption( tr( "CAPTION" ) );
 
-  QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
-  QPixmap iconSelect   (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
+  QVBoxLayout* main = new QVBoxLayout( mainFrame() );
 
-  QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame);
+  QPixmap iconMoveNode( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_MOVE_NODE" ) ) );
+  
+  QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), mainFrame() );
   aPixGrp->setExclusive(TRUE);
   QRadioButton* aRBut = new QRadioButton(aPixGrp);
   aRBut->setPixmap(iconMoveNode);
   aRBut->setChecked(TRUE);
 
-  QGroupBox* anIdGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MOVE"), aFrame);
-  new QLabel(tr("NODE_ID"), anIdGrp);
-  (new QPushButton(anIdGrp))->setPixmap(iconSelect);
-  myId = new QLineEdit(anIdGrp);
-  myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1));
+  main->addWidget( aPixGrp );
+
+  QGroupBox* anIdGrp = new QGroupBox( 3, Qt::Horizontal, tr( "SMESH_MOVE" ), mainFrame() );
+  createObject( tr( "NODE_ID" ), anIdGrp, 0 );
+  setNameIndication( 0, OneName );
+  setObjectType( 0, prefix( "SMESH element" ) + SMDSAbs_Node, -1 );
 
-  QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame);
+  main->addWidget( anIdGrp );
+
+  QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), mainFrame() );
   new QLabel(tr("SMESH_X"), aCoordGrp);
   myX = new SMESHGUI_SpinBox(aCoordGrp);
   new QLabel(tr("SMESH_Y"), aCoordGrp);
@@ -176,378 +74,43 @@ QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
   new QLabel(tr("SMESH_Z"), aCoordGrp);
   myZ = new SMESHGUI_SpinBox(aCoordGrp);
 
+  main->addWidget( aCoordGrp );
+
   myX->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
   myY->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
-  myZ->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3);
+  myZ->RangeStepAndValidator(-999999.999, +999999.999, 25.0, 3); 
 
-  QVBoxLayout* aLay = new QVBoxLayout(aFrame);
-  aLay->addWidget(aPixGrp);
-  aLay->addWidget(anIdGrp);
-  aLay->addWidget(aCoordGrp);
-
-  // connect signale and slots
-  connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
-  connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
-  connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
-  connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
-
-  return aFrame;
+  connect( myX, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
+  connect( myY, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
+  connect( myZ, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged() ) );
 }
 
-//=======================================================================
+//=================================================================================
 // name    : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
 // Purpose :
-//=======================================================================
+//=================================================================================
 SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
 {
-  erasePreview();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::Init
-// Purpose : Init dialog fields
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::Init()
-{
-  myPreviewActor = 0;
-  myMeshActor = 0;
-  myBusy = false;
-
-  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
-  // selection and SMESHGUI
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
-  connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
-  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
-
-  reset();
-  setEnabled(true);
-
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
-  this->show();
-
-  // set selection mode
-  SMESH::SetPointRepresentation(true);
-  myViewWindow->SetSelectionMode(NodeSelection);
-
-  onSelectionDone();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::isValid
-// Purpose : Verify validity of entry information
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const
-{
-  if (myId->text().isEmpty()) {
-    if (theMess)
-      QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
-                               tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok);
-    return false;
-  }
-  return true;
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::reset
-// Purpose : Reset the dialog state
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::reset()
-{
-  myId->clear();
-  myX->SetValue(0);
-  myY->SetValue(0);
-  myZ->SetValue(0);
-  redisplayPreview();
-  updateButtons();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onApply
-// Purpose : SLOT called when "Apply" button pressed.
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::onApply()
-{
-  if (mySMESHGUI->isActiveStudyLocked())
-    return false;
-
-  if (!isValid(true))
-    return false;
-
-  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
-  if (aMesh->_is_nil()) {
-    QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
-                             tr("SMESHG_NO_MESH"), QMessageBox::Ok);
-    return false;
-  }
-
-  SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
-  if (aMeshEditor->_is_nil())
-    return false;
-
-  int anId = myId->text().toInt();
-  bool aResult = false;
-  try {
-    aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
-  } catch (...) {
-  }
-
-  if (aResult) {
-    SALOME_ListIO aList;
-    aList.Append(myMeshActor->getIO());
-    mySelectionMgr->setSelectedObjects(aList,false);
-    SMESH::UpdateView();
-    reset();
-  }
-
-  return aResult;
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onOk()
-{
-  if (onApply())
-    onClose();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onClose()
-{
-  mySelectionMgr->clearSelected();
-  SMESH::SetPointRepresentation(false);
-  myViewWindow->SetSelectionMode(ActorSelection);
-  disconnect(mySelectionMgr, 0, this, 0);
-  disconnect(mySMESHGUI, 0, this, 0);
-  mySMESHGUI->ResetState();
-  reject();
 }
 
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onTextChange
+//=================================================================================
+// name    : SMESHGUI_MoveNodesDlg::setCoords
 // Purpose :
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
-{
-  if (myBusy) return;
-
-  myOkBtn->setEnabled(false);
-  myApplyBtn->setEnabled(false);
-  erasePreview();
-
-  // select entered node
-  if(myMeshActor){
-    if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
-      myBusy = true;
-      Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
-      SALOME_ListIO aList;
-      aList.Append(anIO);
-      mySelectionMgr->setSelectedObjects(aList,false);
-      myBusy = false;
-
-      if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
-       TColStd_MapOfInteger aListInd;
-       aListInd.Add(anElem->GetID());
-       mySelector->AddOrRemoveIndex(anIO,aListInd, false);
-       myViewWindow->highlight(anIO,true,true);
-       
-       onSelectionDone();
-      }
-    }
-  }
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onSelectionDone
-// Purpose : SLOT called when selection changed
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onSelectionDone()
-{
-  if (myBusy) return;
-  myMeshActor = 0;
-
-  SALOME_ListIO aList;
-  mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
-
-  if (aList.Extent() == 1) {
-    Handle(SALOME_InteractiveObject) anIO = aList.First();
-    myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
-    if(myMeshActor){
-      QString aText;
-      if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
-        if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
-          if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
-            myBusy = true;
-            myId->setText(aText);
-            myX->SetValue(aNode->X());
-            myY->SetValue(aNode->Y());
-            myZ->SetValue(aNode->Z());
-            myBusy = false;
-            erasePreview(); // avoid overlapping of a selection and a preview
-            updateButtons();
-            return;
-          }
-        }
-      }
-    }
-  }
-
-  reset();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onDeactivate()
-{
-  setEnabled(false);
-  erasePreview();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::enterEvent
-// Purpose : Event filter
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
+//=================================================================================
+void SMESHGUI_MoveNodesDlg::setCoords( const double x, const double y, const double z )
 {
-  if (!isEnabled()) {
-    mySMESHGUI->EmitSignalDeactivateDialog();
-
-    // set selection mode
-    SMESH::SetPointRepresentation(true);
-    myViewWindow->SetSelectionMode(NodeSelection);
-
-    redisplayPreview();
-
-    setEnabled(true);
-  }
+  myX->setValue( x );
+  myY->setValue( y );
+  myZ->setValue( z );
 }
 
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::closeEvent
+//=================================================================================
+// name    : SMESHGUI_MoveNodesDlg::coords
 // Purpose :
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
-{
-  onClose();
-  myViewWindow->Repaint();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::hideEvent
-// Purpose : may be caused by ESC key
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
-{
-  if (!isMinimized())
-    onClose();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::updateButtons
-// Purpose : Update buttons state
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::updateButtons()
-{
-  bool isEnabled = isValid(false);
-  myOkBtn->setEnabled(isEnabled);
-  myApplyBtn->setEnabled(isEnabled);
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::erasePreview
-// Purpose : Erase preview
-//=======================================================================
-void  SMESHGUI_MoveNodesDlg::erasePreview()
-{
-  if (myPreviewActor == 0)
-    return;
-
-  myViewWindow->RemoveActor(myPreviewActor);
-  myPreviewActor->Delete();
-  myPreviewActor = 0;
-  myViewWindow->Repaint();
-}
-
-//=======================================================================
-// name    : SMESHGUI_MoveNodesDlg::redisplayPreview
-// Purpose : Redisplay preview
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::redisplayPreview()
+//=================================================================================
+void SMESHGUI_MoveNodesDlg::coords( double& x, double& y, double& z ) const
 {
-  if (myBusy)
-    return;
-
-  if (myPreviewActor != 0)
-    erasePreview();
-
-  if (!isValid(false))
-    return;
-
-  vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
-
-  vtkPoints* aPoints = vtkPoints::New();
-  aPoints->SetNumberOfPoints(1);
-  aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
-
-  // Create cells
-
-  vtkIdList *anIdList = vtkIdList::New();
-  anIdList->SetNumberOfIds(1);
-
-  vtkCellArray *aCells = vtkCellArray::New();
-  aCells->Allocate(2, 0);
-
-  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
-  aCellTypesArray->SetNumberOfComponents(1);
-  aCellTypesArray->Allocate(1);
-
-  anIdList->SetId(0, 0);
-  aCells->InsertNextCell(anIdList);
-  aCellTypesArray->InsertNextValue(VTK_VERTEX);
-  anIdList->Delete();
-
-  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
-  aCellLocationsArray->SetNumberOfComponents(1);
-  aCellLocationsArray->SetNumberOfTuples(1);
-
-  aCells->InitTraversal();
-  vtkIdType npts;
-  aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
-
-  aGrid->SetPoints(aPoints);
-  aPoints->Delete();
-
-  aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
-  aCellLocationsArray->Delete();
-  aCellTypesArray->Delete();
-  aCells->Delete();
-
-  // Create and display actor
-  vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
-  aMapper->SetInput(aGrid);
-  aGrid->Delete();
-
-  myPreviewActor = SALOME_Actor::New();
-  myPreviewActor->PickableOff();
-  myPreviewActor->SetMapper(aMapper);
-  aMapper->Delete();
-
-  vtkProperty* aProp = vtkProperty::New();
-  aProp->SetRepresentationToWireframe();
-  aProp->SetColor(250, 0, 250);
-  aProp->SetPointSize(5);
-  myPreviewActor->SetProperty(aProp);
-  aProp->Delete();
-
-  myViewWindow->AddActor(myPreviewActor);
-  myViewWindow->Repaint();
+  x = myX->value();
+  y = myY->value();
+  z = myZ->value();
 }
index 4163c542126b0a1eaf5f700a03182b5292fc9793..9f0edf56b72b82854262160630394363b9e0bea3 100644 (file)
 #ifndef DIALOGBOX_MOVE_NODES_H
 #define DIALOGBOX_MOVE_NODES_H
 
-#include "SalomeApp_SelectionMgr.h"
+#include <SMESHGUI_Dialog.h>
 
-#include <qdialog.h>
-
-class QLineEdit;
-class QPushButton;
 class SMESHGUI_SpinBox;
-class SALOME_Actor;
-class QFrame;
-
-class SMESHGUI;
-class SMESH_Actor;
-class SUIT_Desktop;
-class SVTK_Selector;
-class SVTK_ViewWindow;
 
 //=================================================================================
 // class    : SMESHGUI_MoveNodesDlg
 // purpose  :
 //=================================================================================
-class SMESHGUI_MoveNodesDlg : public QDialog
+class SMESHGUI_MoveNodesDlg : public SMESHGUI_Dialog
 { 
   Q_OBJECT
 
 public:
+  SMESHGUI_MoveNodesDlg();
+  virtual ~SMESHGUI_MoveNodesDlg();
 
-                                SMESHGUI_MoveNodesDlg(SMESHGUI* theModule,
-                                                     const char* name = 0);
- virtual                        ~SMESHGUI_MoveNodesDlg();
-    
- void                           Init();
-
-private slots:
-
-  void                          onOk();
-  bool                          onApply();
-  void                          onClose();
-
-  void                          onDeactivate();
-
-  void                          onSelectionDone();
-  void                          redisplayPreview();
-  void                          onTextChange(const QString&);
-
-private:
-
-  void                          closeEvent( QCloseEvent* e ) ;
-  void                          enterEvent ( QEvent * ) ;
-  void                          hideEvent ( QHideEvent * );
-  void                          erasePreview();
-  QFrame*                       createButtonFrame( QWidget* );
-  QFrame*                       createMainFrame  ( QWidget* );
-  bool                          isValid( const bool ) const;
-  void                          reset();
-  void                          updateButtons();
-
-private:
+  void setCoords( const double, const double, const double );
+  void coords( double&, double&, double& ) const;
 
-  QPushButton*                  myOkBtn;
-  QPushButton*                  myApplyBtn;
-  QPushButton*                  myCloseBtn;
+signals:
+  void valueChanged();
   
-  QLineEdit*                    myId;
-  SMESHGUI_SpinBox*             myX;
-  SMESHGUI_SpinBox*             myY;
-  SMESHGUI_SpinBox*             myZ;
-
-  SalomeApp_SelectionMgr*       mySelectionMgr;
-  SVTK_ViewWindow*              myViewWindow;
-  SVTK_Selector*                mySelector;
-  SMESHGUI*                     mySMESHGUI;
-  
-  SALOME_Actor*                 myPreviewActor;
-  SMESH_Actor*                  myMeshActor;
-  bool                          myBusy;
+private:
+  SMESHGUI_SpinBox *myX, *myY, *myZ;
 };
 
 #endif // DIALOGBOX_MOVE_NODES_H
diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesOp.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesOp.cxx
new file mode 100644 (file)
index 0000000..09a65cc
--- /dev/null
@@ -0,0 +1,299 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  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
+//
+//
+//
+//  File   : SMESHGUI_MoveNodesOp.cxx
+//  Author : Alexander SOLOVYOV
+//  Module : SMESH
+//  $Header$
+
+#include "SMESHGUI_MoveNodesOp.h"
+#include <SMESHGUI_MoveNodesDlg.h>
+#include <SMESHGUI.h>
+#include <SMESHGUI_VTKUtils.h>
+
+#include <SalomeApp_SelectionMgr.h>
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_Desktop.h>
+
+#include <SALOME_ListIO.hxx>
+
+#include <SVTK_ViewWindow.h>
+
+#include <SMDS_Mesh.hxx>
+#include <SMDS_MeshNode.hxx>
+
+#include <SMESH_Actor.h>
+
+#include <vtkIdList.h>
+#include <vtkCellArray.h>
+#include <vtkIntArray.h>
+#include <vtkUnsignedCharArray.h>
+
+//=======================================================================
+// name    : SMESHGUI_MoveNodesOp
+// Purpose :
+//=======================================================================
+SMESHGUI_MoveNodesOp::SMESHGUI_MoveNodesOp()
+: SMESHGUI_SelectionOp( NodeSelection ),
+  myDlg( 0 ),
+  myPreviewActor( 0 )
+{
+}
+
+//=======================================================================
+// name    : ~SMESHGUI_MoveNodesOp
+// Purpose : 
+//=======================================================================
+SMESHGUI_MoveNodesOp::~SMESHGUI_MoveNodesOp()
+{
+  if( myDlg )
+    delete myDlg;
+}
+
+//=======================================================================
+// name    : dlg
+// Purpose :
+//=======================================================================
+SalomeApp_Dialog* SMESHGUI_MoveNodesOp::dlg() const
+{
+  return myDlg;
+}
+
+//=======================================================================
+// name    : startOperation
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::startOperation()
+{
+  if( !myDlg )
+  {
+    myDlg = new SMESHGUI_MoveNodesDlg();
+    connect( myDlg, SIGNAL( valueChanged() ), this, SLOT( redisplayPreview() ) );
+  }
+
+  SMESHGUI_SelectionOp::startOperation();
+
+  updateDialog();
+  myDlg->show();
+}
+
+//=======================================================================
+// name    : selectionDone
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::selectionDone()
+{
+  SMESHGUI_SelectionOp::selectionDone();
+
+  SMESH_Actor* a = actor();
+  if( myDlg && myDlg->hasSelection( 0 ) && a )
+  {
+    SMDS_Mesh* aMesh = a->GetObject()->GetMesh();
+    if( aMesh )
+    {
+      IdList ids; selectedIds( 0, ids );
+      if( const SMDS_MeshNode* aNode = aMesh->FindNode( ids.first() ) )
+        myDlg->setCoords( aNode->X(), aNode->Y(), aNode->Z() );
+    }
+  }
+  updateDialog();
+}
+
+//=======================================================================
+// name    : updateDialog
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::updateDialog()
+{
+  if( !myDlg )
+    return;
+    
+  bool en = myDlg->hasSelection( 0 );
+  myDlg->setButtonEnabled( en, QtxDialog::OK | QtxDialog::Apply );
+}
+
+//=======================================================================
+// name    : initDialog
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::initDialog()
+{
+  SMESHGUI_SelectionOp::initDialog();
+  if( myDlg )
+    myDlg->setCoords( 0, 0, 0 );
+}
+  
+
+//=======================================================================
+// name    : onApply
+// Purpose :
+//=======================================================================
+bool SMESHGUI_MoveNodesOp::onApply()
+{
+  if( getSMESHGUI()->isActiveStudyLocked() )
+    return false;
+
+  if( !myDlg->hasSelection( 0 ) )
+    return false;
+
+  SMESH::SMESH_Mesh_var aMesh = mesh();
+  if (aMesh->_is_nil()) {
+    SUIT_MessageBox::info1( desktop(), tr("SMESH_ERROR"),
+                            tr("SMESHG_NO_MESH"), tr( "OK" ) );
+    return false;
+  }
+
+  SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+  if (aMeshEditor->_is_nil())
+    return false;
+
+  IdList ids; selectedIds( 0, ids );
+  int anId = ids.first();
+  bool aResult = false;
+  try {
+    double x, y, z;
+    myDlg->coords( x, y, z );
+    aResult = aMeshEditor->MoveNode( anId, x, y, z );
+  } catch (...) {
+  }
+
+  if (aResult) {
+    SALOME_ListIO aList;
+    aList.Append( actor()->getIO());
+    selectionMgr()->setSelectedObjects(aList,false);
+    SMESH::UpdateView();
+    initDialog();
+  }
+
+  return aResult;
+}  
+
+//=======================================================================
+// name    : redisplayPreview
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::redisplayPreview()
+{
+  if (myPreviewActor != 0)
+    erasePreview();
+
+  if( !myDlg && !myDlg->hasSelection( 0 ) )
+    return;
+
+  vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
+
+  vtkPoints* aPoints = vtkPoints::New();
+  aPoints->SetNumberOfPoints(1);
+  double x, y, z; myDlg->coords( x, y, z );
+  aPoints->SetPoint( 0, x, y, z );
+
+  // Create cells
+
+  vtkIdList *anIdList = vtkIdList::New();
+  anIdList->SetNumberOfIds(1);
+
+  vtkCellArray *aCells = vtkCellArray::New();
+  aCells->Allocate(2, 0);
+
+  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+  aCellTypesArray->SetNumberOfComponents(1);
+  aCellTypesArray->Allocate(1);
+
+  anIdList->SetId(0, 0);
+  aCells->InsertNextCell(anIdList);
+  aCellTypesArray->InsertNextValue(VTK_VERTEX);
+  anIdList->Delete();
+
+  vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+  aCellLocationsArray->SetNumberOfComponents(1);
+  aCellLocationsArray->SetNumberOfTuples(1);
+
+  aCells->InitTraversal();
+  vtkIdType npts;
+  aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
+
+  aGrid->SetPoints(aPoints);
+  aPoints->Delete();
+
+  aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
+  aCellLocationsArray->Delete();
+  aCellTypesArray->Delete();
+  aCells->Delete();
+
+  // Create and display actor
+  vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
+  aMapper->SetInput(aGrid);
+  aGrid->Delete();
+
+  myPreviewActor = SALOME_Actor::New();
+  myPreviewActor->PickableOff();
+  myPreviewActor->SetMapper(aMapper);
+  aMapper->Delete();
+
+  vtkProperty* aProp = vtkProperty::New();
+  aProp->SetRepresentationToWireframe();
+  aProp->SetColor(250, 0, 250);
+  aProp->SetPointSize(5);
+  myPreviewActor->SetProperty(aProp);
+  aProp->Delete();
+
+  viewWindow()->AddActor(myPreviewActor);
+  viewWindow()->Repaint();
+}  
+
+//=======================================================================
+// name    : erasePreview
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::erasePreview()
+{
+  if (myPreviewActor == 0)
+    return;
+
+  viewWindow()->RemoveActor(myPreviewActor);
+  myPreviewActor->Delete();
+  myPreviewActor = 0;
+  viewWindow()->Repaint();
+}  
+
+//=======================================================================
+// name    : commitOperation
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::commitOperation()
+{
+  SMESHGUI_SelectionOp::commitOperation();
+  erasePreview();
+}
+
+//=======================================================================
+// name    : abortOperation
+// Purpose :
+//=======================================================================
+void SMESHGUI_MoveNodesOp::abortOperation()
+{
+  SMESHGUI_SelectionOp::abortOperation();
+  erasePreview();
+}
+
diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesOp.h b/src/SMESHGUI/SMESHGUI_MoveNodesOp.h
new file mode 100644 (file)
index 0000000..ea0d3fb
--- /dev/null
@@ -0,0 +1,72 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  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 
+//
+//
+//
+//  File   : SMESHGUI_MoveNodesOp.h
+//  Author : Alexander SOLOVYOV
+//  Module : SMESH
+//  $Header$
+
+#ifndef OPERATION_MOVE_NODES_H
+#define OPERATION_MOVE_NODES_H
+
+#include <SMESHGUI_SelectionOp.h>
+
+class SMESHGUI_MoveNodesDlg;
+class SALOME_Actor;
+
+//=================================================================================
+// class    : SMESHGUI_MoveNodesOp
+// purpose  :
+//=================================================================================
+class SMESHGUI_MoveNodesOp : public SMESHGUI_SelectionOp
+{ 
+  Q_OBJECT
+
+public:
+  SMESHGUI_MoveNodesOp();
+  virtual ~SMESHGUI_MoveNodesOp();
+
+  virtual SalomeApp_Dialog* dlg() const;
+
+protected:
+  virtual void startOperation();
+  virtual void selectionDone();
+  virtual void initDialog();
+  virtual void commitOperation();
+  virtual void abortOperation();  
+
+  void updateDialog();
+
+protected slots:
+  virtual bool onApply();
+  virtual void redisplayPreview();
+
+private:
+  void erasePreview();
+  
+private:
+  SALOME_Actor*               myPreviewActor;
+  SMESHGUI_MoveNodesDlg*      myDlg;  
+};
+
+#endif // DIALOGBOX_MOVE_NODES_H
index be16e7ede444ec7077ff27582e06b3e58bd105c0..9f6c71e91a8c567e7a47f9897e2a7d6042ad713d 100644 (file)
 
 #include "SMESHGUI_RenumberingDlg.h"
 
-#include "SMESHGUI.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
+#include <SUIT_ResourceMgr.h>
+#include <SMESH_Type.h>
 
-#include "SMESH_Actor.h"
-#include "SMESH_TypeFilter.hxx"
-#include "SMDS_Mesh.hxx"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-
-#include "SALOME_ListIO.hxx"
-
-#include "utilities.h"
-
-// QT Includes
-#include <qapplication.h>
-#include <qbuttongroup.h>
+#include <qlayout.h>
 #include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
+#include <qbuttongroup.h>
 #include <qradiobutton.h>
-#include <qlayout.h>
-#include <qpixmap.h>
-
-using namespace std;
 
 //=================================================================================
 // class    : SMESHGUI_RenumberingDlg()
 // purpose  :
 //=================================================================================
-SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const char* name,
-                                                 const int unit, bool modal, WFlags fl)
-     : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
-               WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
-     mySMESHGUI( theModule ),
-     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( const int unit )
 {
-  myUnit = unit;
-
-  if (!name)
-    setName("SMESHGUI_RenumberingDlg");
+  setName("SMESHGUI_RenumberingDlg");
   resize(303, 185);
 
-  QPixmap image0;
-  QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
-
-  if (unit == 0) {
-    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_NODES")));
-    setCaption(tr("SMESH_RENUMBERING_NODES_TITLE" ));
-  }
-  else if (unit == 1) {
-    image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_ELEMENTS")));
-    setCaption(tr("SMESH_RENUMBERING_ELEMENTS_TITLE" ));
-  }
-
-  setSizeGripEnabled(TRUE);
-  SMESHGUI_RenumberingDlgLayout = new QGridLayout(this);
-  SMESHGUI_RenumberingDlgLayout->setSpacing(6);
-  SMESHGUI_RenumberingDlgLayout->setMargin(11);
+  QString cap = unit==0 ? "%1RENUMBERING_NODES%2" : "%1RENUMBERING_ELEMENTS%2";
+  QPixmap image0 = resMgr()->loadPixmap( "SMESH", tr( cap.arg( "ICON_DLG_" ).arg( "" ) ) );
+  setCaption( tr( cap.arg( "SMESH_" ).arg( "_TITLE" ) ) );
+  
+  QVBoxLayout* main = new QVBoxLayout( mainFrame() );
 
   /***************************************************************/
-  GroupConstructors = new QButtonGroup(this, "GroupConstructors");
-  if (unit == 0)
-    GroupConstructors->setTitle(tr("SMESH_NODES" ));
-  else if (unit == 1)
-    GroupConstructors->setTitle(tr("SMESH_ELEMENTS" ));
+  QButtonGroup* GroupConstructors = new QButtonGroup( mainFrame(), "GroupConstructors");
+  GroupConstructors->setTitle( tr( QString( "SMESH_%1" ). arg( unit==0 ? "NODES" : "ELEMENTS" ) ) );
   GroupConstructors->setExclusive(TRUE);
   GroupConstructors->setColumnLayout(0, Qt::Vertical);
   GroupConstructors->layout()->setSpacing(0);
   GroupConstructors->layout()->setMargin(0);
-  GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
+  QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
   GroupConstructorsLayout->setAlignment(Qt::AlignTop);
   GroupConstructorsLayout->setSpacing(6);
   GroupConstructorsLayout->setMargin(11);
-  Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
+  QRadioButton* Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
   Constructor1->setText(tr("" ));
   Constructor1->setPixmap(image0);
   Constructor1->setChecked(TRUE);
@@ -113,66 +71,22 @@ SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const cha
   GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
   QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
   GroupConstructorsLayout->addItem(spacer, 0, 1);
-  SMESHGUI_RenumberingDlgLayout->addWidget(GroupConstructors, 0, 0);
+  
+  main->addWidget(GroupConstructors);
 
   /***************************************************************/
-  GroupButtons = new QGroupBox(this, "GroupButtons");
-  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
-  GroupButtons->setTitle(tr("" ));
-  GroupButtons->setColumnLayout(0, Qt::Vertical);
-  GroupButtons->layout()->setSpacing(0);
-  GroupButtons->layout()->setMargin(0);
-  GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
-  GroupButtonsLayout->setAlignment(Qt::AlignTop);
-  GroupButtonsLayout->setSpacing(6);
-  GroupButtonsLayout->setMargin(11);
-  buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
-  buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
-  buttonCancel->setAutoDefault(TRUE);
-  GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
-  buttonApply = new QPushButton(GroupButtons, "buttonApply");
-  buttonApply->setText(tr("SMESH_BUT_APPLY" ));
-  buttonApply->setAutoDefault(TRUE);
-  GroupButtonsLayout->addWidget(buttonApply, 0, 1);
-  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->setAutoDefault(TRUE);
-  buttonOk->setDefault(TRUE);
-  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
-  SMESHGUI_RenumberingDlgLayout->addWidget(GroupButtons, 2, 0);
-
-  /***************************************************************/
-  GroupMesh = new QGroupBox(this, "GroupMesh");
+  QGroupBox* GroupMesh = new QGroupBox( mainFrame(), "GroupMesh");
   GroupMesh->setTitle(tr("SMESH_RENUMBERING" ));
   GroupMesh->setMinimumSize(QSize(0, 0));
   GroupMesh->setFrameShape(QGroupBox::Box);
   GroupMesh->setFrameShadow(QGroupBox::Sunken);
-  GroupMesh->setColumnLayout(0, Qt::Vertical);
-  GroupMesh->layout()->setSpacing(0);
-  GroupMesh->layout()->setMargin(0);
-  GroupMeshLayout = new QGridLayout(GroupMesh->layout());
-  GroupMeshLayout->setAlignment(Qt::AlignTop);
-  GroupMeshLayout->setSpacing(6);
-  GroupMeshLayout->setMargin(11);
-  TextLabelMesh = new QLabel(GroupMesh, "TextLabelMesh");
-  TextLabelMesh->setText(tr("SMESH_MESH"));
-  TextLabelMesh->setMinimumSize(QSize(50, 0));
-  TextLabelMesh->setFrameShape(QLabel::NoFrame);
-  TextLabelMesh->setFrameShadow(QLabel::Plain);
-  GroupMeshLayout->addWidget(TextLabelMesh, 0, 0);
-  SelectButton = new QPushButton(GroupMesh, "SelectButton");
-  SelectButton->setText(tr("" ));
-  SelectButton->setPixmap(image1);
-  SelectButton->setToggleButton(FALSE);
-  GroupMeshLayout->addWidget(SelectButton, 0, 1);
-  LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh");
-  LineEditMesh->setReadOnly(true);
-  GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
-  SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh, 1, 0);
+  GroupMesh->setColumnLayout( 3, Qt::Horizontal );
 
-  Init(); /* Initialisations */
+  createObject( tr( "SMESH_MESH" ), GroupMesh, 0 );
+  setNameIndication( 0, OneName );
+  setObjectType( 0, prefix( "SMESH" ) + MESH, -1 );
+  
+  main->addWidget( GroupMesh );
 }
 
 //=================================================================================
@@ -181,241 +95,4 @@ SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const cha
 //=================================================================================
 SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg()
 {
-  // no need to delete child widgets, Qt does it all for us
-}
-
-//=================================================================================
-// function : Init()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::Init()
-{
-  GroupMesh->show();
-  myConstructorId = 0;
-  Constructor1->setChecked(TRUE);
-  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
-  myMesh = SMESH::SMESH_Mesh::_nil();
-
-  myMeshFilter = new SMESH_TypeFilter (MESH);
-
-  /* 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(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
-
-  connect(SelectButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
-  connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-  /* to close dialog if study change */
-  connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
-
-  /* Move widget on the botton right corner of main widget */
-  int x, y;
-  mySMESHGUI->DefineDlgPosition(this, x, y);
-  this->move(x, y);
-  this->show(); /* displays Dialog */
-
-  myEditCurrentArgument = LineEditMesh;
-  LineEditMesh->setFocus();
-  mySelectionMgr->clearFilters();
-  mySelectionMgr->installFilter(myMeshFilter);
-
-  SelectionIntoArgument();
-}
-
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose  : Radio button management
-//=================================================================================
-void SMESHGUI_RenumberingDlg::ConstructorsClicked (int)
-{
-}
-
-//=================================================================================
-// function : ClickOnApply()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::ClickOnApply()
-{
-  if (mySMESHGUI->isActiveStudyLocked())
-    return;
-
-  if (!myMesh->_is_nil())
-    {
-      try
-       {
-         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
-         SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
-         bool isUnitsLabeled = false;
-
-         if (myUnit == 0 && anActor) {
-           isUnitsLabeled = anActor->GetPointsLabeled();
-           if (isUnitsLabeled)  anActor->SetPointsLabeled(false);
-         }
-         else if (myUnit == 1 && anActor) {
-           isUnitsLabeled = anActor->GetCellsLabeled();
-           if (isUnitsLabeled)  anActor->SetCellsLabeled(false);
-         }
-
-         QApplication::setOverrideCursor(Qt::waitCursor);
-         if (myUnit == 0) {
-           aMeshEditor->RenumberNodes();
-           if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true);
-         }
-         else if (myUnit == 1) {
-           aMeshEditor->RenumberElements();
-           if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true);
-         }
-         QApplication::restoreOverrideCursor();
-       }
-      catch(...)
-       {
-       }
-
-      mySelectionMgr->clearSelected();
-      SMESH::UpdateView();
-    }
-}
-
-//=================================================================================
-// function : ClickOnOk()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::ClickOnOk()
-{
-  ClickOnApply();
-  ClickOnCancel();
-}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::ClickOnCancel()
-{
-  mySelectionMgr->clearSelected();
-  mySelectionMgr->clearFilters();
-  disconnect(mySelectionMgr, 0, this, 0);
-  mySMESHGUI->ResetState();
-  reject();
-}
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose  : Called when selection as changed or other case
-//=================================================================================
-void SMESHGUI_RenumberingDlg::SelectionIntoArgument()
-{
-  if (!GroupButtons->isEnabled()) // inactive
-    return;
-
-  QString aString = "";
-
-  SALOME_ListIO aList;
-  mySelectionMgr->selectedObjects(aList);
-  int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
-
-  if (myEditCurrentArgument == LineEditMesh) {
-    // mesh
-    if (nbSel != 1) {
-      myMesh = SMESH::SMESH_Mesh::_nil();
-      aString = "";
-    } else {
-      Handle(SALOME_InteractiveObject) IO = aList.First();
-      myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
-      if (myMesh->_is_nil())
-       aString = "";
-    }
-  }
-
-  myEditCurrentArgument->setText(aString);
-
-  bool isEnabled = (!myMesh->_is_nil());
-  buttonOk->setEnabled(isEnabled);
-  buttonApply->setEnabled(isEnabled);
-}
-
-//=================================================================================
-// function : SetEditCurrentArgument()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::SetEditCurrentArgument()
-{
-  QPushButton* send = (QPushButton*)sender();
-  switch (myConstructorId)
-    {
-    case 0: /* default constructor */
-      {
-       if(send == SelectButton) {
-         LineEditMesh->setFocus();
-         myEditCurrentArgument = LineEditMesh;
-       }
-       SelectionIntoArgument();
-       break;
-      }
-    }
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::DeactivateActiveDialog()
-{
-  if (GroupConstructors->isEnabled()) {
-    GroupConstructors->setEnabled(false);
-    GroupMesh->setEnabled(false);
-    GroupButtons->setEnabled(false);
-    mySMESHGUI->ResetState();
-    mySMESHGUI->SetActiveDialogBox(0);
-  }
-}
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::ActivateThisDialog()
-{
-  /* Emit a signal to deactivate the active dialog */
-  mySMESHGUI->EmitSignalDeactivateDialog();
-  GroupConstructors->setEnabled(true);
-  GroupMesh->setEnabled(true);
-  GroupButtons->setEnabled(true);
-
-  mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-  SelectionIntoArgument();
-}
-
-//=================================================================================
-// function : enterEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::enterEvent(QEvent* e)
-{
-  if (GroupConstructors->isEnabled())
-    return;
-  ActivateThisDialog();
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_RenumberingDlg::closeEvent(QCloseEvent* e)
-{
-  /* same than click on cancel button */
-  this->ClickOnCancel();
-}
-
-//=======================================================================
-//function : hideEvent
-//purpose  : caused by ESC key
-//=======================================================================
-void SMESHGUI_RenumberingDlg::hideEvent (QHideEvent * e)
-{
-  if (!isMinimized())
-    ClickOnCancel();
 }
index 22e5fc6172d8d85859a3d6cf9950dffa166fa4a2..369f2636ef3b0ab3a9ba1f4abb11fd9baf1991ce 100644 (file)
 #ifndef DIALOGBOX_RENUMBERING_H
 #define DIALOGBOX_RENUMBERING_H
 
-#include "SalomeApp_SelectionMgr.h"
-//#include "SMESH_TypeFilter.hxx"
-#include "SUIT_SelectionFilter.h"
-
-// QT Includes
-#include <qdialog.h>
-
-// Open CASCADE Includes
-
-class QGridLayout; 
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
-class SMESHGUI;
-
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include <SMESHGUI_Dialog.h>
 
 //=================================================================================
 // class    : SMESHGUI_RenumberingDlg
 // purpose  : If the unit == 0 nodes will be renumbered, if the unit == 1 the elements will.
 //=================================================================================
-class SMESHGUI_RenumberingDlg : public QDialog
+class SMESHGUI_RenumberingDlg : public SMESHGUI_Dialog
 { 
     Q_OBJECT
 
 public:
-    SMESHGUI_RenumberingDlg( SMESHGUI*,
-                            const char* name = 0,
-                            const int unit = 0,
-                            bool modal = FALSE,
-                            WFlags fl = 0);
+    SMESHGUI_RenumberingDlg( const int );
     ~SMESHGUI_RenumberingDlg();
-
-private:
-    void Init();
-    void closeEvent( QCloseEvent* e ) ;
-    void enterEvent ( QEvent * ) ;                         /* mouse enter the QWidget */
-    void hideEvent ( QHideEvent * );                       /* ESC key */
-    
-    SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
-    SalomeApp_SelectionMgr*       mySelectionMgr;          /* User shape selection */
-    int                           myConstructorId;         /* Current constructor id = radio button id */
-    QLineEdit*                    myEditCurrentArgument;   /* Current  LineEdit */
-
-    int myUnit;    
-    SMESH::SMESH_Mesh_var         myMesh;
-    //Handle(SMESH_TypeFilter)      myMeshFilter;
-    SUIT_SelectionFilter*         myMeshFilter;
-        
-    QButtonGroup* GroupConstructors;
-    QRadioButton* Constructor1;
-    QGroupBox* GroupButtons;
-    QPushButton* buttonOk;
-    QPushButton* buttonCancel;
-    QPushButton* buttonApply;
-    QGroupBox* GroupMesh;
-    QLabel* TextLabelMesh;
-    QPushButton* SelectButton;
-    QLineEdit* LineEditMesh;
-
-private slots:
-
-    void ConstructorsClicked(int constructorId);
-    void ClickOnOk();
-    void ClickOnCancel();
-    void ClickOnApply();
-    void SetEditCurrentArgument() ;
-    void SelectionIntoArgument() ;
-    void DeactivateActiveDialog() ;
-    void ActivateThisDialog() ;
-    
-protected:
-    QGridLayout* SMESHGUI_RenumberingDlgLayout;
-    QGridLayout* GroupConstructorsLayout;
-    QGridLayout* GroupButtonsLayout;
-    QGridLayout* GroupMeshLayout;
 };
 
 #endif // DIALOGBOX_RENUMBERING_H
diff --git a/src/SMESHGUI/SMESHGUI_RenumberingOp.cxx b/src/SMESHGUI/SMESHGUI_RenumberingOp.cxx
new file mode 100644 (file)
index 0000000..a77c9a3
--- /dev/null
@@ -0,0 +1,184 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  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
+//
+//
+//
+//  File   : SMESHGUI_RenumberingOp.cxx
+//  Author : Alexander SOLOVYOV
+//  Module : SMESH
+//  $Header$
+
+#include "SMESHGUI_RenumberingOp.h"
+#include <SMESHGUI_RenumberingDlg.h>
+#include <SMESHGUI.h>
+#include <SMESHGUI_VTKUtils.h>
+
+#include <SMESH_TypeFilter.hxx>
+#include <SMESH_Actor.h>
+#include <SMESH_ActorUtils.h>
+
+#include <SUIT_OverrideCursor.h>
+
+#include <SALOMEDS_SObject.hxx>
+
+//=================================================================================
+// name     : SMESHGUI_RenumberingOp
+// purpose  : 
+//=================================================================================
+SMESHGUI_RenumberingOp::SMESHGUI_RenumberingOp( const int mode )
+: SMESHGUI_SelectionOp(),
+  myMode( mode ),
+  myDlg( 0 )
+{ 
+}
+
+//=================================================================================
+// name     : ~SMESHGUI_RenumberingOp
+// purpose  :
+//=================================================================================
+SMESHGUI_RenumberingOp::~SMESHGUI_RenumberingOp()
+{
+  if( myDlg )
+    delete myDlg;
+}
+
+//=================================================================================
+// name     : dlg
+// purpose  :
+//=================================================================================
+SalomeApp_Dialog* SMESHGUI_RenumberingOp::dlg() const
+{
+  return myDlg;
+}
+
+//=================================================================================
+// name     : startOperation
+// purpose  :
+//=================================================================================
+void SMESHGUI_RenumberingOp::startOperation()
+{
+  if( !myDlg )
+    myDlg = new SMESHGUI_RenumberingDlg( myMode );
+    
+  SMESHGUI_SelectionOp::startOperation();
+  
+  updateDialog();
+  myDlg->show();
+}
+
+//=================================================================================
+// name     : selectionDone
+// purpose  :
+//=================================================================================
+void SMESHGUI_RenumberingOp::selectionDone()
+{
+  SMESHGUI_SelectionOp::selectionDone();
+  updateDialog();
+}
+
+//=================================================================================
+// name     : createFilter
+// purpose  :
+//=================================================================================
+SUIT_SelectionFilter* SMESHGUI_RenumberingOp::createFilter( const int id ) const
+{
+  if( id==0 )
+    return new SMESH_TypeFilter( MESH );
+  else
+    return 0;
+}
+
+//=================================================================================
+// name     : updateDialog
+// purpose  :
+//=================================================================================
+void SMESHGUI_RenumberingOp::updateDialog()
+{
+  if( !myDlg )
+    return;
+    
+  bool en = myDlg->hasSelection( 0 );
+  myDlg->setButtonEnabled( en, QtxDialog::OK | QtxDialog::Apply );
+}
+
+//=================================================================================
+// name     : onApply
+// purpose  :
+//=================================================================================
+bool SMESHGUI_RenumberingOp::onApply()
+{
+  if( getSMESHGUI()->isActiveStudyLocked() )
+    return false;
+
+  if( myDlg->hasSelection( 0 ) )
+  {
+    QStringList ids; myDlg->selectedObject( 0, ids );
+    _PTR(SObject) meshSO = studyDS()->FindObjectID( ids.first() );
+    
+    SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( _CAST(SObject,meshSO)->GetObject() );
+    if( aMesh->_is_nil() )
+      return false;
+
+    SUIT_OverrideCursor c;
+    try
+    {
+      SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+      SMESH_Actor* anActor = SMESH::FindActorByObject( aMesh );
+      bool isUnitsLabeled = false;
+
+      if( myMode == 0 && anActor )
+      {
+        isUnitsLabeled = anActor->GetPointsLabeled();
+        if( isUnitsLabeled )
+          anActor->SetPointsLabeled( false );
+      }
+      else if( myMode == 1 && anActor )
+      {
+        isUnitsLabeled = anActor->GetCellsLabeled();
+        if( isUnitsLabeled )
+          anActor->SetCellsLabeled( false );
+      }
+
+      if( myMode == 0 )
+      {
+        aMeshEditor->RenumberNodes();
+        if( isUnitsLabeled && anActor )
+          anActor->SetPointsLabeled( true );
+      }
+      else if( myMode == 1 )
+      {
+        aMeshEditor->RenumberElements();
+        if( isUnitsLabeled && anActor )
+          anActor->SetCellsLabeled(true);
+      }
+    }
+    catch(...)
+    {
+    }
+
+    initDialog();
+    updateDialog();
+    SMESH::UpdateView();
+    return true;
+  }
+  return false;
+}
+
diff --git a/src/SMESHGUI/SMESHGUI_RenumberingOp.h b/src/SMESHGUI/SMESHGUI_RenumberingOp.h
new file mode 100644 (file)
index 0000000..3e6c5ba
--- /dev/null
@@ -0,0 +1,65 @@
+//  SMESH SMESHGUI : GUI for SMESH component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  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 
+//
+//
+//
+//  File   : SMESHGUI_RenumberingOp.h
+//  Author : Alexander SOLOVYOV
+//  Module : SMESH
+//  $Header:
+
+#ifndef OPERATION_RENUMBERING_H
+#define OPERATION_RENUMBERING_H
+
+#include <SMESHGUI_SelectionOp.h>
+
+class SMESHGUI_RenumberingDlg;
+
+//=================================================================================
+// class    : SMESHGUI_RenumberingOp
+// purpose  : If the unit == 0 nodes will be renumbered, if the unit == 1 the elements will.
+//=================================================================================
+class SMESHGUI_RenumberingOp : public SMESHGUI_SelectionOp
+{ 
+  Q_OBJECT
+
+public:
+  SMESHGUI_RenumberingOp( const int );
+  ~SMESHGUI_RenumberingOp();
+
+  virtual SalomeApp_Dialog* dlg() const;
+
+protected:
+  virtual void startOperation();
+  virtual void selectionDone();
+  virtual SUIT_SelectionFilter* createFilter( const int ) const;
+
+  void updateDialog();
+
+protected slots:
+  virtual bool onApply();
+
+private:
+  int                       myMode;
+  SMESHGUI_RenumberingDlg*  myDlg;
+};
+
+#endif // DIALOGBOX_RENUMBERING_H