Salome HOME
Operation mechanism added. New operation for creation of mesh and hypothesis added...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index f9b07317f59439ac1b0809adeff9be98f81c6a5c..12c5743887e972f26ea3eda20660303d89f489c7 100644 (file)
@@ -25,6 +25,7 @@
 //  $Header$
 
 #include "SMESHGUI.h"
+
 #include "SMESHGUI_InitMeshDlg.h"
 #include "SMESHGUI_AddSubMeshDlg.h"
 #include "SMESHGUI_NodesDlg.h"
@@ -39,7 +40,6 @@
 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
 #include "SMESHGUI_Preferences_SelectionDlg.h"
 #include "SMESHGUI_Hypotheses.h"
-#include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_MoveNodesDlg.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
 #include "SMESHGUI_EditHypothesesDlg.h"
 #include "SMESHGUI_SymmetryDlg.h"
 #include "SMESHGUI_SewingDlg.h"
 #include "SMESHGUI_MergeNodesDlg.h"
+#include "SMESHGUI_EditMeshDlg.h"
 #include "SMESHGUI_MeshPatternDlg.h"
 #include "SMESHGUI_PrecisionDlg.h"
 #include "SMESHGUI_Selection.h"
 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
+#include "SMESHGUI_MeshOp.h"
 
-#include <SVTK_InteractorStyle.h>
-#include <SVTK_RenderWindowInteractor.h>
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_GroupUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_HypothesesUtils.h"
 
 #include "SMESH_Actor.h"
 #include "SMESH_Object.h"
 #include "SMESH_TypeFilter.hxx"
 
-#include "SUIT_Tools.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_OverrideCursor.h"
-#include "SUIT_Study.h"
-#include "SUIT_Session.h"
-
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIO.hxx"
-#include <SALOME_LifeCycleCORBA.hxx>
-
-#include "OB_Browser.h"
-
-#include "QtxPopupMgr.h"
-
 #include "SalomeApp_Tools.h"
 #include "SalomeApp_Study.h"
 #include "SalomeApp_NameDlg.h"
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Preferences.h"
 #include "SalomeApp_VTKSelector.h"
+#include "SalomeApp_Operation.h"
+#include "SalomeApp_UpdateFlags.h"
 
 #include "SalomeApp_ImportOperation.h"
 
 #include <SVTK_ViewWindow.h>
 #include <SVTK_ViewModel.h>
+#include <SVTK_InteractorStyle.h>
+#include <SVTK_RenderWindowInteractor.h>
 
 #include <VTKViewer_ViewManager.h>
 
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_GEOMGenUtils.h"
-#include "SMESHGUI_MeshUtils.h"
-#include "SMESHGUI_GroupUtils.h"
-#include "SMESHGUI_FilterUtils.h"
-#include "SMESHGUI_PatternUtils.h"
-#include "SMESHGUI_VTKUtils.h"
+#include "OB_Browser.h"
+
+#include "SUIT_Tools.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Study.h"
+#include "SUIT_Session.h"
+
+#include "QtxPopupMgr.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 // QT Includes
 #define         INCLUDE_MENUITEM_DEF
-#include <qapplication.h>
-#include <qlineedit.h>
-#include <qmenudata.h>
-#include <qmenubar.h>
 #include <qpopupmenu.h>
-#include <qfont.h>
 #include <qstring.h>
-#include <qpainter.h>
-#include <qcheckbox.h>
-#include <qcolordialog.h>
-#include <qspinbox.h>
-#include <qlist.h>
 #include <qwidget.h>
-#include <qevent.h>
 #include <qaction.h>
-#include <qradiobutton.h>
 
+// BOOST Includes
 #include <boost/shared_ptr.hpp>
 
+// VTK Includes
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkActorCollection.h>
@@ -665,7 +659,8 @@ namespace{
     return RefType;
   }
 
-  void OnEditDelete()
+
+  void SMESHGUI::OnEditDelete()
   {
     // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
     SalomeApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
@@ -713,6 +708,13 @@ namespace{
       if(IObject->hasEntry()){
        _PTR(SObject) SO = aStudy->FindObjectID(IObject->getEntry());
 
+       // disable removal of "SMESH" component object
+       if(SO->FindAttribute(anAttr, "AttributeIOR")){
+         anIOR = anAttr;
+         if ( !strcmp( (char*)anIOR->Value().c_str(), engineIOR().latin1() ) )
+           continue;
+       }
+
        /* Erase child graphical objects */
        _PTR(ChildIterator) it = aStudy->NewChildIterator(SO);
        for(it->InitEx(true); it->More(); it->Next()){
@@ -1058,12 +1060,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   SUIT_ViewWindow* view = application()->desktop()->activeWindow();
   SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
 
-  QAction* act = action( theCommandID );
+  //QAction* act = action( theCommandID );
 
   switch (theCommandID)        {
   case 33:                                     // DELETE
     if(checkLock(aStudy)) break;
-    ::OnEditDelete();
+    OnEditDelete();
     break;
 
   case 113:                                    // IMPORT
@@ -1145,7 +1147,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 302:                                    // DISPLAY ONLY
     {
       SMESH::EDisplaing anAction;
-      switch(theCommandID){
+      switch (theCommandID) {
       case 300:        anAction = SMESH::eErase; break;
       case 301:        anAction = SMESH::eDisplay; break;
       case 302:        anAction = SMESH::eDisplayOnly; break;
@@ -1153,15 +1155,17 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
       SALOME_ListIO selected;
-      if( aSel )
+      if (aSel)
         aSel->selectedObjects( selected );
 
-      if ( vtkwnd ) {
-       SALOME_ListIteratorOfListIO It(selected);
+      if (vtkwnd) {
+       SALOME_ListIteratorOfListIO It (selected);
        for (; It.More(); It.Next()) {
          Handle(SALOME_InteractiveObject) IOS = It.Value();
          if (IOS->hasEntry()) {
-           SMESH::UpdateView(anAction,IOS->getEntry());
+            SMESH::UpdateView(anAction, IOS->getEntry());
+            if (anAction == SMESH::eDisplayOnly)
+              anAction = SMESH::eDisplay;
          }
        }
       }
@@ -1302,6 +1306,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
              SMESH::FitAll();
            }
          }
+         SMESH::RepaintCurrentView();
        }
       }else{
        SUIT_MessageBox::warn1(desktop(),
@@ -1313,53 +1318,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       break;
     }
 
-  case 702:                                    // ADD SUB MESH
-    {
-      if(checkLock(aStudy)) break;
-      if( vtkwnd ) {
-       EmitSignalDeactivateDialog();
-       new SMESHGUI_AddSubMeshDlg( this );
-      }
-      else {
-       SUIT_MessageBox::warn1(desktop(),
-                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
-                             tr("SMESH_BUT_OK"));
-      }
-      break;
-    }
-
-  case 703:                                    // INIT MESH
-    {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_InitMeshDlg( this );
-      break;
-    }
-
-  case 704:                                    // EDIT Hypothesis 
-    {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_EditHypothesesDlg( this );
-      break;
-    }
-
-  case 705:                                    //  EDIT Global Hypothesis
-    {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_EditHypothesesDlg( this );
-      break;
-    }
-
-  case 706:                                    //  EDIT Local Hypothesis
-    {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_EditHypothesesDlg( this );
-      break;
-    }
-
+  case 702:  // Create mesh
+    startOperation( 702 );
+    break;
+  case 703:  // Create sub-mesh
+    startOperation( 703 );
+    break;
+  case 704: // Edit mesh/sub-mesh
+    startOperation( 704 );
+    break;
   case 407: // DIAGONAL INVERSION
   case 408: // Delete diagonal
     {
@@ -2006,23 +1973,23 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
       break;
     }
-    
-
-  case 5000: // HYPOTHESIS
-    {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, false );
-      break;
-    }
-  case 5010: // ALGO
+  case 4066: // MERGE EQUAL ELEMENTS
     {
-      if(checkLock(aStudy)) break;
-      EmitSignalDeactivateDialog();
-      new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, true);
+      if (checkLock(aStudy)) break;
+      if (vtkwnd) {
+       EmitSignalDeactivateDialog();
+       new SMESHGUI_EditMeshDlg(this,
+                                 "SMESH_MERGE_ELEMENTS_TITLE",
+                                 "ICON_DLG_MERGE_ELEMENTS",
+                                 1); // MergeEqualElemets
+      } else {
+       SUIT_MessageBox::warn1(desktop(),
+                             tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
+                             tr("SMESH_BUT_OK"));
+      }
       break;
     }
-
+    
   case 5105: // Library of selection filters
   {
     static QValueList<int> aTypes;
@@ -2241,14 +2208,10 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  126, "EXPORT_UNV" );
   createSMESHAction(   33, "DELETE",          "ICON_DELETE" );
   createSMESHAction( 5105, "SEL_FILTER_LIB" );
-  createSMESHAction( 5000, "CREATE_HYPO",     "ICON_HYPO" );
-  createSMESHAction( 5010, "CREATE_ALG",      "ICON_PATTERN_2d" );
   createSMESHAction(  701, "COMPUTE",         "ICON_COMPUTE" );
-  createSMESHAction(  702, "LOCAL_HYPO",      "ICON_DLG_ADD_SUBMESH" );
-  createSMESHAction(  703, "GLOBAL_HYPO",     "ICON_DLG_INIT_MESH" );
-  createSMESHAction(  704, "EDIT_HYPO",       "ICON_DLG_EDIT_MESH" );
-  createSMESHAction(  705, "EDIT_GLOBAL_HYPO","ICON_DLG_EDIT_MESH" );
-  createSMESHAction(  706, "EDIT_LOCAL_HYPO", "ICON_DLG_EDIT_MESH" );
+  createSMESHAction(  702, "CREATE_MESH",     "ICON_DLG_INIT_MESH" );
+  createSMESHAction(  703, "CREATE_SUBMESH",  "ICON_DLG_ADD_SUBMESH" );
+  createSMESHAction(  704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
   createSMESHAction(  801, "CREATE_GROUP",    "ICON_SMESH_TREE_GROUP" );
   createSMESHAction(  802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
   createSMESHAction(  803, "EDIT_GROUP",      "ICON_EDIT_GROUP" );
@@ -2289,6 +2252,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( 4063, "SYM",             "ICON_SMESH_SYMMETRY_PLANE" );
   createSMESHAction( 4064, "SEW",             "ICON_SMESH_SEWING_FREEBORDERS" );
   createSMESHAction( 4065, "MERGE",           "ICON_SMESH_MERGE_NODES" );
+  createSMESHAction( 4066, "MERGE_ELEMENTS",  "ICON_DLG_MERGE_ELEMENTS" );
   createSMESHAction(  406, "MOVE",            "ICON_DLG_MOVE_NODE" );
   createSMESHAction(  407, "INV",             "ICON_DLG_MESH_DIAGONAL" );
   createSMESHAction(  408, "UNION2",          "ICON_UNION2TRI" );
@@ -2313,6 +2277,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction(  220, "ALL" );
   createSMESHAction( 1100, "EDIT_HYPO" );
   createSMESHAction( 1101, "RENAME" );
+  createSMESHAction( 1102, "UNASSIGN" );
   createSMESHAction( 9010, "NUM_NODES", "", 0, true );
   createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
   createSMESHAction( 1131, "DISPMODE" );
@@ -2330,8 +2295,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   // ----- create menu --------------
   int fileId   = createMenu( tr( "MEN_FILE" ),   -1,  1 ),
       editId   = createMenu( tr( "MEN_EDIT" ),   -1,  3 ),
-      toolsId  = createMenu( tr( "MEN_TOOLS" ),  -1,  5, 10 ),
-      hypoId   = createMenu( tr( "MEN_HYPO" ),   -1, 50, 10 ),
+      toolsId  = createMenu( tr( "MEN_TOOLS" ),  -1,  5, 50 ),
       meshId   = createMenu( tr( "MEN_MESH" ),   -1, 70, 10 ),
       ctrlId   = createMenu( tr( "MEN_CTRL" ),   -1, 60, 10 ),
       modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
@@ -2360,11 +2324,8 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   createMenu( 5105, toolsId, -1 );
 
-  createMenu( 5000, hypoId, -1 );
-  createMenu( 5010, hypoId, -1 );
-
-  createMenu( 703, meshId, -1 );
   createMenu( 702, meshId, -1 );
+  createMenu( 703, meshId, -1 );
   createMenu( 704, meshId, -1 );
   createMenu( separator(), meshId, -1 );
   createMenu( 701, meshId, -1 );
@@ -2420,6 +2381,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createMenu( 4063, transfId, -1 );
   createMenu( 4064, transfId, -1 );
   createMenu( 4065, transfId, -1 );
+  createMenu( 4066, transfId, -1 );
 
   createMenu( 406, modifyId, -1 );
   createMenu( 407, modifyId, -1 );
@@ -2437,14 +2399,13 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   // ----- create toolbars --------------
   int meshTb     = createTool( tr( "TB_MESH" ) ),
-      hypoTb     = createTool( tr( "TB_HYPO" ) ),
       ctrlTb     = createTool( tr( "TB_CTRL" ) ),
       addRemTb   = createTool( tr( "TB_ADD_REMOVE" ) ),
       modifyTb   = createTool( tr( "TB_MODIFY" ) ),
       dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
 
-  createTool( 703, meshTb );
   createTool( 702, meshTb );
+  createTool( 703, meshTb );
   createTool( 704, meshTb );
   createTool( separator(), meshTb );
   createTool( 701, meshTb );
@@ -2457,9 +2418,6 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( 902, meshTb );
   createTool( separator(), meshTb );
 
-  createTool( 5000, hypoTb );
-  createTool( 5010, hypoTb );
-
   createTool( 6001, ctrlTb );
   createTool( 6003, ctrlTb );
   createTool( 6004, ctrlTb );
@@ -2497,6 +2455,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   createTool( 4063, addRemTb );
   createTool( 4064, addRemTb );
   createTool( 4065, addRemTb );
+  createTool( 4066, addRemTb );
   createTool( separator(), addRemTb );
 
   createTool( 406, modifyTb );
@@ -2534,8 +2493,8 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   // popup for object browser
 
-  createPopupItem( 705, OB, mesh, "&& isComputable");      // EDIT_GLOBAL_HYPO
-  createPopupItem( 706, OB, subMesh, "&& isComputable" );  // EDIT_LOCAL_HYPO
+  createPopupItem( 704, OB, mesh, "&& isComputable");      // EDIT_MESHSUBMESH
+  createPopupItem( 704, OB, subMesh, "&& isComputable" );  // EDIT_MESHSUBMESH
   createPopupItem( 803, OB, group );                       // EDIT_GROUP
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 701, OB, mesh, "&& isComputable" );     // COMPUTE
@@ -2546,9 +2505,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( 801, OB, mesh );                        // CREATE_GROUP
   createPopupItem( 802, OB, subMesh );                     // CONSTRUCT_GROUP
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( 1100, OB, hypo );                       // EDIT HYPOTHESIS
-  createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS
-  createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
+  createPopupItem( 1100, OB, hypo, "&& $hasReference={false}" );   // EDIT HYPOTHESIS
+  createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
+  createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "&& $hasReference={false}" ); // RENAME
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( 125, OB, mesh );                        // EXPORT_MED
   createPopupItem( 126, OB, mesh );                        // EXPORT_UNV
@@ -2579,11 +2538,10 @@ void SMESHGUI::initialize( CAM_Application* app )
     hasFaces("({'Face'} in elemTypes)"),
     hasVolumes("({'Volume'} in elemTypes)");
 
-  QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
   QString lc = QtxPopupMgr::Selection::defEquality();
   QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
   QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
-  QString aMeshInVTK = aClient + "&&" + aType;// + "&&" + aSelCount;
+  QString aMeshInVTK = aClient + "&&" + aType;
   
   //-------------------------------------------------
   // Numbering
@@ -2591,7 +2549,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
   
   popupMgr()->insert( action( 9010 ), anId, -1 );
-  popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, true );//@
+  popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, true );
   popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false );
 
   popupMgr()->insert( action( 9011 ), anId, -1 );
@@ -2750,6 +2708,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   //-------------------------------------------------
   aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
   QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type());
+  QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
   QString aRule = aClient + " and " + aType + " and " + aSelCount + " and " + anActiveVTK;
   popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
   popupMgr()->setRule( action( 301 ), aRule + "&&" + isNotEmpty + "&&" + isInvisible, true);
@@ -2995,3 +2954,90 @@ void SMESHGUI::createPreferences()
 void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
 {
 }
+
+//================================================================================
+/*!
+ * \brief Update something in accordance with update flags
+  * \param theFlags - update flags
+*
+* Update viewer or/and object browser etc. in accordance with update flags ( see
+* SalomeApp_UpdateFlags enumeration ). 
+*/
+//================================================================================
+void SMESHGUI::update( const int flags )
+{
+  if ( flags & UF_Viewer | flags & UF_Forced )
+    SMESH::UpdateView();
+  else
+    SalomeApp_Module::update( flags );
+}
+
+//================================================================================
+/*!
+ * \brief Set default selection mode
+*
+* SLOT called when operation commited. Sets default selection mode
+*/
+//================================================================================
+void SMESHGUI::onOperationCommited( SUIT_Operation* )
+{
+  SVTK_ViewWindow* vtkWnd =
+    dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
+  if ( vtkWnd )
+    vtkWnd->SetSelectionMode( ActorSelection );
+}
+
+//================================================================================
+/*!
+ * \brief Set default selection mode
+*
+* SLOT called when operation aborted. Sets default selection mode
+*/
+//================================================================================
+void SMESHGUI::onOperationAborted( SUIT_Operation* )
+{
+  SVTK_ViewWindow* vtkWnd =
+    dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
+  if ( vtkWnd )
+    vtkWnd->SetSelectionMode( ActorSelection );
+}
+
+//================================================================================
+/*!
+ * \brief Creates operation with given identifier
+  * \param id - identifier of operation to be started
+  * \return Pointer on created operation or NULL if operation is not created
+*
+* Virtual method redefined from the base class creates operation with given id. 
+* It is called called automatically from startOperation method of base class. 
+*/
+//================================================================================
+SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
+{
+  SalomeApp_Operation* op = 0;
+  // to do : create operation here
+  switch( id )
+  {
+    case 702: // Create mesh
+      op = new SMESHGUI_MeshOp( true, true );
+    break;
+    case 703: // Create sub-mesh
+      op = new SMESHGUI_MeshOp( true, false );
+    break;
+    case 704: // Edit mesh/sub-mesh
+      op = new SMESHGUI_MeshOp( false );
+    break;
+    default:
+    break;
+  }
+  
+  return op;
+}
+
+
+
+
+
+
+
+