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
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI.h"
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h"
@ -145,6 +144,10 @@
#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
//=============================================================
@ -241,6 +244,13 @@
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;
@ -1299,7 +1309,9 @@ LightApp_Module( "SMESH" )
//=============================================================================
SMESHGUI::~SMESHGUI()
{
#ifdef WITHGENERICOBJ
SMESH::GetFilterManager()->Destroy();
#endif
SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
}

View File

@ -19,12 +19,11 @@
//
// 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
//
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI.h"
@ -67,6 +66,10 @@
#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 :
@ -333,6 +336,14 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
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;
@ -503,7 +514,6 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e )
//=================================================================================
void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
{
TextLabelTol->setEnabled(toMerge);
SpinBoxTol->setEnabled(toMerge);
if(!toMerge)

View File

@ -19,12 +19,11 @@
//
// 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
//
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI.h"
@ -53,6 +52,10 @@
#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 )
{
@ -86,14 +89,22 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
myIsCreate = true;
// Create hypothesis/algorithm
if (isAlgo)
if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
else
{
#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 );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHypothesis))
aHypothesis->Destroy();
#endif
}
}
@ -118,6 +129,9 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
{
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 ) ) );
@ -287,6 +301,9 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
}
}
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
#ifdef WITHGENERICOBJ
myHypo->Destroy();
#endif
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 );
}
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 ( getParamFromCustomWidget( item, *anIt ))
{
params.append( item );
}
else
res = false;
}
@ -747,4 +760,3 @@ QString HypothesesSet::current() const
{
return list()->at(myIndex);
}

View File

@ -19,12 +19,11 @@
//
// 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 includes
//
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h"
@ -72,6 +71,10 @@
#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
@ -280,7 +283,6 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
* \retval bool - check result
*/
//================================================================================
bool SMESHGUI_MeshOp::isSubshapeOk() const
{
if ( !myToCreate || myIsMesh ) // not submesh creation
@ -347,7 +349,6 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
* \retval char* - string is to be deleted!!!
*/
//================================================================================
char* SMESHGUI_MeshOp::isSubmeshIgnored() const
{
if ( myToCreate && !myIsMesh ) {
@ -393,7 +394,6 @@ char* SMESHGUI_MeshOp::isSubmeshIgnored() const
* \retval _PTR(SObject) - the found submesh SObject
*/
//================================================================================
_PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
{
QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
@ -743,7 +743,6 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
* \retval bool - check result
*/
//================================================================================
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
*/
//================================================================================
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
*/
//================================================================================
static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
{
int aDim = -1;
@ -1030,7 +1027,6 @@ namespace
* \param theTypeName - specifies hypothesis to be created
*/
//================================================================================
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)
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
@ -1125,8 +1126,14 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
dialog = true;
}
else
else {
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
}
if( !dialog )
@ -1274,7 +1281,6 @@ void SMESHGUI_MeshOp::onHypoEdited( int result )
* \retval HypothesisData* - result data, may be 0
*/
//================================================================================
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
*/
//================================================================================
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 );
}
#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;
}
@ -1846,7 +1857,12 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
if (aClientLibName == "")
{
// Call hypothesis creation server method (without GUI)
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
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 );
else
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" );
@ -2162,12 +2184,12 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
* \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.
*/
*
* 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
{
@ -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
*/
//================================================================================
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
*/
//================================================================================
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
*/
//================================================================================
void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
{
if ( myShapeByMeshOp == op && myDlg ) {
@ -2250,7 +2269,6 @@ void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
* \param theSObj - the SObject to select
*/
//================================================================================
void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
{
if ( LightApp_SelectionMgr* sm = selectionMgr() ) {

View File

@ -19,12 +19,11 @@
//
// 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
//
#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
//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 :
@ -436,16 +439,25 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
case MAKE_MESH_BUTTON: {
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked())
if (CheckBoxMesh->isChecked())
mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data());
else
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 (...) {
}

View File

@ -16,12 +16,11 @@
//
// 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
//
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI.h"
@ -99,6 +98,10 @@ private:
#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 :
@ -502,9 +505,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
case MAKE_MESH_BUTTON: {
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked()) {
if (CheckBoxMesh->isChecked()) {
mesh = aMeshEditor->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data());
}
@ -513,8 +516,17 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
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 (...) {
}

View File

@ -19,12 +19,11 @@
//
// 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
//
#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
//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 :
@ -525,14 +528,21 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
}
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());
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;
}
}
@ -736,7 +746,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
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);
@ -749,7 +758,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
myElementsId += QString(" %1").arg(anElementsIds[i]);
}
aNbUnits = anElementsIds->length();
} else { // GROUP
// get smesh group
SMESH::SMESH_GroupBase_var aGroup =

View File

@ -19,12 +19,11 @@
//
// 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
//
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI.h"
@ -102,6 +101,10 @@ private:
#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 :
@ -511,14 +514,21 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked())
if (CheckBoxMesh->isChecked())
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 (...) {
}

View File

@ -19,14 +19,14 @@
//
// 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_Gen_i_1.cxx
// Created : Thu Oct 21 17:24:06 2004
// Author : Edward AGAPOV (eap)
// Module : SMESH
// $Header:
//
// $Header : $
#include "SMESH_Gen_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
//
// 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"
@ -90,7 +89,9 @@ using SMESH::TPythonDump;
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");
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();
#endif
}
}
_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;
}
@ -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 );
#ifdef WITHGENERICOBJ
_mapHypo[hypId]->Register();
#endif
// assure there is a corresponding submesh
if ( !_impl->IsMainShape( 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
//
// 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_
@ -517,7 +516,6 @@ public:
static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
SMESH::long_array& theInfo);
/*!
* \brief Return submesh objects list in meshing order
*/
@ -585,4 +583,3 @@ private:
};
#endif