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->UnRegister();
-#endif
return true;
}
// SALOME GEOM includes
#include <GeometryGUI.h>
+#include <GEOM_GenericObjPtr.h>
// SALOME KERNEL includes
#include <SALOMEDS_SObject.hxx>
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (!aStudy || geomGen->_is_nil())
return GEOM::GEOM_Object::_nil();
- GEOM::GEOM_IShapesOperations_var aShapesOp = geomGen->GetIShapesOperations(aStudy->StudyId());
+ GEOM::GEOM_IShapesOperations_wrap aShapesOp =
+ geomGen->GetIShapesOperations(aStudy->StudyId());
if (aShapesOp->_is_nil())
return GEOM::GEOM_Object::_nil();
- GEOM::GEOM_Object_var subShape = aShapesOp->GetSubShape (theMainShape,theID);
+ GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape (theMainShape,theID);
return subShape._retn();
}
} // end of namespace SMESH
// SALOME GEOM includes
#include <GEOMBase.h>
#include <GEOM_SelectionFilter.h>
+#include <GEOM_GenericObjPtr.h>
// SALOME GUI includes
#include <QtxColorButton.h>
return false;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
if (geomGen->_is_nil() || !aStudy)
return false;
- GEOM::GEOM_IGroupOperations_var op =
- geomGen->GetIGroupOperations(aStudy->StudyId());
+ GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
if (op->_is_nil())
return false;
}
}
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
- GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
+ GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
+ GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
op->UnionList(aGroupVar, myGeomObjects);
if (op->IsDone()) {
// Check if group constructed on the same shape as a mesh or on its child
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var anOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
// The main shape of the group
- GEOM::GEOM_Object_var aGroupMainShape;
- if (aGeomGroup->GetType() == 37)
+ GEOM::GEOM_Object_wrap aGroupMainShape;
+ if (aGeomGroup->GetType() == 37) {
+ GEOM::GEOM_IGroupOperations_wrap anOp =
+ SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
- else
- aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
+ // aGroupMainShape is a new geom servant to be deleted by GEOM_Object_wrap
+ }
+ else {
+ aGroupMainShape = aGeomGroup;
+ aGroupMainShape->Register();
+ }
_PTR(SObject) aGroupMainShapeSO =
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var aGroupOp =
+ GEOM::GEOM_IGroupOperations_wrap aGroupOp =
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
SMESH::ElementType aGroupType = SMESH::ALL;
#include <GeometryGUI.h>
#include <GEOM_SelectionFilter.h>
+#include <GEOM_GenericObjPtr.h>
#include <SUIT_Session.h>
#include <SUIT_OverrideCursor.h>
*/
//================================================================================
-static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
+static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
{
if ( !geom->_is_nil() ) {
switch ( geom->GetShapeType() ) {
default: return SMESH::ALL;
}
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IShapesOperations_var aShapeOp =
+ GEOM::GEOM_IShapesOperations_wrap aShapeOp =
SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
if ( geom->GetType() == 37 ) { // geom group
- GEOM::GEOM_IGroupOperations_var aGroupOp =
+ GEOM::GEOM_IGroupOperations_wrap aGroupOp =
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
if ( !aGroupOp->_is_nil() ) {
- GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
- GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
+ GEOM::GEOM_Object_wrap mainShape = aGroupOp->GetMainShape( geom );
+ GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
- GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( mainShape, ids[0] );
+ GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
return elementType( member );
}
}
else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
if ( ids->length() ) {
- GEOM::GEOM_Object_var member = aShapeOp->GetSubShape( geom, ids[0] );
+ GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
return elementType( member );
}
}
#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 )
+ : myToDeleteInitParamsHypo( false ),
+ myHypType( theHypType ),
+ myIsCreate( false ),
+ myDlg( 0 )
{
}
SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
{
+ if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
+ myInitParamsHypo->UnRegister();
}
void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
{
- if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
- myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
+ if ( !CORBA::is_nil( hyp ) ) {
+ if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
+ myInitParamsHypo->UnRegister();
+ CORBA::String_var hypName = hyp->GetName();
+ if ( hypType() == hypName.in() )
+ {
+ myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( hyp );
+ myToDeleteInitParamsHypo = !SMESH::FindSObject( myInitParamsHypo );
+ }
+ }
}
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
-#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(anAlgo))
anAlgo->UnRegister();
-#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->UnRegister();
-#endif
}
}
{
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::GetSMESHGUI()->updateObjBrowser( true, 0 );
-#ifdef WITHGENERICOBJ
myHypo->UnRegister();
-#endif
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
return res < SMESH::HYP_UNKNOWN_FATAL;
}
- bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
+ bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
SMESH::SMESH_Hypothesis_ptr anHyp)
{
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeIOR_var anIOR;
int res = SMESH::HYP_UNKNOWN_FATAL;
SUIT_OverrideCursor wc;
if (MorSM) {
try {
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
- SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-
+ SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
+
if (!aSubMesh->_is_nil())
aMesh = aSubMesh->GetFather();
-
+
if (!aMesh->_is_nil()) {
if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
#include <GEOM_SelectionFilter.h>
#include <GEOMBase.h>
#include <GeometryGUI.h>
+#include <GEOM_GenericObjPtr.h>
// SALOME GUI includes
#include <SalomeApp_Tools.h>
// SALOME KERNEL includes
#include <SALOMEDS_SComponent.hxx>
#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_wrap.hxx>
// Qt includes
#include <QStringList>
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (geomGen->_is_nil() || !aStudy) return false;
- GEOM::GEOM_IGroupOperations_var op =
- geomGen->GetIGroupOperations(aStudy->StudyId());
+ GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
if (op->_is_nil()) return false;
// check all selected shapes
if (aSubGeomVar->_is_nil()) return false;
// skl for NPAL14695 - implementation of searching of mainObj
- GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar);
- //if (mainObj->_is_nil() ||
- // string(mainObj->GetEntry()) != string(mainGeom->GetEntry())) return false;
+ GEOM::GEOM_Object_wrap mainObj = op->GetMainShape(aSubGeomVar);
while(1) {
if (mainObj->_is_nil())
return false;
- if (std::string(mainObj->GetEntry()) == std::string(mainGeom->GetEntry()))
+ CORBA::String_var entry1 = mainObj->GetEntry();
+ CORBA::String_var entry2 = mainGeom->GetEntry();
+ if (std::string( entry1.in() ) == entry2.in() )
return true;
mainObj = op->GetMainShape(mainObj);
}
}
- //return true;
}
return false;
SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
if ( !aHypVar->_is_nil() )
{
- HypothesisData* aData = SMESH::GetHypothesisData( aHypVar->GetName() );
+ CORBA::String_var hypType = aHypVar->GetName();
+ HypothesisData* aData = SMESH::GetHypothesisData( hypType.in() );
if ( !aData) continue;
if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) &&
( isCompatible ( theAlgoData, aData, theHypType )) &&
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (!geomGen->_is_nil() && aStudy) {
- GEOM::GEOM_IGroupOperations_var op =
+ GEOM::GEOM_IGroupOperations_wrap op =
geomGen->GetIGroupOperations(aStudy->StudyId());
if (!op->_is_nil()) {
// check and add all selected GEOM objects: they must be
aSeq[iSubSh] = aSubGeomVar;
}
// create a group
- GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(mainGeom, aGroupType);
+ GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
op->UnionList(aGroupVar, aSeq);
if (op->IsDone()) {
- aGeomVar = aGroupVar;
+ aGeomVar = aGroupVar.in();
// publish the GEOM group in study
QString aNewGeomGroupName ("Auto_group_for_");
aNewGeomGroupName += aName;
- SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
- aNewGeomGroupName.toLatin1().data(), mainGeom);
+ SALOMEDS::Study_var aStudyVar = _CAST(Study, aStudy)->GetStudy();
+ SALOMEDS::SObject_wrap aNewGroupSO =
+ geomGen->AddInStudy( aStudyVar, aGeomVar,
+ aNewGeomGroupName.toLatin1().data(), mainGeom);
}
}
}
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
if( !aMesh->_is_nil() )
{
- SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo();
+ SALOME_MED::MedFileInfo_var inf = aMesh->GetMEDFileInfo();
res = strlen( (char*)inf->fileName ) > 0;
}
}
// SALOME GEOM includes
#include <GEOMBase.h>
#include <GeometryGUI.h>
+#include <GEOM_GenericObjPtr.h>
// SALOME GUI includes
#include <LightApp_DataOwner.h>
// SALOME KERNEL includes
#include <SALOMEDSClient_SObject.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_wrap.hxx>
// OCCT includes
#include <TColStd_MapOfInteger.hxx>
//=======================================================================
// function : GetShape()
-// purpose : Get published sub-shape
+// purpose : Return published sub-shape, it must be UnRegister()ed!
//=======================================================================
GEOM::GEOM_Object_ptr SMESHGUI_ShapeByMeshOp::GetShape()
{
try {
QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts);
if (aListId.count() == 1)
+ {
+ int elemID = (aListId.first()).toInt();
+ // GEOM_Object is published -> no need to UnRegister()
+ myGeomObj = GEOM::GEOM_Object::_duplicate
+ (SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
+ ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
+ }
+ else
+ {
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
+ if (geomGen->_is_nil() || !aStudy)
+ return;
+
+ GEOM::GEOM_IShapesOperations_wrap aShapesOp =
+ geomGen->GetIShapesOperations(aStudy->StudyId());
+ if (aShapesOp->_is_nil() )
+ return;
+
+ TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
+
+ std::map<double, GEOM::GEOM_Object_wrap> aGeomObjectsMap;
+ GEOM::GEOM_Object_wrap aGeomObject;
+
+ GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
+
+ for ( int i = 0; i < aListId.count(); i++ )
{
- int elemID = (aListId.first()).toInt();
- myGeomObj = GEOM::GEOM_Object::_duplicate(
- SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
- ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
+ aGeomObject = // received object need UnRegister()!
+ SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
+
+ if (aGeomObject->_is_nil()) continue;
+
+ double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
+ if (aShapesOp->IsDone() && !aGeomObjectsMap.count(anId) )
+ {
+ aGeomObjectsMap[anId] = aGeomObject;
+
+ TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
+ if (i == 0)
+ aGroupType = aSubShapeType;
+ else if (aSubShapeType != aGroupType)
+ aGroupType = TopAbs_SHAPE;
+ }
}
- else
+
+ int aNumberOfGO = aGeomObjectsMap.size();
+ if (aNumberOfGO == 1)
{
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
-
- if (geomGen->_is_nil() || !aStudy)
- return;
-
- GEOM::GEOM_IShapesOperations_var aShapesOp =
- geomGen->GetIShapesOperations(aStudy->StudyId());
- if (aShapesOp->_is_nil() )
+ aGeomObject = (*aGeomObjectsMap.begin()).second;
+ }
+ else if (aNumberOfGO > 1)
+ {
+ GEOM::GEOM_IGroupOperations_wrap aGroupOp =
+ geomGen->GetIGroupOperations(aStudy->StudyId());
+ if(aGroupOp->_is_nil())
return;
-
- TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
-
- std::map<double, GEOM::GEOM_Object_var> aGeomObjectsMap;
- GEOM::GEOM_Object_var aGeomObject;
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
-
- for ( int i = 0; i < aListId.count(); i++ )
- {
- aGeomObject =
- SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
+ GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
+ aGeomObjects->length( aNumberOfGO );
- if (aGeomObject->_is_nil()) continue;
-
- double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
- if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
- {
- aGeomObjectsMap[anId] = aGeomObject;
+ int i = 0;
+ std::map<double, GEOM::GEOM_Object_wrap>::iterator anIter;
+ for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
+ aGeomObjects[i++] = (*anIter).second.in();
- TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
- if (i == 0)
- aGroupType = aSubShapeType;
- else if (aSubShapeType != aGroupType)
- aGroupType = TopAbs_SHAPE;
- }
- }
-
- int aNumberOfGO = aGeomObjectsMap.size();
- if (aNumberOfGO == 1)
- myGeomObj = (*aGeomObjectsMap.begin()).second;
- else if (aNumberOfGO > 1)
- {
- GEOM::GEOM_IGroupOperations_var aGroupOp =
- geomGen->GetIGroupOperations(aStudy->StudyId());
- if(aGroupOp->_is_nil())
- return;
-
- GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
- aGeomObjects->length( aNumberOfGO );
-
- int i = 0;
- std::map<double, GEOM::GEOM_Object_var>::iterator anIter;
- for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
- aGeomObjects[i++] = (*anIter).second;
-
- //create geometry group
- myGeomObj = aGroupOp->CreateGroup(aMeshShape, aGroupType);
- aGroupOp->UnionList(myGeomObj, aGeomObjects);
-
- if (!aGroupOp->IsDone())
- return;
- }
-
- // publish the GEOM object in study
- QString aNewGeomGroupName ( myDlg->myGeomName->text() );
-
- SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj,
- aNewGeomGroupName.toLatin1().data(), aMeshShape);
+ //create geometry group
+ aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
+ aGroupOp->UnionList(myGeomObj, aGeomObjects);
+
+ if (!aGroupOp->IsDone())
+ return;
}
+
+ // publish the GEOM object in study
+ QString aNewGeomGroupName ( myDlg->myGeomName->text() );
+ SALOMEDS::Study_var aStudyVar = _CAST(Study,aStudy)->GetStudy();
+ SALOMEDS::SObject_wrap aNewGroupSO =
+ geomGen->AddInStudy( aStudyVar, aGeomObject,
+ aNewGeomGroupName.toLatin1().data(), aMeshShape);
+
+ // get a GEOM_Object already published, which doesn't need UnRegister()
+ CORBA::Object_var obj = aNewGroupSO->GetObject();
+ myGeomObj = GEOM::GEOM_Object::_narrow( obj );
+ }
}
catch (const SALOME::SALOME_Exception& S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex);
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(theName.toLatin1().data());
+ aName->UnRegister();
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap(thePixmap.toLatin1().data());
+ aPixmap->UnRegister();
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
aSelAttr->SetSelectable(false);
+ aSelAttr->UnRegister();
}
return aDomainRoot;
//---------------------------------------------------------------
inline
SALOMEDS::SObject_var
- AddToDomain(const std::string& theIOR,
- const SALOMEDS::SComponent_var& theSComponentMesh,
+ AddToDomain(const std::string& theIOR,
+ const SALOMEDS::SComponent_var& theSComponentMesh,
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
- CORBA::Long theDomainRootTag,
- const QString& theDomainName,
- const QString& theDomainPixmap)
+ CORBA::Long theDomainRootTag,
+ const QString& theDomainName,
+ const QString& theDomainPixmap)
{
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
theStudyBuilder,
theDomainPixmap);
// Add New Hypothesis
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
+ aDomain->UnRegister();
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
CORBA::Object_var anObject = StringToObject(theIOR);
CORBA::String_var aType = aDomainItem->GetName();
QString aPixmapName = theDomainPixmap + "_" + aType.in();
aPixmap->SetPixMap(aPixmapName.toLatin1().data());
+ aPixmap->UnRegister();
anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
anIOR->SetValue(theIOR.c_str());
+ anIOR->UnRegister();
return aSObject;
}
//---------------------------------------------------------------
void
- SetDomain(const char* theMeshOrSubMeshEntry,
- const char* theDomainEntry,
- const SALOMEDS::Study_var& theStudy,
+ SetDomain(const char* theMeshOrSubMeshEntry,
+ const char* theDomainEntry,
+ const SALOMEDS::Study_var& theStudy,
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
- long theRefOnAppliedDomainTag,
- const QString& theAppliedDomainMEN,
- const QString& theAppliedDomainICON)
+ long theRefOnAppliedDomainTag,
+ const QString& theAppliedDomainMEN,
+ const QString& theAppliedDomainICON)
{
SALOMEDS::SObject_var aMeshOrSubMeshSO = theStudy->FindObjectID(theMeshOrSubMeshEntry);
- SALOMEDS::SObject_var aHypothesisSO = theStudy->FindObjectID(theDomainEntry);
+ SALOMEDS::SObject_var aHypothesisSO = theStudy->FindObjectID(theDomainEntry);
if(!aMeshOrSubMeshSO->_is_nil() && !aHypothesisSO->_is_nil()){
//Find or Create Applied Hypothesis root
SALOMEDS::SObject_var anAppliedDomainSO;
- if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){
+ if( !aMeshOrSubMeshSO->FindSubObject( theRefOnAppliedDomainTag, anAppliedDomainSO ))
+ {
anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
SALOMEDS::GenericAttribute_var anAttr =
theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(theAppliedDomainMEN.toLatin1().data());
+ aName->UnRegister();
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
aSelAttr->SetSelectable(false);
+ aSelAttr->UnRegister();
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
+ aPixmap->UnRegister();
}
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
theStudyBuilder->Addreference(aSObject,aHypothesisSO);
+ aSObject->UnRegister();
+ anAppliedDomainSO->UnRegister();
}
+ if ( !aMeshOrSubMeshSO->_is_nil() ) aMeshOrSubMeshSO->UnRegister();
+ if ( !aHypothesisSO->_is_nil()) aHypothesisSO->UnRegister();
}
//---------------------------------------------------------------
void
- SetHypothesis(const char* theMeshOrSubMeshEntry,
- const char* theDomainEntry,
- const SALOMEDS::Study_var& theStudy,
+ SetHypothesis(const char* theMeshOrSubMeshEntry,
+ const char* theDomainEntry,
+ const SALOMEDS::Study_var& theStudy,
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
{
SetDomain(theMeshOrSubMeshEntry,
//---------------------------------------------------------------
void
- SetAlgorithms(const char* theMeshOrSubMeshEntry,
- const char* theDomainEntry,
- const SALOMEDS::Study_var& theStudy,
+ SetAlgorithms(const char* theMeshOrSubMeshEntry,
+ const char* theDomainEntry,
+ const SALOMEDS::Study_var& theStudy,
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
{
SetDomain(theMeshOrSubMeshEntry,
{
class TEvent: public SALOME_Event
{
- int myStudyID;
- SALOMEDS::Study_var& myStudy;
+ int myStudyID;
+ SALOMEDS::Study_var& myStudy;
SALOMEDS::StudyBuilder_var& myStudyBuilder;
- SALOMEDS::SComponent_var& mySComponentMesh;
+ SALOMEDS::SComponent_var& mySComponentMesh;
public:
- TEvent(int theStudyID,
- SALOMEDS::Study_var& theStudy,
+ TEvent(int theStudyID,
+ SALOMEDS::Study_var& theStudy,
SALOMEDS::StudyBuilder_var& theStudyBuilder,
- SALOMEDS::SComponent_var& theSComponentMesh):
- myStudyID(theStudyID),
- myStudy(theStudy),
- myStudyBuilder(theStudyBuilder),
+ SALOMEDS::SComponent_var& theSComponentMesh):
+ myStudyID (theStudyID),
+ myStudy (theStudy),
+ myStudyBuilder (theStudyBuilder),
mySComponentMesh(theSComponentMesh)
{}
+ ~TEvent()
+ {
+ if ( !mySComponentMesh->_is_nil() ) mySComponentMesh->UnRegister();
+ }
+
virtual
void
Execute()
{
- SUIT_Session* aSession = SUIT_Session::session();
+ SUIT_Session* aSession = SUIT_Session::session();
SUIT_Application* anApplication = aSession->activeApplication();
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
SALOME_NamingService* aNamingService = anApp->namingService();
- CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
+ CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
myStudy = aStudyMgr->GetStudyByID(myStudyID);
SALOMEDS::AttributePixMap_var aPixmap;
SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
- if(aSComponent->_is_nil()){
+ if ( aSComponent->_is_nil() )
+ {
bool aLocked = myStudy->GetProperties()->IsLocked();
if (aLocked)
myStudy->GetProperties()->SetLocked(false);
-
- aSComponent = myStudyBuilder->NewComponent("SMESH");
- anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
- if (!aSMESHGUI){
+ SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
+ //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
+ if (!aSMESHGUI) {
CAM_Module* aModule = anApp->module("Mesh");
if(!aModule)
- aModule = anApp->loadModule("Mesh");
+ aModule = anApp->loadModule("Mesh");
aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
} //SRN: BugID IPAL9186: end of a fix
+
+ aSComponent = myStudyBuilder->NewComponent("SMESH");
+
+ anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(aSMESHGUI->moduleName().toLatin1().data());
+ aName->UnRegister();
+
anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
+ aPixmap->UnRegister();
+
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
if (aLocked)
myStudy->GetProperties()->SetLocked(true);
// VSR: added temporarily - to be removed - objects are published automatically by engine
SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
- if (aSObject->_is_nil()){
+ if (aSObject->_is_nil())
+ {
//Find or Create Hypothesis root
- GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
- GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
+ SALOMEDS::SObject_var hroot = GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
+ SALOMEDS::SObject_var aroot = GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
+ hroot->UnRegister();
+ aroot->UnRegister();
// Add New Mesh
aSObject = myStudyBuilder->NewObject(mySComponentMesh);
SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
+ aPixmap->UnRegister();
+
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
anIOR->SetValue(theIOR);
+ anIOR->UnRegister();
}
CORBA::String_var anEntry = aSObject->GetID();
+ aSObject->UnRegister();
return anEntry._retn();
}
mySComponentMesh,
myStudyBuilder);
CORBA::String_var anEntry = aSObject->GetID();
+ aSObject->UnRegister();
+
return anEntry._retn();
}
mySComponentMesh,
myStudyBuilder);
CORBA::String_var anEntry = aSObject->GetID();
+ aSObject->UnRegister();
+
return anEntry._retn();
}
void SMESH_Swig::SetShape(const char* theShapeEntry,
const char* theMeshEntry)
{
- SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
+ SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
+ aSObject->UnRegister();
}
+ if ( !aMeshSO->_is_nil() ) aMeshSO->UnRegister();
+ if ( !aGeomShapeSO->_is_nil() ) aGeomShapeSO->UnRegister();
}
int theShapeType)
{
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
- if(!aMeshSO->_is_nil()){
+ if(!aMeshSO->_is_nil()) {
long aShapeTag;
QString aSubMeshName;
- switch(theShapeType){
+ switch(theShapeType) {
case TopAbs_SOLID:
- aShapeTag = SMESH::Tag_SubMeshOnSolid;
+ aShapeTag = SMESH::Tag_SubMeshOnSolid;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
break;
case TopAbs_FACE:
- aShapeTag = SMESH::Tag_SubMeshOnFace;
+ aShapeTag = SMESH::Tag_SubMeshOnFace;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
break;
case TopAbs_EDGE:
- aShapeTag = SMESH::Tag_SubMeshOnEdge;
+ aShapeTag = SMESH::Tag_SubMeshOnEdge;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
break;
case TopAbs_VERTEX:
- aShapeTag = SMESH::Tag_SubMeshOnVertex;
+ aShapeTag = SMESH::Tag_SubMeshOnVertex;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
break;
default:
- aShapeTag = SMESH::Tag_SubMeshOnCompound;
+ aShapeTag = SMESH::Tag_SubMeshOnCompound;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
}
- SALOMEDS::SObject_var aSubMeshesRoot;
SALOMEDS::GenericAttribute_var anAttr;
- if(!aMeshSO->FindSubObject(aShapeTag,aSubMeshesRoot)){
+ SALOMEDS::SObject_var aSubMeshesRoot;
+ if ( !aMeshSO->FindSubObject( aShapeTag, aSubMeshesRoot ) )
+ {
aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(aSubMeshName.toLatin1().data());
+ aName->UnRegister();
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
aSelAttr->SetSelectable(false);
+ aSelAttr->UnRegister();
}
+ aSubMeshesRoot->UnRegister();
+ aMeshSO->UnRegister();
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
anIOR->SetValue(theSubMeshIOR);
+ anIOR->UnRegister();
CORBA::String_var aString = aSObject->GetID();
+ aSObject->UnRegister();
+
return aString._retn();
}
const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
const char* theGeomShapeEntry,
const char* theSubMeshIOR,
- int ShapeType)
+ int ShapeType)
{
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
- if(!aGeomShapeSO->_is_nil()){
- const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
+ if(!aGeomShapeSO->_is_nil())
+ {
+ const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
SALOMEDS::SObject_var aSubMeshSO = myStudy->FindObjectID(aSubMeshEntry);
- if(!aSubMeshSO->_is_nil()){
- SetShape(theGeomShapeEntry,aSubMeshEntry);
+ if ( !aSubMeshSO->_is_nil()) {
+ SetShape( theGeomShapeEntry, aSubMeshEntry );
CORBA::String_var aString = aSubMeshSO->GetID();
+ aSubMeshSO->UnRegister();
return aString._retn();
}
+ aGeomShapeSO->UnRegister();
}
return "";
}
virtual void Execute() {
//SMESH::UpdateView(SMESH::eDisplay, _entry);
- SUIT_Session* aSession = SUIT_Session::session();
+ SUIT_Session* aSession = SUIT_Session::session();
SUIT_Application* anApplication = aSession->activeApplication();
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
- /*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
- SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
+ /*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
+ SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
aDisp->Display(_entry,1);
}
};
{
private:
const char* _entry;
- bool _allViewers;
+ bool _allViewers;
public:
TEvent(const char* Mesh_Entry, const bool allViewers ) {
_entry = Mesh_Entry;
_allViewers = allViewers;
}
virtual void Execute() {
- SUIT_Session* aSession = SUIT_Session::session();
+ SUIT_Session* aSession = SUIT_Session::session();
SUIT_Application* anApplication = aSession->activeApplication();
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
- SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
+ SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
ViewManagerList aManagers;
if ( !_allViewers ) {
- aManagers << anApp->activeViewManager();
+ aManagers << anApp->activeViewManager();
}
else {
- aManagers = anApp->viewManagers();
+ aManagers = anApp->viewManagers();
}
foreach( SUIT_ViewManager* aMgr, aManagers ) {
- if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
- SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
- if (aSalomeView) {
- aDisp->Erase(_entry,true, true, aSalomeView);
- }
- }
+ if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
+ SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
+ if (aSalomeView) {
+ aDisp->Erase(_entry,true, true, aSalomeView);
+ }
+ }
}
}
};
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
aName = SALOMEDS::AttributeName::_narrow(anAttr);
aName->SetValue(theName);
+ aName->UnRegister();
+ aSObject->UnRegister();
}
}
//================================================================================
void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
- const bool theIsComputed,
- const bool isEmpty)
+ const bool theIsComputed,
+ const bool isEmpty)
{
class TEvent: public SALOME_Event
{
SALOMEDS::Study_var myStudy;
- std::string myMeshEntry;
- bool myIsComputed, myIsEmpty;
+ std::string myMeshEntry;
+ bool myIsComputed, myIsEmpty;
public:
TEvent(const SALOMEDS::Study_var& theStudy,
- const std::string& theMeshEntry,
- const bool theIsComputed,
- const bool isEmpty):
- myStudy(theStudy),
- myMeshEntry(theMeshEntry),
+ const std::string& theMeshEntry,
+ const bool theIsComputed,
+ const bool isEmpty):
+ myStudy (theStudy),
+ myMeshEntry (theMeshEntry),
myIsComputed(theIsComputed),
- myIsEmpty(isEmpty)
+ myIsEmpty (isEmpty)
{}
virtual
void
Execute()
{
- SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
- if(!aMeshSO->_is_nil())
- if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
- SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
+ SALOMEDS::SObject_ptr aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
+ if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
+ SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
+ // aMeshSO->UnRegister(); ~aMesh() already called UnRegister()!
}
};
#include <SALOMEDSClient_Study.hxx>
+#include <GEOM_GenericObjPtr.h>
+
// SALOME GUI includes
#include <SUIT_ResourceMgr.h>
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IShapesOperations_var shapeOp;
+ GEOM::GEOM_IShapesOperations_wrap shapeOp;
if ( !geomGen->_is_nil() && aStudy )
shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
if ( !shapeOp->_is_nil() )
#include <TopExp_Explorer.hxx>
#include <StdSelect_TypeOfEdge.hxx>
-// SALOME KERNEL includes
-#include <SALOMEDS_SObject.hxx>
-
#define SPACING 6
#define MARGIN 0
{
GEOM::GEOM_Object_var aGeomObj;
SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
- if (aStudy != 0) {
+ if ( !aStudy->_is_nil() )
+ {
SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
- SALOMEDS::GenericAttribute_var anAttr;
-
- if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- CORBA::String_var aVal = anIOR->Value();
- CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal);
+ if (!aSObj->_is_nil() )
+ {
+ CORBA::Object_var obj = aSObj->GetObject();
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+ aSObj->UnRegister();
}
}
- return aGeomObj;
+ return aGeomObj._retn();
}
//=================================================================================
#include "SMESH_PythonDump.hxx"
#include "StdMeshers_ObjRefUlils.hxx"
-#include "Utils_CorbaException.hxx"
-#include "utilities.h"
+#include <Utils_CorbaException.hxx>
+#include <utilities.h>
+#include <SALOMEDS_wrap.hxx>
#include <TCollection_AsciiString.hxx>
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
smesh_groups.push_back( gp_i->GetSmeshGroup() );
- SALOMEDS::SObject_var so = SMESH_Gen_i::GetSMESHGen()->ObjectToSObject(study, groups[i]);
+ SALOMEDS::SObject_wrap so = SMESH_Gen_i::ObjectToSObject(study, groups[i]);
if ( !so->_is_nil())
{
CORBA::String_var entry = so->GetID();
os << " " << _groupEntries[i];
// id
- SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
- CORBA::Object_var groupObj;
+ SALOMEDS::SObject_wrap groupSO = study->FindObjectID( _groupEntries[i] );
+ CORBA::Object_var groupObj;
if ( !groupSO->_is_nil() )
groupObj = groupSO->GetObject();
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
smesh_groups.push_back( gp_i->GetSmeshGroup() );
- SALOMEDS::SObject_var so = SMESH_Gen_i::GetSMESHGen()->ObjectToSObject(study, groups[i]);
+ SALOMEDS::SObject_var so = SMESH_Gen_i::ObjectToSObject(study, groups[i]);
if ( !so->_is_nil())
{
CORBA::String_var entry = so->GetID();
entries.push_back( entry.in() );
+ so->UnRegister();
}
}
this->GetImpl()->SetGroups( smesh_groups );
// id
SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
- CORBA::Object_var groupObj;
- if ( !groupSO->_is_nil() )
+ CORBA::Object_var groupObj;
+ if ( !groupSO->_is_nil() ) {
groupObj = groupSO->GetObject();
+ groupSO->UnRegister();
+ }
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
}
this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
// Remove SO of 1D hypothesis if it was published
- if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
+ if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen())
+ {
SALOMEDS::Study_var study = gen->GetCurrentStudy();
- SALOMEDS::SObject_var SO = gen->ObjectToSObject( study, hyp1D );
+ SALOMEDS::SObject_var SO = gen->ObjectToSObject( study, hyp1D );
if ( ! SO->_is_nil() )
- study->NewBuilder()->RemoveObjectWithChildren( SO );
+ {
+ SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
+ builder->RemoveObjectWithChildren( SO );
+ SO->UnRegister();
+ }
}
// Update Python script: write creation of 1D hyp as it is not published and
// for this, SMESH_Gen does not write it's creation
//
#include "StdMeshers_ObjRefUlils.hxx"
+#include <SALOMEDS_wrap.hxx>
#include <TopoDS_Shape.hxx>
using namespace std;
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
SALOMEDS::Study_var study = gen->GetCurrentStudy();
if ( ! theEntry.empty() && ! study->_is_nil() ) {
- SALOMEDS::SObject_var sobj= study->FindObjectID( theEntry.c_str() );
- CORBA::Object_var obj = gen->SObjectToObject( sobj );
+ SALOMEDS::SObject_wrap sobj = study->FindObjectID( theEntry.c_str() );
+ CORBA::Object_var obj = gen->SObjectToObject( sobj );
geom = GEOM::GEOM_Object::_narrow( obj );
}
}
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
GEOM::GEOM_Object_var geom = gen->ShapeToGeomObject( theShape );
if ( ! geom->_is_nil() ) {
- SALOMEDS::SObject_var sobj = gen->ObjectToSObject( gen->GetCurrentStudy(), geom );
+ SALOMEDS::SObject_wrap sobj = gen->ObjectToSObject( gen->GetCurrentStudy(), geom );
if ( !sobj->_is_nil() ) {
- stream << " " << sobj->GetID();
+ CORBA::String_var entry = sobj->GetID();
+ stream << " " << entry.in();
ok = true;
}
}
if ( ! study->_is_nil() ) {
string str;
if (stream >> str) {
- SALOMEDS::SObject_var sobj= study->FindObjectID( str.c_str() );
- CORBA::Object_var obj = gen->SObjectToObject( sobj );
- GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
+ SALOMEDS::SObject_wrap sobj = study->FindObjectID( str.c_str() );
+ CORBA::Object_var obj = gen->SObjectToObject( sobj );
+ GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
return gen->GeomObjectToShape( geom.in() );
}
}