Mantis issue 0020812: Register() and Destroy() of the GenericObj.

This commit is contained in:
jfa 2010-06-22 14:43:41 +00:00
parent 5faccfa115
commit 946f0a4e5c
11 changed files with 354 additions and 233 deletions

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI.cxx // File : SMESHGUI.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S. // Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_AddMeshElementDlg.h" #include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h" #include "SMESHGUI_AddQuadraticElementDlg.h"
@ -145,6 +144,10 @@
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#include <NCollection_DataMap.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{ //namespace{
// Declarations // Declarations
//============================================================= //=============================================================
@ -241,6 +244,13 @@
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" ); aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() ); 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 { else {
isEmpty = true; 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();
} }

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_BuildCompoundDlg.cxx // File : SMESHGUI_BuildCompoundDlg.cxx
// Author : Alexander KOVALEV, Open CASCADE S.A.S. // Author : Alexander KOVALEV, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_BuildCompoundDlg.h" #include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -67,6 +66,10 @@
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #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 // name : SMESHGUI_BuildCompoundDlg
// Purpose : // Purpose :
@ -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 true;
} }
return false; return false;
@ -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); TextLabelTol->setEnabled(toMerge);
SpinBoxTol->setEnabled(toMerge); SpinBoxTol->setEnabled(toMerge);
if(!toMerge) if(!toMerge)

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Hypotheses.cxx // File : SMESHGUI_Hypotheses.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -53,6 +52,10 @@
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #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 ) SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
: myHypType( theHypType ), myIsCreate( false ), myDlg( 0 ) : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
{ {
@ -86,14 +89,22 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
myIsCreate = true; myIsCreate = true;
// Create hypothesis/algorithm // Create hypothesis/algorithm
if (isAlgo) if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo ); SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
#ifdef WITHGENERICOBJ
else if (!CORBA::is_nil(anAlgo))
{ anAlgo->Destroy();
#endif
}
else {
SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::SMESH_Hypothesis_var aHypothesis =
SMESH::CreateHypothesis( hypType(), theHypName, false ); SMESH::CreateHypothesis( hypType(), theHypName, false );
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot ); editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHypothesis))
aHypothesis->Destroy();
#endif
} }
} }
@ -118,6 +129,9 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
{ {
myHypName = theHypName; myHypName = theHypName;
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h ); myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
#ifdef WITHGENERICOBJ
myHypo->Register();
#endif
SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent ); SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) ); connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( 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(); myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil(); myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
@ -316,26 +333,22 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
item.myValue = sb->value(); item.myValue = sb->value();
params.append( item ); params.append( item );
} }
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
{ {
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
item.myValue = sb->value(); item.myValue = sb->value();
params.append( item ); params.append( item );
} }
else if( (*anIt)->inherits( "QLineEdit" ) ) else if( (*anIt)->inherits( "QLineEdit" ) )
{ {
QLineEdit* line = ( QLineEdit* )( *anIt ); QLineEdit* line = ( QLineEdit* )( *anIt );
item.myValue = line->text(); item.myValue = line->text();
params.append( item ); params.append( item );
} }
else if ( getParamFromCustomWidget( item, *anIt )) else if ( getParamFromCustomWidget( item, *anIt ))
{ {
params.append( item ); params.append( item );
} }
else else
res = false; res = false;
} }
@ -747,4 +760,3 @@ QString HypothesesSet::current() const
{ {
return list()->at(myIndex); return list()->at(myIndex);
} }

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_MeshOp.cxx // File : SMESHGUI_MeshOp.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. // Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_MeshOp.h" #include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -72,6 +71,10 @@
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Gen) #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 bool SMESHGUI_MeshOp::isSubshapeOk() const
{ {
if ( !myToCreate || myIsMesh ) // not submesh creation if ( !myToCreate || myIsMesh ) // not submesh creation
@ -347,7 +349,6 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
* \retval char* - string is to be deleted!!! * \retval char* - string is to be deleted!!!
*/ */
//================================================================================ //================================================================================
char* SMESHGUI_MeshOp::isSubmeshIgnored() const char* SMESHGUI_MeshOp::isSubmeshIgnored() const
{ {
if ( myToCreate && !myIsMesh ) { 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 _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
{ {
QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
@ -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, static bool isCompatible(const HypothesisData* theAlgoData,
const HypothesisData* theHypData, const HypothesisData* theHypData,
const int theHypType) 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 SMESH::SMESH_Hypothesis_var
SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib ) const 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 ) static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
{ {
int aDim = -1; 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, void SMESHGUI_MeshOp::createHypothesis(const int theDim,
const int theType, const int theType,
const QString& theTypeName) const QString& theTypeName)
@ -1064,7 +1060,12 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
QString aClientLibName = aData->ClientLibName; QString aClientLibName = aData->ClientLibName;
if (aClientLibName == "") { if (aClientLibName == "") {
// Call hypothesis creation server method (without GUI) // Call hypothesis creation server method (without GUI)
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false); SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
} else { } else {
// Get hypotheses creator client (GUI) // Get hypotheses creator client (GUI)
// BUG 0020378 // BUG 0020378
@ -1125,8 +1126,14 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) ); aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
dialog = true; dialog = true;
} }
else else {
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false); 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, HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
const int theHypType, const int theHypType,
const int theIndex) 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, void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
const int theDim ) const int theDim )
{ {
@ -1588,7 +1593,13 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess )
if ( !anAlgoVar->_is_nil() ) if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar ); 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;
} }
@ -1846,7 +1857,12 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
if (aClientLibName == "") if (aClientLibName == "")
{ {
// Call hypothesis creation server method (without GUI) // Call hypothesis creation server method (without GUI)
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypData->Label, true); 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 // Create algorithm
if (aCreator) if (aCreator)
aCreator->create(true, aHypName, myDlg, 0, QString::null ); aCreator->create(true, aHypName, myDlg, 0, QString::null );
else else {
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypData->Label, true); SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
} }
QStringList tmpList; QStringList tmpList;
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" ); _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
@ -2180,7 +2202,6 @@ bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
* \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 ) void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
{ {
if ( 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) void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
{ {
if ( myShapeByMeshOp == 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) void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
{ {
if ( myShapeByMeshOp == op && myDlg ) { if ( myShapeByMeshOp == op && myDlg ) {
@ -2250,7 +2269,6 @@ void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
* \param theSObj - the SObject to select * \param theSObj - the SObject to select
*/ */
//================================================================================ //================================================================================
void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
{ {
if ( LightApp_SelectionMgr* sm = selectionMgr() ) { if ( LightApp_SelectionMgr* sm = selectionMgr() ) {

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_RotationDlg.cxx // File : SMESHGUI_RotationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S. // Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_RotationDlg.h" #include "SMESHGUI_RotationDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 8 #define SPACING 8
#define MARGIN 11 #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() // class : SMESHGUI_RotationDlg()
// purpose : // purpose :
@ -436,7 +439,7 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
if( !myMesh->_is_nil()) if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break; 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, mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
@ -444,8 +447,17 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
else else
mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups, mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil()) if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData()); 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 (...) {
} }

View File

@ -16,12 +16,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_ScaleDlg.cxx // File : SMESHGUI_ScaleDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S. // Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_ScaleDlg.h" #include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -99,6 +98,10 @@ private:
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #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() // class : SMESHGUI_ScaleDlg()
// purpose : // purpose :
@ -502,7 +505,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
if( !myMesh->_is_nil()) if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break; 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->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups, mesh = aMeshEditor->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups,
@ -513,8 +516,17 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
aPoint, aScaleFact, makeGroups, aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
} }
if( !mesh->_is_nil()) if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData()); 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 (...) {
} }

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_SymmetryDlg.cxx // File : SMESHGUI_SymmetryDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S. // Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_SymmetryDlg.h" #include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #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() // class : SMESHGUI_SymmetryDlg()
// purpose : // purpose :
@ -531,8 +534,15 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
else else
mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups, mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil()) if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData()); 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; break;
} }
} }
@ -736,7 +746,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
aNbUnits++; aNbUnits++;
} }
} }
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
// get submesh // get submesh
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO); 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]); myElementsId += QString(" %1").arg(anElementsIds[i]);
} }
aNbUnits = anElementsIds->length(); aNbUnits = anElementsIds->length();
} else { // GROUP } else { // GROUP
// get smesh group // get smesh group
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase_var aGroup =

View File

@ -19,12 +19,11 @@
// //
// 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 // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_TranslationDlg.cxx // File : SMESHGUI_TranslationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S. // Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_TranslationDlg.h" #include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -102,6 +101,10 @@ private:
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #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() // class : SMESHGUI_TranslationDlg()
// purpose : // purpose :
@ -517,8 +520,15 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
else else
mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups, mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil()) if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData()); 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 (...) {
} }

View File

@ -19,14 +19,14 @@
// //
// 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 // File : SMESH_Gen_i_1.cxx
// Created : Thu Oct 21 17:24:06 2004 // Created : Thu Oct 21 17:24:06 2004
// Author : Edward AGAPOV (eap) // Author : Edward AGAPOV (eap)
// Module : SMESH // Module : SMESH
// $Header: // $Header : $
//
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"

View File

@ -19,12 +19,11 @@
// //
// 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_Mesh_i.cxx // File : SMESH_Mesh_i.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
//
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
#include "SMESH_Filter_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() SMESH_Mesh_i::~SMESH_Mesh_i()
{ {
INFOS("~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)
//_impl->RemoveGroup( aGroup->GetLocalID() );
// 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() );
#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); status = _impl->AddHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) { if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
_mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp ); _mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
#ifdef WITHGENERICOBJ
_mapHypo[hypId]->Register();
#endif
// assure there is a corresponding submesh // assure there is a corresponding submesh
if ( !_impl->IsMainShape( myLocSubShape )) { if ( !_impl->IsMainShape( myLocSubShape )) {
int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape ); int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );

View File

@ -19,12 +19,11 @@
// //
// 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_Mesh_i.hxx // File : SMESH_Mesh_i.hxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
//
#ifndef _SMESH_MESH_I_HXX_ #ifndef _SMESH_MESH_I_HXX_
#define _SMESH_MESH_I_HXX_ #define _SMESH_MESH_I_HXX_
@ -517,7 +516,6 @@ public:
static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr, static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
SMESH::long_array& theInfo); SMESH::long_array& theInfo);
/*! /*!
* \brief Return submesh objects list in meshing order * \brief Return submesh objects list in meshing order
*/ */
@ -585,4 +583,3 @@ private:
}; };
#endif #endif