Salome HOME
Mantis issue 0020812: Register() and Destroy() of the GenericObj.
authorjfa <jfa@opencascade.com>
Tue, 22 Jun 2010 14:43:41 +0000 (14:43 +0000)
committerjfa <jfa@opencascade.com>
Tue, 22 Jun 2010 14:43:41 +0000 (14:43 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_ScaleDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index f83165f5f9e8cc584e8781a8dfc8d84be85c7616..fa34a188680d8c78ff0ac2400b2dad66dd4a1d07 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI.cxx
+//  Author : Nicolas REJNERI, Open CASCADE S.A.S.
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI.cxx
-// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-// SMESH includes
-//
+//  SMESH includes
 #include "SMESHGUI.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
 #include "SMESHGUI_AddQuadraticElementDlg.h"
 #include "SMESHGUI.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
 #include "SMESHGUI_AddQuadraticElementDlg.h"
 #include <Standard_ErrorHandler.hxx>
 #include <NCollection_DataMap.hxx>
 
 #include <Standard_ErrorHandler.hxx>
 #include <NCollection_DataMap.hxx>
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //namespace{
   // Declarations
   //=============================================================
 //namespace{
   // Declarations
   //=============================================================
             aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
             if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
               SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
             aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
             if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
               SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
+
+#ifdef WITHGENERICOBJ
+            // obj has been published in study. Its refcount has been incremented.
+            // It is safe to decrement its refcount
+            // so that it will be destroyed when the entry in study will be removed
+            aMeshes[i]->Destroy();
+#endif
           }
           else {
             isEmpty = true;
           }
           else {
             isEmpty = true;
@@ -1299,7 +1309,9 @@ LightApp_Module( "SMESH" )
 //=============================================================================
 SMESHGUI::~SMESHGUI()
 {
 //=============================================================================
 SMESHGUI::~SMESHGUI()
 {
+#ifdef WITHGENERICOBJ
   SMESH::GetFilterManager()->Destroy();
   SMESH::GetFilterManager()->Destroy();
+#endif
   SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
 }
 
   SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
 }
 
@@ -1665,7 +1677,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case 232:
     ::SetDisplayMode(theCommandID, myMarkerMap);
   break;
   case 232:
     ::SetDisplayMode(theCommandID, myMarkerMap);
   break;
-  
+
   // Display Entity
   case 216: // 0D elements
   case 217: // Edges
   // Display Entity
   case 216: // 0D elements
   case 217: // Edges
@@ -1772,7 +1784,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
       else
         aSel->setSelectedObjects( to_process );
       }
       else
         aSel->setSelectedObjects( to_process );
-      
+
       break;
     }
 
       break;
     }
 
@@ -3438,12 +3450,12 @@ void SMESHGUI::initialize( CAM_Application* app )
 
   //-------------------------------------------------
   // Representation of the 2D Quadratic elements
 
   //-------------------------------------------------
   // Representation of the 2D Quadratic elements
-  //-------------------------------------------------  
+  //-------------------------------------------------
   anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
   popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
   popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
   popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
   anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
   popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
   popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
   popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
-  
+
   popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
   popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
   popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
   popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
   popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
   popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
@@ -3485,7 +3497,7 @@ void SMESHGUI::initialize( CAM_Application* app )
     aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
 
   anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
     aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
 
   anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
-  
+
   popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
   popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
   popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
@@ -3566,7 +3578,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
   popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
 
   popupMgr()->insert( separator(), -1, -1 );
-  
+
   //-------------------------------------------------
   // Display / Erase
   //-------------------------------------------------
   //-------------------------------------------------
   // Display / Erase
   //-------------------------------------------------
@@ -3616,7 +3628,7 @@ bool SMESHGUI::reusableOperation( const int id )
 {
   // compute, evaluate and precompute are not reusable operations
   return ( id == 701 || id == 711 || id == 712 ) ? false : SalomeApp_Module::reusableOperation( id );
 {
   // compute, evaluate and precompute are not reusable operations
   return ( id == 701 || id == 711 || id == 712 ) ? false : SalomeApp_Module::reusableOperation( id );
-} 
+}
 
 bool SMESHGUI::activateModule( SUIT_Study* study )
 {
 
 bool SMESHGUI::activateModule( SUIT_Study* study )
 {
@@ -3789,8 +3801,8 @@ void SMESHGUI::createPreferences()
                               "SMESH", "max_angle" );
   setPreferenceProperty( maxAngle, "min", 1 );
   setPreferenceProperty( maxAngle, "max", 90 );
                               "SMESH", "max_angle" );
   setPreferenceProperty( maxAngle, "min", 1 );
   setPreferenceProperty( maxAngle, "max", 90 );
-  
-  
+
+
 
   int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
   setPreferenceProperty( exportgroup, "columns", 2 );
 
   int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
   setPreferenceProperty( exportgroup, "columns", 2 );
@@ -3821,15 +3833,15 @@ void SMESHGUI::createPreferences()
                              "SMESH", "nb_segments_per_edge" );
   setPreferenceProperty( nbSeg, "min", 1 );
   setPreferenceProperty( nbSeg, "max", 10000000 );
                              "SMESH", "nb_segments_per_edge" );
   setPreferenceProperty( nbSeg, "min", 1 );
   setPreferenceProperty( nbSeg, "max", 10000000 );
-  
+
   // Quantities with individual precision settings
   int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
   setPreferenceProperty( precGroup, "columns", 2 );
   // Quantities with individual precision settings
   int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
   setPreferenceProperty( precGroup, "columns", 2 );
-  
+
   const int nbQuantities = 6;
   int precs[nbQuantities], ii = 0;
   precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
   const int nbQuantities = 6;
   int precs[nbQuantities], ii = 0;
   precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "SMESH", "length_precision" );  
+                            LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
   precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
                             LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
   precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
   precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
                             LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
   precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
@@ -3839,14 +3851,14 @@ void SMESHGUI::createPreferences()
   precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
                             LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
   precs[ii  ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
   precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
                             LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
   precs[ii  ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
-                            LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );  
-  
+                            LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
+
   // Set property for precision value for spinboxes
   for ( ii = 0; ii < nbQuantities; ii++ ){
     setPreferenceProperty( precs[ii], "min", -14 );
     setPreferenceProperty( precs[ii], "max", 14 );
     setPreferenceProperty( precs[ii], "precision", 2 );
   // Set property for precision value for spinboxes
   for ( ii = 0; ii < nbQuantities; ii++ ){
     setPreferenceProperty( precs[ii], "min", -14 );
     setPreferenceProperty( precs[ii], "max", 14 );
     setPreferenceProperty( precs[ii], "precision", 2 );
-  }   
+  }
 
   // Mesh tab ------------------------------------------------------------------------
   int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
 
   // Mesh tab ------------------------------------------------------------------------
   int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
@@ -4845,7 +4857,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
 int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
 {
   int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
 int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
 {
   int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
-  
+
   setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
 
   QStringList fam;
   setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
 
   QStringList fam;
index bc6c1daf55051bd90eb7ce9f0319812ee78c14ce..4fceb54be677148e21eec882ef2f59ca69cccbf4 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_BuildCompoundDlg.cxx
+//  Author : Alexander KOVALEV, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_BuildCompoundDlg.cxx
-// Author : Alexander KOVALEV, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_BuildCompoundDlg.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_BuildCompoundDlg.h"
 
 #include "SMESHGUI.h"
 #define SPACING 6
 #define MARGIN  11
 
 #define SPACING 6
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //=================================================================================
 // name    : SMESHGUI_BuildCompoundDlg
 // Purpose :
 //=================================================================================
 // name    : SMESHGUI_BuildCompoundDlg
 // Purpose :
@@ -143,7 +146,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
   GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0);
   GroupArgsLayout->addWidget(SelectButton,    0, 1);
   GroupArgsLayout->addWidget(LineEditMeshes,  0, 2, 1, 2);
   GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0);
   GroupArgsLayout->addWidget(SelectButton,    0, 1);
   GroupArgsLayout->addWidget(LineEditMeshes,  0, 2, 1, 2);
-  GroupArgsLayout->addWidget(TextLabelUnion,  1, 0, 1, 3); 
+  GroupArgsLayout->addWidget(TextLabelUnion,  1, 0, 1, 3);
   GroupArgsLayout->addWidget(ComboBoxUnion,   1, 3);
   GroupArgsLayout->addWidget(CheckBoxCommon,  2, 0, 1, 4);
   GroupArgsLayout->addWidget(CheckBoxMerge,   3, 0, 1, 4);
   GroupArgsLayout->addWidget(ComboBoxUnion,   1, 3);
   GroupArgsLayout->addWidget(CheckBoxCommon,  2, 0, 1, 4);
   GroupArgsLayout->addWidget(CheckBoxMerge,   3, 0, 1, 4);
@@ -301,16 +304,16 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
       SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
       // concatenate meshes
       if(CheckBoxCommon->isChecked())
       SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
       // concatenate meshes
       if(CheckBoxCommon->isChecked())
-        aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray, 
-                                                         !(ComboBoxUnion->currentIndex()), 
-                                                         CheckBoxMerge->isChecked(), 
+        aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
+                                                         !(ComboBoxUnion->currentIndex()),
+                                                         CheckBoxMerge->isChecked(),
                                                          SpinBoxTol->GetValue());
       else
                                                          SpinBoxTol->GetValue());
       else
-        aCompoundMesh = aSMESHGen->Concatenate(myMeshArray, 
-                                               !(ComboBoxUnion->currentIndex()), 
-                                               CheckBoxMerge->isChecked(), 
+        aCompoundMesh = aSMESHGen->Concatenate(myMeshArray,
+                                               !(ComboBoxUnion->currentIndex()),
+                                               CheckBoxMerge->isChecked(),
                                                SpinBoxTol->GetValue());
                                                SpinBoxTol->GetValue());
-     
+
       aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
 
       SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
       aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
 
       SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
@@ -325,7 +328,7 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
     if ( SMESHGUI::automaticUpdate() ) {
       mySelectionMgr->clearSelected();
       SMESH::UpdateView();
     if ( SMESHGUI::automaticUpdate() ) {
       mySelectionMgr->clearSelected();
       SMESH::UpdateView();
-      
+
       _PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
       if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
         SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
       _PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
       if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
         SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
@@ -333,6 +336,14 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
 
     SMESHGUI::Modified();
 
 
     SMESHGUI::Modified();
 
+#ifdef WITHGENERICOBJ
+    // obj has been published in study. Its refcount has been incremented.
+    // It is safe to decrement its refcount
+    // so that it will be destroyed when the entry in study will be removed
+    if (!CORBA::is_nil(aCompoundMesh))
+      aCompoundMesh->Destroy();
+#endif
+
     return true;
   }
   return false;
     return true;
   }
   return false;
@@ -368,7 +379,7 @@ void SMESHGUI_BuildCompoundDlg::ClickOnCancel()
 void SMESHGUI_BuildCompoundDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_BuildCompoundDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
@@ -503,7 +514,6 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
 {
 //=================================================================================
 void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
 {
-  
   TextLabelTol->setEnabled(toMerge);
   SpinBoxTol->setEnabled(toMerge);
   if(!toMerge)
   TextLabelTol->setEnabled(toMerge);
   SpinBoxTol->setEnabled(toMerge);
   if(!toMerge)
index b6e28773aa4823ef67a79ee9cc9e6ff5260fee95..a964d8cfc8865f9313ed560aac86199f353a00e6 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_Hypotheses.cxx
+//  Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_Hypotheses.cxx
-// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_Hypotheses.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_Hypotheses.h"
 
 #include "SMESHGUI.h"
 #define SPACING 6
 #define MARGIN  11
 
 #define SPACING 6
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
   : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
 {
 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
   : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
 {
@@ -86,14 +89,22 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
   myIsCreate = true;
 
   // Create hypothesis/algorithm
   myIsCreate = true;
 
   // Create hypothesis/algorithm
-  if (isAlgo)
-    SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
-
-  else
-  {
-    SMESH::SMESH_Hypothesis_var aHypothesis = 
+  if (isAlgo) {
+    SMESH::SMESH_Hypothesis_var anAlgo =
+      SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
+#ifdef WITHGENERICOBJ
+    if (!CORBA::is_nil(anAlgo))
+      anAlgo->Destroy();
+#endif
+  }
+  else {
+    SMESH::SMESH_Hypothesis_var aHypothesis =
       SMESH::CreateHypothesis( hypType(), theHypName, false );
     editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
       SMESH::CreateHypothesis( hypType(), theHypName, false );
     editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
+#ifdef WITHGENERICOBJ
+    if (!CORBA::is_nil(aHypothesis))
+      aHypothesis->Destroy();
+#endif
   }
 }
 
   }
 }
 
@@ -111,13 +122,16 @@ void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHyp
   editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
 }
 
   editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
 }
 
-void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h, 
+void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
                                                         const QString& theHypName,
                                                         QWidget* theParent,
                                                         QObject* obj, const QString& slot )
 {
   myHypName = theHypName;
   myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
                                                         const QString& theHypName,
                                                         QWidget* theParent,
                                                         QObject* obj, const QString& slot )
 {
   myHypName = theHypName;
   myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
+#ifdef WITHGENERICOBJ
+  myHypo->Register();
+#endif
 
   SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
   connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
 
   SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
   connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
@@ -140,7 +154,7 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
   else
     emit finished( QDialog::Accepted );
 }
   else
     emit finished( QDialog::Accepted );
 }
-  
+
 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
 {
   if( CORBA::is_nil( hypothesis() ) )
 QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
 {
   if( CORBA::is_nil( hypothesis() ) )
@@ -169,7 +183,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
     GroupC1Layout->addWidget( lab, i, 0 );
 
     QWidget* w = getCustomWidget( *anIt, GroupC1, i );
     GroupC1Layout->addWidget( lab, i, 0 );
 
     QWidget* w = getCustomWidget( *anIt, GroupC1, i );
-    if ( !w ) 
+    if ( !w )
       switch( (*anIt).myValue.type() )
       {
       case QVariant::Int:
       switch( (*anIt).myValue.type() )
       {
       case QVariant::Int:
@@ -287,6 +301,9 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
       }
   }
   SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
       }
   }
   SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
+#ifdef WITHGENERICOBJ
+  myHypo->Destroy();
+#endif
   myHypo = SMESH::SMESH_Hypothesis::_nil();
   myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
 
   myHypo = SMESH::SMESH_Hypothesis::_nil();
   myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
 
@@ -316,26 +333,22 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
       item.myValue = sb->value();
       params.append( item );
     }
       item.myValue = sb->value();
       params.append( item );
     }
-    
     else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
     {
       SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
       item.myValue = sb->value();
       params.append( item );
     }
     else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
     {
       SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
       item.myValue = sb->value();
       params.append( item );
     }
-
     else if( (*anIt)->inherits( "QLineEdit" ) )
     {
       QLineEdit* line = ( QLineEdit* )( *anIt );
       item.myValue = line->text();
       params.append( item );
     }
     else if( (*anIt)->inherits( "QLineEdit" ) )
     {
       QLineEdit* line = ( QLineEdit* )( *anIt );
       item.myValue = line->text();
       params.append( item );
     }
-
     else if ( getParamFromCustomWidget( item, *anIt ))
     {
       params.append( item );
     }
     else if ( getParamFromCustomWidget( item, *anIt ))
     {
       params.append( item );
     }
-
     else
       res = false;
   }
     else
       res = false;
   }
@@ -351,7 +364,7 @@ QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
     if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
       QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
       aResult.append(sb->text());
     if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
       QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
       aResult.append(sb->text());
-    } 
+    }
   }
   return aResult;
 }
   }
   return aResult;
 }
@@ -440,7 +453,7 @@ SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCrea
 }
 
 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
 }
 
 QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
-{ 
+{
   return myDlg;
 }
 
   return myDlg;
 }
 
@@ -565,7 +578,7 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato
   QHBoxLayout* titLay = new QHBoxLayout( titFrame );
   titLay->setMargin( 0 );
   titLay->setSpacing( SPACING );
   QHBoxLayout* titLay = new QHBoxLayout( titFrame );
   titLay->setMargin( 0 );
   titLay->setSpacing( SPACING );
-  
+
   myIconLabel = new QLabel( titFrame );
   myIconLabel->setScaledContents( false );
   myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
   myIconLabel = new QLabel( titFrame );
   myIconLabel->setScaledContents( false );
   myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@@ -634,7 +647,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                  platform)).
                              arg(myHelpFileName));
   }
                                                                  platform)).
                              arg(myHelpFileName));
   }
@@ -642,7 +655,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
 
 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
 {
 
 void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
 {
-  myIconLabel->setPixmap( p );  
+  myIconLabel->setPixmap( p );
 }
 
 void SMESHGUI_HypothesisDlg::setType( const QString& t )
 }
 
 void SMESHGUI_HypothesisDlg::setType( const QString& t )
@@ -672,7 +685,7 @@ HypothesisData::HypothesisData( const QString& theTypeName,
     IconId( theIconId ),
     Dim( theDim ),
     IsAux( theIsAux ),
     IconId( theIconId ),
     Dim( theDim ),
     IsAux( theIsAux ),
-    NeededHypos( theNeededHypos ), 
+    NeededHypos( theNeededHypos ),
     OptionalHypos( theOptionalHypos ),
     InputTypes( theInputTypes ),
     OutputTypes( theOutputTypes ),
     OptionalHypos( theOptionalHypos ),
     InputTypes( theInputTypes ),
     OutputTypes( theOutputTypes ),
@@ -681,7 +694,7 @@ HypothesisData::HypothesisData( const QString& theTypeName,
 {
 }
 
 {
 }
 
-HypothesesSet::HypothesesSet( const QString& theSetName ) 
+HypothesesSet::HypothesesSet( const QString& theSetName )
   : myHypoSetName( theSetName ),
     myIsAlgo( false )
 {
   : myHypoSetName( theSetName ),
     myIsAlgo( false )
 {
@@ -690,8 +703,8 @@ HypothesesSet::HypothesesSet( const QString& theSetName )
 HypothesesSet::HypothesesSet( const QString&     theSetName,
                               const QStringList& theHypoList,
                               const QStringList& theAlgoList )
 HypothesesSet::HypothesesSet( const QString&     theSetName,
                               const QStringList& theHypoList,
                               const QStringList& theAlgoList )
-  : myHypoSetName( theSetName ), 
-    myHypoList( theHypoList ), 
+  : myHypoSetName( theSetName ),
+    myHypoList( theHypoList ),
     myAlgoList( theAlgoList ),
     myIsAlgo( false )
 {
     myAlgoList( theAlgoList ),
     myIsAlgo( false )
 {
@@ -747,4 +760,3 @@ QString HypothesesSet::current() const
 {
   return list()->at(myIndex);
 }
 {
   return list()->at(myIndex);
 }
-
index 4ceb159ee0d3ea39527e71b1c5002feb230bdcca..84107dc27e1734034a7e4ef3f121fb0af41d4169 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_MeshOp.cxx
+//  Author : Sergey LITONIN, Open CASCADE S.A.S.
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_MeshOp.cxx
-// Author : Sergey LITONIN, Open CASCADE S.A.S.
 // SMESH includes
 // SMESH includes
-//
 #include "SMESHGUI_MeshOp.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_MeshOp.h"
 
 #include "SMESHGUI.h"
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SMESH_Gen)
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SMESH_Gen)
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //================================================================================
 /*!
  * \brief Constructor
 //================================================================================
 /*!
  * \brief Constructor
@@ -280,7 +283,6 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
   * \retval bool - check result
  */
 //================================================================================
   * \retval bool - check result
  */
 //================================================================================
-
 bool SMESHGUI_MeshOp::isSubshapeOk() const
 {
   if ( !myToCreate || myIsMesh ) // not submesh creation
 bool SMESHGUI_MeshOp::isSubshapeOk() const
 {
   if ( !myToCreate || myIsMesh ) // not submesh creation
@@ -343,11 +345,10 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
 //================================================================================
 /*!
  * \brief Return name of the algorithm that does not support submeshes and makes
 //================================================================================
 /*!
  * \brief Return name of the algorithm that does not support submeshes and makes
- * submesh creation useless 
+ * submesh creation useless
  *  \retval char* - string is to be deleted!!!
  */
 //================================================================================
  *  \retval char* - string is to be deleted!!!
  */
 //================================================================================
-
 char* SMESHGUI_MeshOp::isSubmeshIgnored() const
 {
   if ( myToCreate && !myIsMesh ) {
 char* SMESHGUI_MeshOp::isSubmeshIgnored() const
 {
   if ( myToCreate && !myIsMesh ) {
@@ -393,7 +394,6 @@ char* SMESHGUI_MeshOp::isSubmeshIgnored() const
  * \retval _PTR(SObject) - the found submesh SObject
  */
 //================================================================================
  * \retval _PTR(SObject) - the found submesh SObject
  */
 //================================================================================
-
 _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
 {
   QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
 _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
 {
   QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
@@ -581,7 +581,7 @@ void SMESHGUI_MeshOp::selectionDone()
           bool editSubmesh = ( !sm->_is_nil() &&
                                SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
                                                           tr( "EDIT_SUBMESH_QUESTION"),
           bool editSubmesh = ( !sm->_is_nil() &&
                                SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
                                                           tr( "EDIT_SUBMESH_QUESTION"),
-                                                          SUIT_MessageBox::Yes | 
+                                                          SUIT_MessageBox::Yes |
                                                           SUIT_MessageBox::No,
                                                           SUIT_MessageBox::No )
                                == SUIT_MessageBox::Yes );
                                                           SUIT_MessageBox::No,
                                                           SUIT_MessageBox::No )
                                == SUIT_MessageBox::Yes );
@@ -743,7 +743,6 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
   * \retval bool - check result
  */
 //================================================================================
   * \retval bool - check result
  */
 //================================================================================
-
 static bool isCompatible(const HypothesisData* theAlgoData,
                          const HypothesisData* theHypData,
                          const int             theHypType)
 static bool isCompatible(const HypothesisData* theAlgoData,
                          const HypothesisData* theHypData,
                          const int             theHypType)
@@ -886,7 +885,6 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
   * \retval SMESH::SMESH_Hypothesis_var - the hypothesis holding parameter values
  */
 //================================================================================
   * \retval SMESH::SMESH_Hypothesis_var - the hypothesis holding parameter values
  */
 //================================================================================
-
 SMESH::SMESH_Hypothesis_var
 SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
                                           const QString& aServerLib ) const
 SMESH::SMESH_Hypothesis_var
 SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
                                           const QString& aServerLib ) const
@@ -972,7 +970,6 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
   * \retval int - dimention
  */
 //================================================================================
   * \retval int - dimention
  */
 //================================================================================
-
 static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
 {
   int aDim = -1;
 static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
 {
   int aDim = -1;
@@ -1030,7 +1027,6 @@ namespace
  *  \param theTypeName - specifies hypothesis to be created
  */
 //================================================================================
  *  \param theTypeName - specifies hypothesis to be created
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::createHypothesis(const int theDim,
                                         const int theType,
                                         const QString& theTypeName)
 void SMESHGUI_MeshOp::createHypothesis(const int theDim,
                                         const int theType,
                                         const QString& theTypeName)
@@ -1064,7 +1060,12 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
   QString aClientLibName = aData->ClientLibName;
   if (aClientLibName == "") {
     // Call hypothesis creation server method (without GUI)
   QString aClientLibName = aData->ClientLibName;
   if (aClientLibName == "") {
     // Call hypothesis creation server method (without GUI)
-    SMESH::CreateHypothesis(theTypeName, aHypName, false);
+    SMESH::SMESH_Hypothesis_var aHyp =
+      SMESH::CreateHypothesis(theTypeName, aHypName, false);
+#ifdef WITHGENERICOBJ
+    if (!CORBA::is_nil(aHyp))
+      aHyp->Destroy();
+#endif
   } else {
     // Get hypotheses creator client (GUI)
     // BUG 0020378
   } else {
     // Get hypotheses creator client (GUI)
     // BUG 0020378
@@ -1086,13 +1087,13 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
       aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
       aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
       anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
       aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
       aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
       anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
-      
+
       if ( aMeshEntry != "" ) { // Get Geom object from Mesh
         _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
         GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
         aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
       }
       if ( aMeshEntry != "" ) { // Get Geom object from Mesh
         _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
         GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
         aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
       }
-      
+
       if ( aMeshEntry == "" && aGeomEntry == "" ) {
         _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
         GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
       if ( aMeshEntry == "" && aGeomEntry == "" ) {
         _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
         GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
@@ -1117,7 +1118,7 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
           }
         }
       }
           }
         }
       }
-      
+
       aCreator->setShapeEntry( aGeomEntry );
       if ( aMeshEntry != "" )
         aCreator->setMainShapeEntry( aMeshEntry );
       aCreator->setShapeEntry( aGeomEntry );
       if ( aMeshEntry != "" )
         aCreator->setMainShapeEntry( aMeshEntry );
@@ -1125,8 +1126,14 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
       aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
       dialog = true;
     }
       aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
       dialog = true;
     }
-    else
-      SMESH::CreateHypothesis(theTypeName, aHypName, false);
+    else {
+     SMESH::SMESH_Hypothesis_var aHyp =
+       SMESH::CreateHypothesis(theTypeName, aHypName, false);
+#ifdef WITHGENERICOBJ
+     if (!CORBA::is_nil(aHyp))
+       aHyp->Destroy();
+#endif
+    }
   }
 
   if( !dialog )
   }
 
   if( !dialog )
@@ -1274,7 +1281,6 @@ void SMESHGUI_MeshOp::onHypoEdited( int result )
   * \retval HypothesisData* - result data, may be 0
  */
 //================================================================================
   * \retval HypothesisData* - result data, may be 0
  */
 //================================================================================
-
 HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
                                           const int theHypType,
                                           const int theIndex)
 HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
                                           const int theHypType,
                                           const int theIndex)
@@ -1292,7 +1298,6 @@ HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
   * \param theIndex - algorithm index
  */
 //================================================================================
   * \param theIndex - algorithm index
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
                                       const int theDim )
 {
 void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
                                       const int theDim )
 {
@@ -1588,7 +1593,13 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess )
       if ( !anAlgoVar->_is_nil() )
         SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
     }
       if ( !anAlgoVar->_is_nil() )
         SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
     }
-
+#ifdef WITHGENERICOBJ
+    // obj has been published in study. Its refcount has been incremented.
+    // It is safe to decrement its refcount
+    // so that it will be destroyed when the entry in study will be removed
+    if (aMeshSO)
+      aMeshVar->Destroy();
+#endif
   }
   return true;
 }
   }
   return true;
 }
@@ -1676,7 +1687,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
           QString aNewGeomGroupName ("Auto_group_for_");
           aNewGeomGroupName += aName;
           SALOMEDS::SObject_var aNewGroupSO =
           QString aNewGeomGroupName ("Auto_group_for_");
           aNewGeomGroupName += aName;
           SALOMEDS::SObject_var aNewGroupSO =
-            geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar, 
+            geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
                                 aNewGeomGroupName.toLatin1().data(), mainGeom);
         }
       }
                                 aNewGeomGroupName.toLatin1().data(), mainGeom);
         }
       }
@@ -1846,7 +1857,12 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
       if (aClientLibName == "")
       {
         // Call hypothesis creation server method (without GUI)
       if (aClientLibName == "")
       {
         // Call hypothesis creation server method (without GUI)
-        SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
+        SMESH::SMESH_Hypothesis_var aHyp =
+          SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
+#ifdef WITHGENERICOBJ
+        if (!CORBA::is_nil(aHyp))
+          aHyp->Destroy();
+#endif
       }
       else
       {
       }
       else
       {
@@ -1858,8 +1874,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
         // Create algorithm
         if (aCreator)
           aCreator->create(true, aHypName, myDlg, 0, QString::null );
         // Create algorithm
         if (aCreator)
           aCreator->create(true, aHypName, myDlg, 0, QString::null );
-        else
-          SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
+        else {
+          SMESH::SMESH_Hypothesis_var aHyp =
+            SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
+#ifdef WITHGENERICOBJ
+          if (!CORBA::is_nil(aHyp))
+            aHyp->Destroy();
+#endif
+        }
       }
       QStringList tmpList;
       _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
       }
       QStringList tmpList;
       _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
@@ -2160,14 +2182,14 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
 //================================================================================
 /*!
  * \brief Verifies whether given operator is valid for this one
 //================================================================================
 /*!
  * \brief Verifies whether given operator is valid for this one
 * \param theOtherOp - other operation
 * \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
-*
-* method redefined from base class verifies whether given operator is valid for
-* this one (i.e. can be started "above" this operator). In current implementation method
-* retuns false if theOtherOp operation is not intended for deleting objects or mesh
-* elements.
-*/
+ * \param theOtherOp - other operation
+ * \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
+ *
+ * method redefined from base class verifies whether given operator is valid for
+ * this one (i.e. can be started "above" this operator). In current implementation method
+ * retuns false if theOtherOp operation is not intended for deleting objects or mesh
+ * elements.
+ */
 //================================================================================
 bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
 {
 //================================================================================
 bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
 {
@@ -2177,10 +2199,9 @@ bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
 //================================================================================
 /*!
  * \brief SLOT. Is called when the user selects a way of geometry selection
 //================================================================================
 /*!
  * \brief SLOT. Is called when the user selects a way of geometry selection
 * \param theByMesh - true if the user wants to find geometry by mesh element
+ * \param theByMesh - true if the user wants to find geometry by mesh element
  */
 //================================================================================
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
 {
   if ( theByMesh ) {
 void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
 {
   if ( theByMesh ) {
@@ -2212,7 +2233,6 @@ void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
  * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
  */
 //================================================================================
  * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
 {
   if ( myShapeByMeshOp == op ) {
 void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
 {
   if ( myShapeByMeshOp == op ) {
@@ -2236,7 +2256,6 @@ void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
  * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
  */
 //================================================================================
  * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
 {
   if ( myShapeByMeshOp == op && myDlg ) {
 void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
 {
   if ( myShapeByMeshOp == op && myDlg ) {
@@ -2247,10 +2266,9 @@ void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
 //================================================================================
 /*!
  * \brief Selects a SObject
 //================================================================================
 /*!
  * \brief Selects a SObject
 * \param theSObj - the SObject to select
+ * \param theSObj - the SObject to select
  */
 //================================================================================
  */
 //================================================================================
-
 void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
 {
   if ( LightApp_SelectionMgr* sm = selectionMgr() ) {
 void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
 {
   if ( LightApp_SelectionMgr* sm = selectionMgr() ) {
index 1dc48b0b33adc99cc2d8c7ef33072c030ea36bc3..7e2f2af840827724eb549d49cd2b9eeef32436c4 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_RotationDlg.cxx
+//  Author : Michael ZORIN, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_RotationDlg.cxx
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_RotationDlg.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_RotationDlg.h"
 
 #include "SMESHGUI.h"
@@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
 #define SPACING 8
 #define MARGIN  11
 
 #define SPACING 8
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //=================================================================================
 // class    : SMESHGUI_RotationDlg()
 // purpose  :
 //=================================================================================
 // class    : SMESHGUI_RotationDlg()
 // purpose  :
@@ -430,22 +433,31 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
         else {
           if(CheckBoxMesh->isChecked())
             aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, true);
         else {
           if(CheckBoxMesh->isChecked())
             aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, true);
-          else 
+          else
             aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
         }
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
             aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
         }
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
-      case MAKE_MESH_BUTTON:
+      case MAKE_MESH_BUTTON: {
         SMESH::SMESH_Mesh_var mesh;
         SMESH::SMESH_Mesh_var mesh;
-        if(CheckBoxMesh->isChecked())
+        if (CheckBoxMesh->isChecked())
           mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
                                                    LineEditNewMesh->text().toLatin1().data());
           mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
                                                    LineEditNewMesh->text().toLatin1().data());
-        else 
+        else
           mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
                                              LineEditNewMesh->text().toLatin1().data());
           mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
                                              LineEditNewMesh->text().toLatin1().data());
-        if( !mesh->_is_nil())
-          mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+        if (!mesh->_is_nil()) {
+          mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+#ifdef WITHGENERICOBJ
+          // obj has been published in study. Its refcount has been incremented.
+          // It is safe to decrement its refcount
+          // so that it will be destroyed when the entry in study will be removed
+          mesh->Destroy();
+#endif
+        }
+        break;
+      }
       }
     } catch (...) {
     }
       }
     } catch (...) {
     }
@@ -500,7 +512,7 @@ void SMESHGUI_RotationDlg::ClickOnCancel()
 void SMESHGUI_RotationDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_RotationDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
@@ -542,9 +554,9 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
   if (aMesh) {
     if (send == LineEditElements) {
       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
   if (aMesh) {
     if (send == LineEditElements) {
       Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-      
+
       TColStd_MapOfInteger newIndices;
       TColStd_MapOfInteger newIndices;
-      
+
       QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
       for (int i = 0; i < aListId.count(); i++) {
         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
       QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
       for (int i = 0; i < aListId.count(); i++) {
         const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
@@ -556,7 +568,7 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
         aViewWindow->highlight( anIO, true, true );
       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
         aViewWindow->highlight( anIO, true, true );
-      
+
       myElementsId = theNewText;
     }
   }
       myElementsId = theNewText;
     }
   }
@@ -649,7 +661,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
       // get submesh
         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
       // get submesh
         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-        
+
         // get IDs from submesh
         SMESH::long_array_var anElementsIds = new SMESH::long_array;
         anElementsIds = aSubMesh->GetElementsId();
         // get IDs from submesh
         SMESH::long_array_var anElementsIds = new SMESH::long_array;
         anElementsIds = aSubMesh->GetElementsId();
@@ -715,7 +727,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
-    LineEditElements->setEnabled(true); 
+    LineEditElements->setEnabled(true);
     setNewMeshName();
   }
   myBusy = false;
     setNewMeshName();
   }
   myBusy = false;
index b9a5c1a0bb341770bd62a35b8691f8d31aa109c9..c83a35f0e52312578c4e500d0e6abae64f8d5a7e 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_ScaleDlg.cxx
+//  Author : Michael ZORIN, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_ScaleDlg.cxx
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_ScaleDlg.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_ScaleDlg.h"
 
 #include "SMESHGUI.h"
@@ -99,6 +98,10 @@ private:
 #define SPACING 6
 #define MARGIN  11
 
 #define SPACING 6
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //=================================================================================
 // class    : SMESHGUI_ScaleDlg()
 // purpose  :
 //=================================================================================
 // class    : SMESHGUI_ScaleDlg()
 // purpose  :
@@ -481,7 +484,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
         break;
       case COPY_ELEMS_BUTTON:
         if ( makeGroups ) {
         break;
       case COPY_ELEMS_BUTTON:
         if ( makeGroups ) {
-          SMESH::ListOfGroups_var groups; 
+          SMESH::ListOfGroups_var groups;
           if(CheckBoxMesh->isChecked()) {
             groups = aMeshEditor->ScaleMakeGroups(mySelectedObject, aPoint, aScaleFact);
           }
           if(CheckBoxMesh->isChecked()) {
             groups = aMeshEditor->ScaleMakeGroups(mySelectedObject, aPoint, aScaleFact);
           }
@@ -502,9 +505,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
-      case MAKE_MESH_BUTTON:
-        SMESH::SMESH_Mesh_var mesh; 
-        if(CheckBoxMesh->isChecked()) {
+      case MAKE_MESH_BUTTON: {
+        SMESH::SMESH_Mesh_var mesh;
+        if (CheckBoxMesh->isChecked()) {
           mesh = aMeshEditor->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups,
                                             LineEditNewMesh->text().toLatin1().data());
         }
           mesh = aMeshEditor->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups,
                                             LineEditNewMesh->text().toLatin1().data());
         }
@@ -513,12 +516,21 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
                                             aPoint, aScaleFact, makeGroups,
                                             LineEditNewMesh->text().toLatin1().data());
         }
                                             aPoint, aScaleFact, makeGroups,
                                             LineEditNewMesh->text().toLatin1().data());
         }
-        if( !mesh->_is_nil())
-          mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+        if (!mesh->_is_nil()) {
+          mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+#ifdef WITHGENERICOBJ
+          // obj has been published in study. Its refcount has been incremented.
+          // It is safe to decrement its refcount
+          // so that it will be destroyed when the entry in study will be removed
+          mesh->Destroy();
+#endif
+        }
+        break;
+      }
       }
     } catch (...) {
     }
       }
     } catch (...) {
     }
-    
+
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
@@ -530,7 +542,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
 
     SMESHGUI::Modified();
   }
 
     SMESHGUI::Modified();
   }
-  
+
   return true;
 }
 
   return true;
 }
 
@@ -570,7 +582,7 @@ void SMESHGUI_ScaleDlg::ClickOnCancel()
 void SMESHGUI_ScaleDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_ScaleDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
@@ -581,7 +593,7 @@ void SMESHGUI_ScaleDlg::ClickOnHelp()
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                  platform)).
                              arg(myHelpFileName));
   }
                                                                  platform)).
                              arg(myHelpFileName));
   }
@@ -611,7 +623,7 @@ void SMESHGUI_ScaleDlg::onTextChange (const QString& theNewText)
 
   if (aMesh) {
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
   if (aMesh) {
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-    
+
     TColStd_MapOfInteger newIndices;
 
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
     TColStd_MapOfInteger newIndices;
 
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
@@ -628,7 +640,7 @@ void SMESHGUI_ScaleDlg::onTextChange (const QString& theNewText)
     mySelector->AddOrRemoveIndex( anIO, newIndices, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->highlight( anIO, true, true );
     mySelector->AddOrRemoveIndex( anIO, newIndices, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->highlight( anIO, true, true );
-    
+
     myElementsId = theNewText;
   }
 
     myElementsId = theNewText;
   }
 
@@ -745,7 +757,7 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
       if (aNbUnits < 1)
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
       if (aNbUnits < 1)
-        return;  
+        return;
     }
 
     myNbOkElements = true;
     }
 
     myNbOkElements = true;
@@ -782,7 +794,7 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
-    LineEditElements->setEnabled(true); 
+    LineEditElements->setEnabled(true);
     setNewMeshName();
   }
 
     setNewMeshName();
   }
 
index 2a3562e3d53c581792532aabdfb9b87295bd60c3..13823588803fdf781480a8a532fe0c786495a370 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_SymmetryDlg.cxx
+//  Author : Michael ZORIN, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_SymmetryDlg.cxx
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_SymmetryDlg.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_SymmetryDlg.h"
 
 #include "SMESHGUI.h"
@@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
 #define SPACING 6
 #define MARGIN  11
 
 #define SPACING 6
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //=================================================================================
 // class    : SMESHGUI_SymmetryDlg()
 // purpose  :
 //=================================================================================
 // class    : SMESHGUI_SymmetryDlg()
 // purpose  :
@@ -500,7 +503,7 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
           aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, false );
         else
           aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
           aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, false );
         else
           aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
-        
+
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
         if( !myMesh->_is_nil())
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
@@ -525,20 +528,27 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
         }
       case MAKE_MESH_BUTTON: {
         SMESH::SMESH_Mesh_var mesh;
         }
       case MAKE_MESH_BUTTON: {
         SMESH::SMESH_Mesh_var mesh;
-        if(CheckBoxMesh->isChecked())
+        if (CheckBoxMesh->isChecked())
           mesh = aMeshEditor->MirrorObjectMakeMesh(mySelectedObject, aMirror, aMirrorType, makeGroups,
                                                    LineEditNewMesh->text().toLatin1().data());
         else
           mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
                                              LineEditNewMesh->text().toLatin1().data());
           mesh = aMeshEditor->MirrorObjectMakeMesh(mySelectedObject, aMirror, aMirrorType, makeGroups,
                                                    LineEditNewMesh->text().toLatin1().data());
         else
           mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
                                              LineEditNewMesh->text().toLatin1().data());
-        if( !mesh->_is_nil())
-          mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+        if (!mesh->_is_nil()) {
+          mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+#ifdef WITHGENERICOBJ
+          // obj has been published in study. Its refcount has been incremented.
+          // It is safe to decrement its refcount
+          // so that it will be destroyed when the entry in study will be removed
+          mesh->Destroy();
+#endif
+        }
         break;
       }
       }
     } catch (...) {
     }
         break;
       }
       }
     } catch (...) {
     }
-    
+
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
@@ -589,7 +599,7 @@ void SMESHGUI_SymmetryDlg::ClickOnCancel()
 void SMESHGUI_SymmetryDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_SymmetryDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
@@ -632,7 +642,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
     TColStd_MapOfInteger newIndices;
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
     TColStd_MapOfInteger newIndices;
-    
+
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
 
     if (send == LineEditElements) {
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
 
     if (send == LineEditElements) {
@@ -646,7 +656,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
         aViewWindow->highlight( anIO, true, true );
       mySelector->AddOrRemoveIndex( anIO, newIndices, false );
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
         aViewWindow->highlight( anIO, true, true );
-      
+
       myElementsId = theNewText;
     }
   }
       myElementsId = theNewText;
     }
   }
@@ -736,7 +746,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
             aNbUnits++;
           }
         }
             aNbUnits++;
           }
         }
-        
       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
         // get submesh
         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
       } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
         // get submesh
         SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
@@ -749,7 +758,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
           myElementsId += QString(" %1").arg(anElementsIds[i]);
         }
         aNbUnits = anElementsIds->length();
           myElementsId += QString(" %1").arg(anElementsIds[i]);
         }
         aNbUnits = anElementsIds->length();
-        
       } else { // GROUP
         // get smesh group
         SMESH::SMESH_GroupBase_var aGroup =
       } else { // GROUP
         // get smesh group
         SMESH::SMESH_GroupBase_var aGroup =
@@ -772,7 +780,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
       if (aNbUnits < 1)
         return;
     }
       if (aNbUnits < 1)
         return;
     }
-    
+
     myNbOkElements = true;
   } else {
     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
     myNbOkElements = true;
   } else {
     aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
@@ -807,7 +815,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
-    LineEditElements->setEnabled(true); 
+    LineEditElements->setEnabled(true);
     setNewMeshName();
   }
   myBusy = false;
     setNewMeshName();
   }
   myBusy = false;
index fac987991ed5c76aee77aa51431190f2d8a2e492..14a5866e07b927de5d5e2bdee0335ed91d71cf1e 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESHGUI : GUI for SMESH component
+//  File   : SMESHGUI_TranslationDlg.cxx
+//  Author : Michael ZORIN, Open CASCADE S.A.S.
+//  SMESH includes
 
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : SMESHGUI_TranslationDlg.cxx
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-// SMESH includes
-//
 #include "SMESHGUI_TranslationDlg.h"
 
 #include "SMESHGUI.h"
 #include "SMESHGUI_TranslationDlg.h"
 
 #include "SMESHGUI.h"
@@ -102,6 +101,10 @@ private:
 #define SPACING 6
 #define MARGIN  11
 
 #define SPACING 6
 #define MARGIN  11
 
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
+
 //=================================================================================
 // class    : SMESHGUI_TranslationDlg()
 // purpose  :
 //=================================================================================
 // class    : SMESHGUI_TranslationDlg()
 // purpose  :
@@ -494,7 +497,7 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
         break;
       case COPY_ELEMS_BUTTON:
         if ( makeGroups ) {
         break;
       case COPY_ELEMS_BUTTON:
         if ( makeGroups ) {
-          SMESH::ListOfGroups_var groups; 
+          SMESH::ListOfGroups_var groups;
           if(CheckBoxMesh->isChecked())
             groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
           else
           if(CheckBoxMesh->isChecked())
             groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
           else
@@ -510,19 +513,26 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
       case MAKE_MESH_BUTTON:
           myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
         break;
       case MAKE_MESH_BUTTON:
-        SMESH::SMESH_Mesh_var mesh; 
-        if(CheckBoxMesh->isChecked())
+        SMESH::SMESH_Mesh_var mesh;
+        if (CheckBoxMesh->isChecked())
           mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups,
                                                       LineEditNewMesh->text().toLatin1().data());
         else
           mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
                                                 LineEditNewMesh->text().toLatin1().data());
           mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups,
                                                       LineEditNewMesh->text().toLatin1().data());
         else
           mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
                                                 LineEditNewMesh->text().toLatin1().data());
-        if( !mesh->_is_nil())
-          mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+        if (!mesh->_is_nil()) {
+          mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+#ifdef WITHGENERICOBJ
+          // obj has been published in study. Its refcount has been incremented.
+          // It is safe to decrement its refcount
+          // so that it will be destroyed when the entry in study will be removed
+          mesh->Destroy();
+#endif
+        }
       }
     } catch (...) {
     }
       }
     } catch (...) {
     }
-    
+
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
     SMESH::UpdateView();
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
          actionButton == MAKE_MESH_BUTTON )
@@ -534,7 +544,7 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
 
     SMESHGUI::Modified();
   }
 
     SMESHGUI::Modified();
   }
-  
+
   return true;
 }
 
   return true;
 }
 
@@ -574,7 +584,7 @@ void SMESHGUI_TranslationDlg::ClickOnCancel()
 void SMESHGUI_TranslationDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
 void SMESHGUI_TranslationDlg::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
   else {
     QString platform;
@@ -585,7 +595,7 @@ void SMESHGUI_TranslationDlg::ClickOnHelp()
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
 #endif
     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
-                             arg(app->resourceMgr()->stringValue("ExternalBrowser", 
+                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                  platform)).
                              arg(myHelpFileName));
   }
                                                                  platform)).
                              arg(myHelpFileName));
   }
@@ -615,7 +625,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
 
   if (aMesh) {
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
 
   if (aMesh) {
     Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
-    
+
     TColStd_MapOfInteger newIndices;
 
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
     TColStd_MapOfInteger newIndices;
 
     QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
@@ -632,7 +642,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
     mySelector->AddOrRemoveIndex( anIO, newIndices, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->highlight( anIO, true, true );
     mySelector->AddOrRemoveIndex( anIO, newIndices, false );
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->highlight( anIO, true, true );
-    
+
     myElementsId = theNewText;
   }
 
     myElementsId = theNewText;
   }
 
@@ -750,7 +760,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
       if (aNbUnits < 1)
       aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
       myElementsId = aString;
       if (aNbUnits < 1)
-        return;  
+        return;
     }
 
     myNbOkElements = true;
     }
 
     myNbOkElements = true;
@@ -786,7 +796,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
     LineEditElements->setText(aString);
     LineEditElements->repaint();
     LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
-    LineEditElements->setEnabled(true); 
+    LineEditElements->setEnabled(true);
     setNewMeshName();
   }
 
     setNewMeshName();
   }
 
index d5161e29f5679ce077dde9b7509b2e6369c8746c..d1638dd86abdc1d4f1d00a67f2205ab2c871441a 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
-// File      : SMESH_Gen_i_1.cxx
-// Created   : Thu Oct 21 17:24:06 2004
-// Author    : Edward AGAPOV (eap)
-// Module    : SMESH
-// $Header: 
 //
 //
+//  File      : SMESH_Gen_i_1.cxx
+//  Created   : Thu Oct 21 17:24:06 2004
+//  Author    : Edward AGAPOV (eap)
+//  Module    : SMESH
+//  $Header   : $
+
 #include "SMESH_Gen_i.hxx"
 
 #include "SMESH_Mesh_i.hxx"
 #include "SMESH_Gen_i.hxx"
 
 #include "SMESH_Mesh_i.hxx"
index a21535af803ff4dca0c5b7f497956d8926985719..1c1d3fe0f95a5e10d25c864112375e07d4e98194 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Mesh_i.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Mesh_i.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
-//
+
 #include "SMESH_Mesh_i.hxx"
 
 #include "SMESH_Filter_i.hxx"
 #include "SMESH_Mesh_i.hxx"
 
 #include "SMESH_Filter_i.hxx"
@@ -90,7 +89,9 @@ using SMESH::TPythonDump;
 
 int SMESH_Mesh_i::myIdGenerator = 0;
 
 
 int SMESH_Mesh_i::myIdGenerator = 0;
 
-
+//To disable automatic genericobj management, the following line should be commented.
+//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
+#define WITHGENERICOBJ
 
 //=============================================================================
 /*!
 
 //=============================================================================
 /*!
@@ -119,17 +120,43 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
 SMESH_Mesh_i::~SMESH_Mesh_i()
 {
   INFOS("~SMESH_Mesh_i");
 SMESH_Mesh_i::~SMESH_Mesh_i()
 {
   INFOS("~SMESH_Mesh_i");
-  map<int, SMESH::SMESH_GroupBase_ptr>::iterator it;
-  for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
-    SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() );
-    if ( aGroup ) {
-      // this method is colled from destructor of group (PAL6331)
+
+  // destroy groups
+  map<int, SMESH::SMESH_GroupBase_ptr>::iterator itGr;
+  for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++) {
+    SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>(SMESH_Gen_i::GetServant(itGr->second).in());
+    if (aGroup) {
+      // this method is called from destructor of group (PAL6331)
       //_impl->RemoveGroup( aGroup->GetLocalID() );
       //_impl->RemoveGroup( aGroup->GetLocalID() );
-      
+#ifdef WITHGENERICOBJ
       aGroup->Destroy();
       aGroup->Destroy();
+#endif
     }
   }
   _mapGroups.clear();
     }
   }
   _mapGroups.clear();
+
+#ifdef WITHGENERICOBJ
+  // destroy submeshes
+  map<int, SMESH::SMESH_subMesh_ptr>::iterator itSM;
+  for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ ) {
+    SMESH_subMesh_i* aSubMesh = dynamic_cast<SMESH_subMesh_i*>(SMESH_Gen_i::GetServant(itSM->second).in());
+    if (aSubMesh) {
+      aSubMesh->Destroy();
+    }
+  }
+  _mapSubMeshIor.clear();
+
+  // destroy hypotheses
+  map<int, SMESH::SMESH_Hypothesis_ptr>::iterator itH;
+  for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ ) {
+    SMESH_Hypothesis_i* aHypo = dynamic_cast<SMESH_Hypothesis_i*>(SMESH_Gen_i::GetServant(itH->second).in());
+    if (aHypo) {
+      aHypo->Destroy();
+    }
+  }
+  _mapHypo.clear();
+#endif
+
   delete _impl;
 }
 
   delete _impl;
 }
 
@@ -474,6 +501,9 @@ SMESH_Hypothesis::Hypothesis_Status
     status = _impl->AddHypothesis(myLocSubShape, hypId);
     if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
       _mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
     status = _impl->AddHypothesis(myLocSubShape, hypId);
     if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
       _mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
+#ifdef WITHGENERICOBJ
+      _mapHypo[hypId]->Register();
+#endif
       // assure there is a corresponding submesh
       if ( !_impl->IsMainShape( myLocSubShape )) {
         int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
       // assure there is a corresponding submesh
       if ( !_impl->IsMainShape( myLocSubShape )) {
         int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
index 521633e5133d23799be9874fdaceafc0364e91c1..92cf410b56d046d5ff56475eb978780cb4eed105 100644 (file)
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Mesh_i.hxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_Mesh_i.hxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
-//
+
 #ifndef _SMESH_MESH_I_HXX_
 #define _SMESH_MESH_I_HXX_
 
 #ifndef _SMESH_MESH_I_HXX_
 #define _SMESH_MESH_I_HXX_
 
@@ -98,7 +97,7 @@ public:
 
   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
     throw (SALOME::SALOME_Exception);
 
   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
     throw (SALOME::SALOME_Exception);
-  
+
   SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType    theElemType,
                                                    const char*           theName,
                                                    GEOM::GEOM_Object_ptr theGeomObj )
   SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType    theElemType,
                                                    const char*           theName,
                                                    GEOM::GEOM_Object_ptr theGeomObj )
@@ -106,49 +105,49 @@ public:
 
   void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
     throw (SALOME::SALOME_Exception);
 
   void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
     throw (SALOME::SALOME_Exception);
-  
+
   void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
     throw (SALOME::SALOME_Exception);
   void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
     throw (SALOME::SALOME_Exception);
-  
+
   SMESH::ListOfGroups* GetGroups()
     throw (SALOME::SALOME_Exception);
 
   CORBA::Long NbGroups()
     throw (SALOME::SALOME_Exception);
 
   SMESH::ListOfGroups* GetGroups()
     throw (SALOME::SALOME_Exception);
 
   CORBA::Long NbGroups()
     throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
-                                      SMESH::SMESH_GroupBase_ptr theGroup2, 
+  SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
+                                      SMESH::SMESH_GroupBase_ptr theGroup2,
                                       const char* theName )
     throw (SALOME::SALOME_Exception);
 
                                       const char* theName )
     throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups, 
+  SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups,
                                             const char* theName)
     throw (SALOME::SALOME_Exception);
                                             const char* theName)
     throw (SALOME::SALOME_Exception);
-  
-  SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
-                                          SMESH::SMESH_GroupBase_ptr theGroup2, 
+
+  SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
+                                          SMESH::SMESH_GroupBase_ptr theGroup2,
                                           const char* theName )
     throw (SALOME::SALOME_Exception);
 
                                           const char* theName )
     throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups&  theGroups, 
+  SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups&  theGroups,
                                                 const char* theName )
     throw (SALOME::SALOME_Exception);
                                                 const char* theName )
     throw (SALOME::SALOME_Exception);
-  
-  SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
-                                    SMESH::SMESH_GroupBase_ptr theGroup2, 
+
+  SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
+                                    SMESH::SMESH_GroupBase_ptr theGroup2,
                                     const char* theName )
     throw (SALOME::SALOME_Exception);
 
                                     const char* theName )
     throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups, 
-                                          const SMESH::ListOfGroups& theToolGroups, 
+  SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
+                                          const SMESH::ListOfGroups& theToolGroups,
                                           const char* theName )
   throw (SALOME::SALOME_Exception);
 
                                           const char* theName )
   throw (SALOME::SALOME_Exception);
 
-  SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups, 
-                                         SMESH::ElementType theElemType, 
+  SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
+                                         SMESH::ElementType theElemType,
                                          const char* theName )
   throw (SALOME::SALOME_Exception);
                                          const char* theName )
   throw (SALOME::SALOME_Exception);
-  
+
 
   SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupOnGeom_ptr theGeomGroup );
 
 
   SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupOnGeom_ptr theGeomGroup );
 
@@ -303,16 +302,16 @@ public:
 
   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
     throw (SALOME::SALOME_Exception);
 
   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
     throw (SALOME::SALOME_Exception);
-  
+
   SMESH::long_array* GetNodesId()
     throw (SALOME::SALOME_Exception);
   SMESH::long_array* GetNodesId()
     throw (SALOME::SALOME_Exception);
-  
+
   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
     throw (SALOME::SALOME_Exception);
   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
     throw (SALOME::SALOME_Exception);
-  
+
   SMESH::EntityType GetElementGeomType( CORBA::Long id )
     throw (SALOME::SALOME_Exception);
   SMESH::EntityType GetElementGeomType( CORBA::Long id )
     throw (SALOME::SALOME_Exception);
-  
+
   /*!
    * Returns ID of elements for given submesh
    */
   /*!
    * Returns ID of elements for given submesh
    */
@@ -326,15 +325,15 @@ public:
    */
   SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
     throw (SALOME::SALOME_Exception);
    */
   SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
     throw (SALOME::SALOME_Exception);
-  
+
   /*!
    * Returns type of elements for given submesh
    */
   SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
     throw (SALOME::SALOME_Exception);
   /*!
    * Returns type of elements for given submesh
    */
   SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
     throw (SALOME::SALOME_Exception);
-  
+
   char* Dump();
   char* Dump();
-  
+
   // Internal methods not available through CORBA
   // They are called by corresponding interface methods
   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
   // Internal methods not available through CORBA
   // They are called by corresponding interface methods
   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
@@ -342,7 +341,7 @@ public:
 
   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
 
   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
-  
+
   static SMESH::Hypothesis_Status
   ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
 
   static SMESH::Hypothesis_Status
   ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
 
@@ -369,7 +368,7 @@ public:
 
   /*!
    * \brief Update hypotheses assigned to geom groups if the latter change
 
   /*!
    * \brief Update hypotheses assigned to geom groups if the latter change
-   * 
+   *
    * NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
    */
   void CheckGeomGroupModif();
    * NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
    */
   void CheckGeomGroupModif();
@@ -393,7 +392,7 @@ public:
    * If there is not node for given ID - returns empty list
    */
   SMESH::double_array* GetNodeXYZ(CORBA::Long id);
    * If there is not node for given ID - returns empty list
    */
   SMESH::double_array* GetNodeXYZ(CORBA::Long id);
-  
+
   /*!
    * For given node returns list of IDs of inverse elements
    * If there is not node for given ID - returns empty list
   /*!
    * For given node returns list of IDs of inverse elements
    * If there is not node for given ID - returns empty list
@@ -412,7 +411,7 @@ public:
   CORBA::Long GetShapeID(CORBA::Long id);
 
   /*!
   CORBA::Long GetShapeID(CORBA::Long id);
 
   /*!
-   * For given element returns ID of result shape after 
+   * For given element returns ID of result shape after
    * ::FindShape() from SMESH_MeshEditor
    * If there is not element for given ID - returns -1
    */
    * ::FindShape() from SMESH_MeshEditor
    * If there is not element for given ID - returns -1
    */
@@ -435,25 +434,25 @@ public:
    * If there is not node for given index - returns -2
    */
   CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
    * If there is not node for given index - returns -2
    */
   CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
-  
+
   /*!
    * Returns true if given node is medium node
    * in given quadratic element
    */
   CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
   /*!
    * Returns true if given node is medium node
    * in given quadratic element
    */
   CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
-  
+
   /*!
    * Returns true if given node is medium node
    * in one of quadratic elements
    */
   CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
                                        SMESH::ElementType theElemType);
   /*!
    * Returns true if given node is medium node
    * in one of quadratic elements
    */
   CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
                                        SMESH::ElementType theElemType);
-  
+
   /*!
    * Returns number of edges for given element
    */
   CORBA::Long ElemNbEdges(CORBA::Long id);
   /*!
    * Returns number of edges for given element
    */
   CORBA::Long ElemNbEdges(CORBA::Long id);
-  
+
   /*!
    * Returns number of faces for given element
    */
   /*!
    * Returns number of faces for given element
    */
@@ -472,12 +471,12 @@ public:
    * Returns true if given element is polygon
    */
   CORBA::Boolean IsPoly(CORBA::Long id);
    * Returns true if given element is polygon
    */
   CORBA::Boolean IsPoly(CORBA::Long id);
-  
+
   /*!
    * Returns true if given element is quadratic
    */
   CORBA::Boolean IsQuadratic(CORBA::Long id);
   /*!
    * Returns true if given element is quadratic
    */
   CORBA::Boolean IsQuadratic(CORBA::Long id);
-  
+
   /*!
    * Returns bary center for given element
    */
   /*!
    * Returns bary center for given element
    */
@@ -492,7 +491,7 @@ public:
    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
    */
   void SetParameters (const char* theParameters);
    * Sets list of notebook variables used for Mesh operations separated by ":" symbol
    */
   void SetParameters (const char* theParameters);
-  
+
   /*!
    * Returns list of notebook variables used for Mesh operations separated by ":" symbol
    */
   /*!
    * Returns list of notebook variables used for Mesh operations separated by ":" symbol
    */
@@ -516,7 +515,6 @@ public:
    */
   static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
                               SMESH::long_array&         theInfo);
    */
   static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
                               SMESH::long_array&         theInfo);
-                          
 
   /*!
    * \brief Return submesh objects list in meshing order
 
   /*!
    * \brief Return submesh objects list in meshing order
@@ -527,7 +525,7 @@ public:
    */
   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
 
    */
   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
 
-  
+
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
 
   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
 
@@ -581,8 +579,7 @@ private:
    * \brief Return new group contents if it has been changed and update group data
    */
   TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
    * \brief Return new group contents if it has been changed and update group data
    */
   TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
-  
+
 };
 
 #endif
 };
 
 #endif
-