mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 10:50:34 +05:00
21948: EDF SMESH : Memory is not freed when deleting a mesh
Elimenate memory leaks on CORBA objects, servants of SALOMEDS objects etc
This commit is contained in:
parent
873eca935e
commit
b3aa30bca3
@ -347,13 +347,11 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
|||||||
|
|
||||||
SMESHGUI::Modified();
|
SMESHGUI::Modified();
|
||||||
|
|
||||||
#ifdef WITHGENERICOBJ
|
|
||||||
// obj has been published in study. Its refcount has been incremented.
|
// obj has been published in study. Its refcount has been incremented.
|
||||||
// It is safe to decrement its refcount
|
// It is safe to decrement its refcount
|
||||||
// so that it will be destroyed when the entry in study will be removed
|
// so that it will be destroyed when the entry in study will be removed
|
||||||
if (!CORBA::is_nil(aCompoundMesh))
|
if (!CORBA::is_nil(aCompoundMesh))
|
||||||
aCompoundMesh->UnRegister();
|
aCompoundMesh->UnRegister();
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
// SALOME GEOM includes
|
// SALOME GEOM includes
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
// SALOME KERNEL includes
|
// SALOME KERNEL includes
|
||||||
#include <SALOMEDS_SObject.hxx>
|
#include <SALOMEDS_SObject.hxx>
|
||||||
@ -114,10 +115,11 @@ namespace SMESH
|
|||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
if (!aStudy || geomGen->_is_nil())
|
if (!aStudy || geomGen->_is_nil())
|
||||||
return GEOM::GEOM_Object::_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())
|
if (aShapesOp->_is_nil())
|
||||||
return GEOM::GEOM_Object::_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();
|
return subShape._retn();
|
||||||
}
|
}
|
||||||
} // end of namespace SMESH
|
} // end of namespace SMESH
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
// SALOME GEOM includes
|
// SALOME GEOM includes
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
#include <GEOM_SelectionFilter.h>
|
#include <GEOM_SelectionFilter.h>
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <QtxColorButton.h>
|
#include <QtxColorButton.h>
|
||||||
@ -1033,8 +1034,6 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
|
||||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
|
||||||
|
|
||||||
if (myGeomObjects->length() == 1) {
|
if (myGeomObjects->length() == 1) {
|
||||||
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
|
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
|
||||||
@ -1053,8 +1052,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
if (geomGen->_is_nil() || !aStudy)
|
if (geomGen->_is_nil() || !aStudy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GEOM::GEOM_IGroupOperations_var op =
|
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
|
||||||
geomGen->GetIGroupOperations(aStudy->StudyId());
|
|
||||||
if (op->_is_nil())
|
if (op->_is_nil())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1071,8 +1069,8 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||||
GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
|
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
|
||||||
op->UnionList(aGroupVar, myGeomObjects);
|
op->UnionList(aGroupVar, myGeomObjects);
|
||||||
|
|
||||||
if (op->IsDone()) {
|
if (op->IsDone()) {
|
||||||
@ -1373,15 +1371,19 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
|
|
||||||
// Check if group constructed on the same shape as a mesh or on its child
|
// Check if group constructed on the same shape as a mesh or on its child
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IGroupOperations_var anOp =
|
|
||||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
|
||||||
|
|
||||||
// The main shape of the group
|
// The main shape of the group
|
||||||
GEOM::GEOM_Object_var aGroupMainShape;
|
GEOM::GEOM_Object_wrap aGroupMainShape;
|
||||||
if (aGeomGroup->GetType() == 37)
|
if (aGeomGroup->GetType() == 37) {
|
||||||
|
GEOM::GEOM_IGroupOperations_wrap anOp =
|
||||||
|
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||||
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
|
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
|
||||||
else
|
// aGroupMainShape is a new geom servant to be deleted by GEOM_Object_wrap
|
||||||
aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
|
}
|
||||||
|
else {
|
||||||
|
aGroupMainShape = aGeomGroup;
|
||||||
|
aGroupMainShape->Register();
|
||||||
|
}
|
||||||
_PTR(SObject) aGroupMainShapeSO =
|
_PTR(SObject) aGroupMainShapeSO =
|
||||||
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
|
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
|
||||||
|
|
||||||
@ -1951,7 +1953,7 @@ void SMESHGUI_GroupDlg::onAdd()
|
|||||||
|
|
||||||
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
|
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||||
|
|
||||||
SMESH::ElementType aGroupType = SMESH::ALL;
|
SMESH::ElementType aGroupType = SMESH::ALL;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GEOM_SelectionFilter.h>
|
#include <GEOM_SelectionFilter.h>
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_OverrideCursor.h>
|
#include <SUIT_OverrideCursor.h>
|
||||||
@ -204,7 +205,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
|
static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
|
||||||
{
|
{
|
||||||
if ( !geom->_is_nil() ) {
|
if ( !geom->_is_nil() ) {
|
||||||
switch ( geom->GetShapeType() ) {
|
switch ( geom->GetShapeType() ) {
|
||||||
@ -219,17 +220,17 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
|
|||||||
default: return SMESH::ALL;
|
default: return SMESH::ALL;
|
||||||
}
|
}
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IShapesOperations_var aShapeOp =
|
GEOM::GEOM_IShapesOperations_wrap aShapeOp =
|
||||||
SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
|
SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
|
||||||
|
|
||||||
if ( geom->GetType() == 37 ) { // geom group
|
if ( geom->GetType() == 37 ) { // geom group
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||||
if ( !aGroupOp->_is_nil() ) {
|
if ( !aGroupOp->_is_nil() ) {
|
||||||
GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
|
GEOM::GEOM_Object_wrap mainShape = aGroupOp->GetMainShape( geom );
|
||||||
GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
|
GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
|
||||||
if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
|
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 );
|
return elementType( member );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +238,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var& geom)
|
|||||||
else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
|
else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
|
||||||
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
|
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
|
||||||
if ( ids->length() ) {
|
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 );
|
return elementType( member );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,23 +51,32 @@
|
|||||||
#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 )
|
: myToDeleteInitParamsHypo( false ),
|
||||||
|
myHypType( theHypType ),
|
||||||
|
myIsCreate( false ),
|
||||||
|
myDlg( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
|
SMESHGUI_GenericHypothesisCreator::~SMESHGUI_GenericHypothesisCreator()
|
||||||
{
|
{
|
||||||
|
if ( myToDeleteInitParamsHypo && !myInitParamsHypo->_is_nil() )
|
||||||
|
myInitParamsHypo->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
|
void SMESHGUI_GenericHypothesisCreator::setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr hyp)
|
||||||
{
|
{
|
||||||
if ( !CORBA::is_nil( hyp ) && hypType() == hyp->GetName() )
|
if ( !CORBA::is_nil( hyp ) ) {
|
||||||
myInitParamsHypo = SMESH::SMESH_Hypothesis::_duplicate( 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,
|
void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr initParamsHyp,
|
||||||
@ -91,19 +100,15 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
|||||||
if (isAlgo) {
|
if (isAlgo) {
|
||||||
SMESH::SMESH_Hypothesis_var anAlgo =
|
SMESH::SMESH_Hypothesis_var anAlgo =
|
||||||
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
|
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
|
||||||
#ifdef WITHGENERICOBJ
|
|
||||||
if (!CORBA::is_nil(anAlgo))
|
if (!CORBA::is_nil(anAlgo))
|
||||||
anAlgo->UnRegister();
|
anAlgo->UnRegister();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
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))
|
if (!CORBA::is_nil(aHypothesis))
|
||||||
aHypothesis->UnRegister();
|
aHypothesis->UnRegister();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +133,7 @@ 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();
|
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 ) ) );
|
||||||
@ -302,9 +305,7 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
|
||||||
#ifdef WITHGENERICOBJ
|
|
||||||
myHypo->UnRegister();
|
myHypo->UnRegister();
|
||||||
#endif
|
|
||||||
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
myHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
|
||||||
|
|
||||||
|
@ -612,23 +612,21 @@ namespace SMESH
|
|||||||
return res < SMESH::HYP_UNKNOWN_FATAL;
|
return res < SMESH::HYP_UNKNOWN_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
|
bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
|
||||||
SMESH::SMESH_Hypothesis_ptr anHyp)
|
SMESH::SMESH_Hypothesis_ptr anHyp)
|
||||||
{
|
{
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
|
||||||
SALOMEDS::AttributeIOR_var anIOR;
|
|
||||||
int res = SMESH::HYP_UNKNOWN_FATAL;
|
int res = SMESH::HYP_UNKNOWN_FATAL;
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
|
|
||||||
if (MorSM) {
|
if (MorSM) {
|
||||||
try {
|
try {
|
||||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
|
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(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_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
|
||||||
|
|
||||||
if (!aSubMesh->_is_nil())
|
if (!aSubMesh->_is_nil())
|
||||||
aMesh = aSubMesh->GetFather();
|
aMesh = aSubMesh->GetFather();
|
||||||
|
|
||||||
if (!aMesh->_is_nil()) {
|
if (!aMesh->_is_nil()) {
|
||||||
if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
|
if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
|
||||||
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
|
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <GEOM_SelectionFilter.h>
|
#include <GEOM_SelectionFilter.h>
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SalomeApp_Tools.h>
|
#include <SalomeApp_Tools.h>
|
||||||
@ -56,6 +57,8 @@
|
|||||||
// SALOME KERNEL includes
|
// SALOME KERNEL includes
|
||||||
#include <SALOMEDS_SComponent.hxx>
|
#include <SALOMEDS_SComponent.hxx>
|
||||||
#include <SALOMEDS_SObject.hxx>
|
#include <SALOMEDS_SObject.hxx>
|
||||||
|
#include <SALOMEDS_Study.hxx>
|
||||||
|
#include <SALOMEDS_wrap.hxx>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -336,8 +339,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
|
|||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
if (geomGen->_is_nil() || !aStudy) return false;
|
if (geomGen->_is_nil() || !aStudy) return false;
|
||||||
|
|
||||||
GEOM::GEOM_IGroupOperations_var op =
|
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
|
||||||
geomGen->GetIGroupOperations(aStudy->StudyId());
|
|
||||||
if (op->_is_nil()) return false;
|
if (op->_is_nil()) return false;
|
||||||
|
|
||||||
// check all selected shapes
|
// check all selected shapes
|
||||||
@ -352,18 +354,17 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
|
|||||||
if (aSubGeomVar->_is_nil()) return false;
|
if (aSubGeomVar->_is_nil()) return false;
|
||||||
|
|
||||||
// skl for NPAL14695 - implementation of searching of mainObj
|
// skl for NPAL14695 - implementation of searching of mainObj
|
||||||
GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar);
|
GEOM::GEOM_Object_wrap mainObj = op->GetMainShape(aSubGeomVar);
|
||||||
//if (mainObj->_is_nil() ||
|
|
||||||
// string(mainObj->GetEntry()) != string(mainGeom->GetEntry())) return false;
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if (mainObj->_is_nil())
|
if (mainObj->_is_nil())
|
||||||
return false;
|
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;
|
return true;
|
||||||
mainObj = op->GetMainShape(mainObj);
|
mainObj = op->GetMainShape(mainObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -896,7 +897,8 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
|
|||||||
SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
|
SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
|
||||||
if ( !aHypVar->_is_nil() )
|
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 ( !aData) continue;
|
||||||
if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) &&
|
if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) &&
|
||||||
( isCompatible ( theAlgoData, aData, theHypType )) &&
|
( isCompatible ( theAlgoData, aData, theHypType )) &&
|
||||||
@ -1710,7 +1712,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
|
|||||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
if (!geomGen->_is_nil() && aStudy) {
|
if (!geomGen->_is_nil() && aStudy) {
|
||||||
GEOM::GEOM_IGroupOperations_var op =
|
GEOM::GEOM_IGroupOperations_wrap op =
|
||||||
geomGen->GetIGroupOperations(aStudy->StudyId());
|
geomGen->GetIGroupOperations(aStudy->StudyId());
|
||||||
if (!op->_is_nil()) {
|
if (!op->_is_nil()) {
|
||||||
// check and add all selected GEOM objects: they must be
|
// check and add all selected GEOM objects: they must be
|
||||||
@ -1735,18 +1737,19 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
|
|||||||
aSeq[iSubSh] = aSubGeomVar;
|
aSeq[iSubSh] = aSubGeomVar;
|
||||||
}
|
}
|
||||||
// create a group
|
// 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);
|
op->UnionList(aGroupVar, aSeq);
|
||||||
|
|
||||||
if (op->IsDone()) {
|
if (op->IsDone()) {
|
||||||
aGeomVar = aGroupVar;
|
aGeomVar = aGroupVar.in();
|
||||||
|
|
||||||
// publish the GEOM group in study
|
// publish the GEOM group in study
|
||||||
QString aNewGeomGroupName ("Auto_group_for_");
|
QString aNewGeomGroupName ("Auto_group_for_");
|
||||||
aNewGeomGroupName += aName;
|
aNewGeomGroupName += aName;
|
||||||
SALOMEDS::SObject_var aNewGroupSO =
|
SALOMEDS::Study_var aStudyVar = _CAST(Study, aStudy)->GetStudy();
|
||||||
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
|
SALOMEDS::SObject_wrap aNewGroupSO =
|
||||||
aNewGeomGroupName.toLatin1().data(), mainGeom);
|
geomGen->AddInStudy( aStudyVar, aGeomVar,
|
||||||
|
aNewGeomGroupName.toLatin1().data(), mainGeom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ bool SMESHGUI_Selection::isImported( const int ind ) const
|
|||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( SO ) );
|
||||||
if( !aMesh->_is_nil() )
|
if( !aMesh->_is_nil() )
|
||||||
{
|
{
|
||||||
SALOME_MED::MedFileInfo* inf = aMesh->GetMEDFileInfo();
|
SALOME_MED::MedFileInfo_var inf = aMesh->GetMEDFileInfo();
|
||||||
res = strlen( (char*)inf->fileName ) > 0;
|
res = strlen( (char*)inf->fileName ) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
// SALOME GEOM includes
|
// SALOME GEOM includes
|
||||||
#include <GEOMBase.h>
|
#include <GEOMBase.h>
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <LightApp_DataOwner.h>
|
#include <LightApp_DataOwner.h>
|
||||||
@ -53,6 +54,8 @@
|
|||||||
|
|
||||||
// SALOME KERNEL includes
|
// SALOME KERNEL includes
|
||||||
#include <SALOMEDSClient_SObject.hxx>
|
#include <SALOMEDSClient_SObject.hxx>
|
||||||
|
#include <SALOMEDS_Study.hxx>
|
||||||
|
#include <SALOMEDS_wrap.hxx>
|
||||||
|
|
||||||
// OCCT includes
|
// OCCT includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
@ -223,7 +226,7 @@ SMESH::SMESH_Mesh_ptr SMESHGUI_ShapeByMeshOp::GetMesh()
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GetShape()
|
// function : GetShape()
|
||||||
// purpose : Get published sub-shape
|
// purpose : Return published sub-shape, it must be UnRegister()ed!
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
GEOM::GEOM_Object_ptr SMESHGUI_ShapeByMeshOp::GetShape()
|
GEOM::GEOM_Object_ptr SMESHGUI_ShapeByMeshOp::GetShape()
|
||||||
{
|
{
|
||||||
@ -306,85 +309,92 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
|||||||
try {
|
try {
|
||||||
QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts);
|
QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts);
|
||||||
if (aListId.count() == 1)
|
if (aListId.count() == 1)
|
||||||
{
|
{
|
||||||
int elemID = (aListId.first()).toInt();
|
int elemID = (aListId.first()).toInt();
|
||||||
myGeomObj = GEOM::GEOM_Object::_duplicate(
|
// GEOM_Object is published -> no need to UnRegister()
|
||||||
SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
|
myGeomObj = GEOM::GEOM_Object::_duplicate
|
||||||
( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
|
(SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
|
||||||
}
|
( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
|
||||||
|
}
|
||||||
else
|
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++ )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
aGeomObject = // received object need UnRegister()!
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
|
||||||
|
|
||||||
if (geomGen->_is_nil() || !aStudy)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
|
||||||
geomGen->GetIShapesOperations(aStudy->StudyId());
|
|
||||||
if (aShapesOp->_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();
|
if (aGeomObject->_is_nil()) continue;
|
||||||
|
|
||||||
for ( int i = 0; i < aListId.count(); i++ )
|
|
||||||
{
|
|
||||||
aGeomObject =
|
|
||||||
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) )
|
||||||
double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
|
{
|
||||||
if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
|
aGeomObjectsMap[anId] = aGeomObject;
|
||||||
{
|
|
||||||
aGeomObjectsMap[anId] = aGeomObject;
|
|
||||||
|
|
||||||
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
|
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
aGroupType = aSubShapeType;
|
aGroupType = aSubShapeType;
|
||||||
else if (aSubShapeType != aGroupType)
|
else if (aSubShapeType != aGroupType)
|
||||||
aGroupType = TopAbs_SHAPE;
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int aNumberOfGO = aGeomObjectsMap.size();
|
||||||
|
if (aNumberOfGO == 1)
|
||||||
|
{
|
||||||
|
aGeomObject = (*aGeomObjectsMap.begin()).second;
|
||||||
|
}
|
||||||
|
else if (aNumberOfGO > 1)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_IGroupOperations_wrap 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_wrap>::iterator anIter;
|
||||||
|
for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
|
||||||
|
aGeomObjects[i++] = (*anIter).second.in();
|
||||||
|
|
||||||
|
//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) {
|
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||||
|
@ -83,12 +83,15 @@ namespace
|
|||||||
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
|
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
|
||||||
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||||
aName->SetValue(theName.toLatin1().data());
|
aName->SetValue(theName.toLatin1().data());
|
||||||
|
aName->UnRegister();
|
||||||
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
|
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
|
||||||
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
aPixmap->SetPixMap(thePixmap.toLatin1().data());
|
aPixmap->SetPixMap(thePixmap.toLatin1().data());
|
||||||
|
aPixmap->UnRegister();
|
||||||
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
|
anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
|
||||||
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
||||||
aSelAttr->SetSelectable(false);
|
aSelAttr->SetSelectable(false);
|
||||||
|
aSelAttr->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
return aDomainRoot;
|
return aDomainRoot;
|
||||||
@ -126,12 +129,12 @@ namespace
|
|||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
inline
|
inline
|
||||||
SALOMEDS::SObject_var
|
SALOMEDS::SObject_var
|
||||||
AddToDomain(const std::string& theIOR,
|
AddToDomain(const std::string& theIOR,
|
||||||
const SALOMEDS::SComponent_var& theSComponentMesh,
|
const SALOMEDS::SComponent_var& theSComponentMesh,
|
||||||
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
||||||
CORBA::Long theDomainRootTag,
|
CORBA::Long theDomainRootTag,
|
||||||
const QString& theDomainName,
|
const QString& theDomainName,
|
||||||
const QString& theDomainPixmap)
|
const QString& theDomainPixmap)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
|
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
@ -140,6 +143,7 @@ namespace
|
|||||||
theDomainPixmap);
|
theDomainPixmap);
|
||||||
// Add New Hypothesis
|
// Add New Hypothesis
|
||||||
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
|
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
|
||||||
|
aDomain->UnRegister();
|
||||||
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
|
SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
|
||||||
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
CORBA::Object_var anObject = StringToObject(theIOR);
|
CORBA::Object_var anObject = StringToObject(theIOR);
|
||||||
@ -147,9 +151,11 @@ namespace
|
|||||||
CORBA::String_var aType = aDomainItem->GetName();
|
CORBA::String_var aType = aDomainItem->GetName();
|
||||||
QString aPixmapName = theDomainPixmap + "_" + aType.in();
|
QString aPixmapName = theDomainPixmap + "_" + aType.in();
|
||||||
aPixmap->SetPixMap(aPixmapName.toLatin1().data());
|
aPixmap->SetPixMap(aPixmapName.toLatin1().data());
|
||||||
|
aPixmap->UnRegister();
|
||||||
anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
|
anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(theIOR.c_str());
|
anIOR->SetValue(theIOR.c_str());
|
||||||
|
anIOR->UnRegister();
|
||||||
|
|
||||||
return aSObject;
|
return aSObject;
|
||||||
}
|
}
|
||||||
@ -187,44 +193,52 @@ namespace
|
|||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
void
|
void
|
||||||
SetDomain(const char* theMeshOrSubMeshEntry,
|
SetDomain(const char* theMeshOrSubMeshEntry,
|
||||||
const char* theDomainEntry,
|
const char* theDomainEntry,
|
||||||
const SALOMEDS::Study_var& theStudy,
|
const SALOMEDS::Study_var& theStudy,
|
||||||
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
const SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
||||||
long theRefOnAppliedDomainTag,
|
long theRefOnAppliedDomainTag,
|
||||||
const QString& theAppliedDomainMEN,
|
const QString& theAppliedDomainMEN,
|
||||||
const QString& theAppliedDomainICON)
|
const QString& theAppliedDomainICON)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aMeshOrSubMeshSO = theStudy->FindObjectID(theMeshOrSubMeshEntry);
|
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()){
|
if(!aMeshOrSubMeshSO->_is_nil() && !aHypothesisSO->_is_nil()){
|
||||||
//Find or Create Applied Hypothesis root
|
//Find or Create Applied Hypothesis root
|
||||||
SALOMEDS::SObject_var anAppliedDomainSO;
|
SALOMEDS::SObject_var anAppliedDomainSO;
|
||||||
if(!aMeshOrSubMeshSO->FindSubObject(theRefOnAppliedDomainTag,anAppliedDomainSO)){
|
if( !aMeshOrSubMeshSO->FindSubObject( theRefOnAppliedDomainTag, anAppliedDomainSO ))
|
||||||
|
{
|
||||||
anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
|
anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
|
||||||
SALOMEDS::GenericAttribute_var anAttr =
|
SALOMEDS::GenericAttribute_var anAttr =
|
||||||
theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
|
theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
|
||||||
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||||
aName->SetValue(theAppliedDomainMEN.toLatin1().data());
|
aName->SetValue(theAppliedDomainMEN.toLatin1().data());
|
||||||
|
aName->UnRegister();
|
||||||
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
|
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
|
||||||
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
||||||
aSelAttr->SetSelectable(false);
|
aSelAttr->SetSelectable(false);
|
||||||
|
aSelAttr->UnRegister();
|
||||||
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
|
anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
|
||||||
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
|
aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
|
||||||
|
aPixmap->UnRegister();
|
||||||
}
|
}
|
||||||
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
|
SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
|
||||||
theStudyBuilder->Addreference(aSObject,aHypothesisSO);
|
theStudyBuilder->Addreference(aSObject,aHypothesisSO);
|
||||||
|
aSObject->UnRegister();
|
||||||
|
anAppliedDomainSO->UnRegister();
|
||||||
}
|
}
|
||||||
|
if ( !aMeshOrSubMeshSO->_is_nil() ) aMeshOrSubMeshSO->UnRegister();
|
||||||
|
if ( !aHypothesisSO->_is_nil()) aHypothesisSO->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
void
|
void
|
||||||
SetHypothesis(const char* theMeshOrSubMeshEntry,
|
SetHypothesis(const char* theMeshOrSubMeshEntry,
|
||||||
const char* theDomainEntry,
|
const char* theDomainEntry,
|
||||||
const SALOMEDS::Study_var& theStudy,
|
const SALOMEDS::Study_var& theStudy,
|
||||||
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
|
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
|
||||||
{
|
{
|
||||||
SetDomain(theMeshOrSubMeshEntry,
|
SetDomain(theMeshOrSubMeshEntry,
|
||||||
@ -239,9 +253,9 @@ namespace
|
|||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
void
|
void
|
||||||
SetAlgorithms(const char* theMeshOrSubMeshEntry,
|
SetAlgorithms(const char* theMeshOrSubMeshEntry,
|
||||||
const char* theDomainEntry,
|
const char* theDomainEntry,
|
||||||
const SALOMEDS::Study_var& theStudy,
|
const SALOMEDS::Study_var& theStudy,
|
||||||
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
|
const SALOMEDS::StudyBuilder_var& theStudyBuilder)
|
||||||
{
|
{
|
||||||
SetDomain(theMeshOrSubMeshEntry,
|
SetDomain(theMeshOrSubMeshEntry,
|
||||||
@ -296,31 +310,36 @@ SMESH_Swig::Init(int theStudyID)
|
|||||||
{
|
{
|
||||||
class TEvent: public SALOME_Event
|
class TEvent: public SALOME_Event
|
||||||
{
|
{
|
||||||
int myStudyID;
|
int myStudyID;
|
||||||
SALOMEDS::Study_var& myStudy;
|
SALOMEDS::Study_var& myStudy;
|
||||||
SALOMEDS::StudyBuilder_var& myStudyBuilder;
|
SALOMEDS::StudyBuilder_var& myStudyBuilder;
|
||||||
SALOMEDS::SComponent_var& mySComponentMesh;
|
SALOMEDS::SComponent_var& mySComponentMesh;
|
||||||
public:
|
public:
|
||||||
TEvent(int theStudyID,
|
TEvent(int theStudyID,
|
||||||
SALOMEDS::Study_var& theStudy,
|
SALOMEDS::Study_var& theStudy,
|
||||||
SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
SALOMEDS::StudyBuilder_var& theStudyBuilder,
|
||||||
SALOMEDS::SComponent_var& theSComponentMesh):
|
SALOMEDS::SComponent_var& theSComponentMesh):
|
||||||
myStudyID(theStudyID),
|
myStudyID (theStudyID),
|
||||||
myStudy(theStudy),
|
myStudy (theStudy),
|
||||||
myStudyBuilder(theStudyBuilder),
|
myStudyBuilder (theStudyBuilder),
|
||||||
mySComponentMesh(theSComponentMesh)
|
mySComponentMesh(theSComponentMesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
~TEvent()
|
||||||
|
{
|
||||||
|
if ( !mySComponentMesh->_is_nil() ) mySComponentMesh->UnRegister();
|
||||||
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
Execute()
|
Execute()
|
||||||
{
|
{
|
||||||
SUIT_Session* aSession = SUIT_Session::session();
|
SUIT_Session* aSession = SUIT_Session::session();
|
||||||
SUIT_Application* anApplication = aSession->activeApplication();
|
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();
|
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);
|
SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
|
||||||
myStudy = aStudyMgr->GetStudyByID(myStudyID);
|
myStudy = aStudyMgr->GetStudyByID(myStudyID);
|
||||||
|
|
||||||
@ -334,26 +353,33 @@ SMESH_Swig::Init(int theStudyID)
|
|||||||
SALOMEDS::AttributePixMap_var aPixmap;
|
SALOMEDS::AttributePixMap_var aPixmap;
|
||||||
|
|
||||||
SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
|
SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
|
||||||
if(aSComponent->_is_nil()){
|
if ( aSComponent->_is_nil() )
|
||||||
|
{
|
||||||
bool aLocked = myStudy->GetProperties()->IsLocked();
|
bool aLocked = myStudy->GetProperties()->IsLocked();
|
||||||
if (aLocked)
|
if (aLocked)
|
||||||
myStudy->GetProperties()->SetLocked(false);
|
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
|
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
|
||||||
if (!aSMESHGUI){
|
//SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
|
||||||
|
if (!aSMESHGUI) {
|
||||||
CAM_Module* aModule = anApp->module("Mesh");
|
CAM_Module* aModule = anApp->module("Mesh");
|
||||||
if(!aModule)
|
if(!aModule)
|
||||||
aModule = anApp->loadModule("Mesh");
|
aModule = anApp->loadModule("Mesh");
|
||||||
aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
|
aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
|
||||||
} //SRN: BugID IPAL9186: end of a fix
|
} //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->SetValue(aSMESHGUI->moduleName().toLatin1().data());
|
||||||
|
aName->UnRegister();
|
||||||
|
|
||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
|
||||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
|
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
|
||||||
|
aPixmap->UnRegister();
|
||||||
|
|
||||||
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
|
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
|
||||||
if (aLocked)
|
if (aLocked)
|
||||||
myStudy->GetProperties()->SetLocked(true);
|
myStudy->GetProperties()->SetLocked(true);
|
||||||
@ -388,22 +414,29 @@ const char* SMESH_Swig::AddNewMesh(const char* theIOR)
|
|||||||
|
|
||||||
// VSR: added temporarily - to be removed - objects are published automatically by engine
|
// VSR: added temporarily - to be removed - objects are published automatically by engine
|
||||||
SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
|
SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
|
||||||
if (aSObject->_is_nil()){
|
if (aSObject->_is_nil())
|
||||||
|
{
|
||||||
//Find or Create Hypothesis root
|
//Find or Create Hypothesis root
|
||||||
GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
|
SALOMEDS::SObject_var hroot = GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
|
||||||
GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
|
SALOMEDS::SObject_var aroot = GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
|
||||||
|
hroot->UnRegister();
|
||||||
|
aroot->UnRegister();
|
||||||
|
|
||||||
// Add New Mesh
|
// Add New Mesh
|
||||||
aSObject = myStudyBuilder->NewObject(mySComponentMesh);
|
aSObject = myStudyBuilder->NewObject(mySComponentMesh);
|
||||||
SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
|
SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
|
||||||
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
|
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
|
||||||
|
aPixmap->UnRegister();
|
||||||
|
|
||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(theIOR);
|
anIOR->SetValue(theIOR);
|
||||||
|
anIOR->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
CORBA::String_var anEntry = aSObject->GetID();
|
CORBA::String_var anEntry = aSObject->GetID();
|
||||||
|
aSObject->UnRegister();
|
||||||
|
|
||||||
return anEntry._retn();
|
return anEntry._retn();
|
||||||
}
|
}
|
||||||
@ -418,6 +451,8 @@ const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
|
|||||||
mySComponentMesh,
|
mySComponentMesh,
|
||||||
myStudyBuilder);
|
myStudyBuilder);
|
||||||
CORBA::String_var anEntry = aSObject->GetID();
|
CORBA::String_var anEntry = aSObject->GetID();
|
||||||
|
aSObject->UnRegister();
|
||||||
|
|
||||||
return anEntry._retn();
|
return anEntry._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +466,8 @@ const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
|
|||||||
mySComponentMesh,
|
mySComponentMesh,
|
||||||
myStudyBuilder);
|
myStudyBuilder);
|
||||||
CORBA::String_var anEntry = aSObject->GetID();
|
CORBA::String_var anEntry = aSObject->GetID();
|
||||||
|
aSObject->UnRegister();
|
||||||
|
|
||||||
return anEntry._retn();
|
return anEntry._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,13 +476,16 @@ const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
|
|||||||
void SMESH_Swig::SetShape(const char* theShapeEntry,
|
void SMESH_Swig::SetShape(const char* theShapeEntry,
|
||||||
const char* theMeshEntry)
|
const char* theMeshEntry)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
|
|
||||||
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
|
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
|
||||||
|
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
|
||||||
|
|
||||||
if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
|
if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
|
||||||
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
|
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
|
||||||
myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
|
myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
|
||||||
|
aSObject->UnRegister();
|
||||||
}
|
}
|
||||||
|
if ( !aMeshSO->_is_nil() ) aMeshSO->UnRegister();
|
||||||
|
if ( !aGeomShapeSO->_is_nil() ) aGeomShapeSO->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -485,49 +525,57 @@ const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
|||||||
int theShapeType)
|
int theShapeType)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
|
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
|
||||||
if(!aMeshSO->_is_nil()){
|
if(!aMeshSO->_is_nil()) {
|
||||||
long aShapeTag;
|
long aShapeTag;
|
||||||
QString aSubMeshName;
|
QString aSubMeshName;
|
||||||
switch(theShapeType){
|
switch(theShapeType) {
|
||||||
case TopAbs_SOLID:
|
case TopAbs_SOLID:
|
||||||
aShapeTag = SMESH::Tag_SubMeshOnSolid;
|
aShapeTag = SMESH::Tag_SubMeshOnSolid;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
|
||||||
break;
|
break;
|
||||||
case TopAbs_FACE:
|
case TopAbs_FACE:
|
||||||
aShapeTag = SMESH::Tag_SubMeshOnFace;
|
aShapeTag = SMESH::Tag_SubMeshOnFace;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
|
||||||
break;
|
break;
|
||||||
case TopAbs_EDGE:
|
case TopAbs_EDGE:
|
||||||
aShapeTag = SMESH::Tag_SubMeshOnEdge;
|
aShapeTag = SMESH::Tag_SubMeshOnEdge;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
|
||||||
break;
|
break;
|
||||||
case TopAbs_VERTEX:
|
case TopAbs_VERTEX:
|
||||||
aShapeTag = SMESH::Tag_SubMeshOnVertex;
|
aShapeTag = SMESH::Tag_SubMeshOnVertex;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
aShapeTag = SMESH::Tag_SubMeshOnCompound;
|
aShapeTag = SMESH::Tag_SubMeshOnCompound;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOMEDS::SObject_var aSubMeshesRoot;
|
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
SALOMEDS::GenericAttribute_var anAttr;
|
||||||
if(!aMeshSO->FindSubObject(aShapeTag,aSubMeshesRoot)){
|
SALOMEDS::SObject_var aSubMeshesRoot;
|
||||||
|
if ( !aMeshSO->FindSubObject( aShapeTag, aSubMeshesRoot ) )
|
||||||
|
{
|
||||||
aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
|
aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
|
||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
|
||||||
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||||
aName->SetValue(aSubMeshName.toLatin1().data());
|
aName->SetValue(aSubMeshName.toLatin1().data());
|
||||||
|
aName->UnRegister();
|
||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
|
||||||
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
|
||||||
aSelAttr->SetSelectable(false);
|
aSelAttr->SetSelectable(false);
|
||||||
|
aSelAttr->UnRegister();
|
||||||
}
|
}
|
||||||
|
aSubMeshesRoot->UnRegister();
|
||||||
|
aMeshSO->UnRegister();
|
||||||
|
|
||||||
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
|
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
|
||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(theSubMeshIOR);
|
anIOR->SetValue(theSubMeshIOR);
|
||||||
|
anIOR->UnRegister();
|
||||||
|
|
||||||
CORBA::String_var aString = aSObject->GetID();
|
CORBA::String_var aString = aSObject->GetID();
|
||||||
|
aSObject->UnRegister();
|
||||||
|
|
||||||
return aString._retn();
|
return aString._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,17 +585,20 @@ const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
|||||||
const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
|
const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
|
||||||
const char* theGeomShapeEntry,
|
const char* theGeomShapeEntry,
|
||||||
const char* theSubMeshIOR,
|
const char* theSubMeshIOR,
|
||||||
int ShapeType)
|
int ShapeType)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
|
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
|
||||||
if(!aGeomShapeSO->_is_nil()){
|
if(!aGeomShapeSO->_is_nil())
|
||||||
const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
|
{
|
||||||
|
const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
|
||||||
SALOMEDS::SObject_var aSubMeshSO = myStudy->FindObjectID(aSubMeshEntry);
|
SALOMEDS::SObject_var aSubMeshSO = myStudy->FindObjectID(aSubMeshEntry);
|
||||||
if(!aSubMeshSO->_is_nil()){
|
if ( !aSubMeshSO->_is_nil()) {
|
||||||
SetShape(theGeomShapeEntry,aSubMeshEntry);
|
SetShape( theGeomShapeEntry, aSubMeshEntry );
|
||||||
CORBA::String_var aString = aSubMeshSO->GetID();
|
CORBA::String_var aString = aSubMeshSO->GetID();
|
||||||
|
aSubMeshSO->UnRegister();
|
||||||
return aString._retn();
|
return aString._retn();
|
||||||
}
|
}
|
||||||
|
aGeomShapeSO->UnRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -566,11 +617,11 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
|
|||||||
}
|
}
|
||||||
virtual void Execute() {
|
virtual void Execute() {
|
||||||
//SMESH::UpdateView(SMESH::eDisplay, _entry);
|
//SMESH::UpdateView(SMESH::eDisplay, _entry);
|
||||||
SUIT_Session* aSession = SUIT_Session::session();
|
SUIT_Session* aSession = SUIT_Session::session();
|
||||||
SUIT_Application* anApplication = aSession->activeApplication();
|
SUIT_Application* anApplication = aSession->activeApplication();
|
||||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
|
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
|
||||||
/*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
|
/*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
|
||||||
SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
|
SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
|
||||||
aDisp->Display(_entry,1);
|
aDisp->Display(_entry,1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -584,31 +635,31 @@ void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers )
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const char* _entry;
|
const char* _entry;
|
||||||
bool _allViewers;
|
bool _allViewers;
|
||||||
public:
|
public:
|
||||||
TEvent(const char* Mesh_Entry, const bool allViewers ) {
|
TEvent(const char* Mesh_Entry, const bool allViewers ) {
|
||||||
_entry = Mesh_Entry;
|
_entry = Mesh_Entry;
|
||||||
_allViewers = allViewers;
|
_allViewers = allViewers;
|
||||||
}
|
}
|
||||||
virtual void Execute() {
|
virtual void Execute() {
|
||||||
SUIT_Session* aSession = SUIT_Session::session();
|
SUIT_Session* aSession = SUIT_Session::session();
|
||||||
SUIT_Application* anApplication = aSession->activeApplication();
|
SUIT_Application* anApplication = aSession->activeApplication();
|
||||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
|
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
|
||||||
SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
|
SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
|
||||||
ViewManagerList aManagers;
|
ViewManagerList aManagers;
|
||||||
if ( !_allViewers ) {
|
if ( !_allViewers ) {
|
||||||
aManagers << anApp->activeViewManager();
|
aManagers << anApp->activeViewManager();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aManagers = anApp->viewManagers();
|
aManagers = anApp->viewManagers();
|
||||||
}
|
}
|
||||||
foreach( SUIT_ViewManager* aMgr, aManagers ) {
|
foreach( SUIT_ViewManager* aMgr, aManagers ) {
|
||||||
if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
|
if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
|
||||||
SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
|
SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
|
||||||
if (aSalomeView) {
|
if (aSalomeView) {
|
||||||
aDisp->Erase(_entry,true, true, aSalomeView);
|
aDisp->Erase(_entry,true, true, aSalomeView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -626,6 +677,8 @@ void SMESH_Swig::SetName(const char* theEntry,
|
|||||||
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
|
anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
|
||||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||||
aName->SetValue(theName);
|
aName->SetValue(theName);
|
||||||
|
aName->UnRegister();
|
||||||
|
aSObject->UnRegister();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,33 +691,33 @@ void SMESH_Swig::SetName(const char* theEntry,
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
|
void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
|
||||||
const bool theIsComputed,
|
const bool theIsComputed,
|
||||||
const bool isEmpty)
|
const bool isEmpty)
|
||||||
{
|
{
|
||||||
class TEvent: public SALOME_Event
|
class TEvent: public SALOME_Event
|
||||||
{
|
{
|
||||||
SALOMEDS::Study_var myStudy;
|
SALOMEDS::Study_var myStudy;
|
||||||
std::string myMeshEntry;
|
std::string myMeshEntry;
|
||||||
bool myIsComputed, myIsEmpty;
|
bool myIsComputed, myIsEmpty;
|
||||||
public:
|
public:
|
||||||
TEvent(const SALOMEDS::Study_var& theStudy,
|
TEvent(const SALOMEDS::Study_var& theStudy,
|
||||||
const std::string& theMeshEntry,
|
const std::string& theMeshEntry,
|
||||||
const bool theIsComputed,
|
const bool theIsComputed,
|
||||||
const bool isEmpty):
|
const bool isEmpty):
|
||||||
myStudy(theStudy),
|
myStudy (theStudy),
|
||||||
myMeshEntry(theMeshEntry),
|
myMeshEntry (theMeshEntry),
|
||||||
myIsComputed(theIsComputed),
|
myIsComputed(theIsComputed),
|
||||||
myIsEmpty(isEmpty)
|
myIsEmpty (isEmpty)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
Execute()
|
Execute()
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
|
SALOMEDS::SObject_ptr aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
|
||||||
if(!aMeshSO->_is_nil())
|
if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
|
||||||
if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
|
SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
|
||||||
SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
|
// aMeshSO->UnRegister(); ~aMesh() already called UnRegister()!
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include <SALOMEDSClient_Study.hxx>
|
#include <SALOMEDSClient_Study.hxx>
|
||||||
|
|
||||||
|
#include <GEOM_GenericObjPtr.h>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
|
|
||||||
@ -418,7 +420,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
|
|||||||
|
|
||||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IShapesOperations_var shapeOp;
|
GEOM::GEOM_IShapesOperations_wrap shapeOp;
|
||||||
if ( !geomGen->_is_nil() && aStudy )
|
if ( !geomGen->_is_nil() && aStudy )
|
||||||
shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
|
shapeOp = geomGen->GetIShapesOperations( aStudy->StudyId() );
|
||||||
if ( !shapeOp->_is_nil() )
|
if ( !shapeOp->_is_nil() )
|
||||||
|
@ -68,9 +68,6 @@
|
|||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <StdSelect_TypeOfEdge.hxx>
|
#include <StdSelect_TypeOfEdge.hxx>
|
||||||
|
|
||||||
// SALOME KERNEL includes
|
|
||||||
#include <SALOMEDS_SObject.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 0
|
#define MARGIN 0
|
||||||
@ -470,18 +467,17 @@ GEOM::GEOM_Object_var StdMeshersGUI_SubShapeSelectorWdg::GetGeomObjectByEntry( c
|
|||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var aGeomObj;
|
GEOM::GEOM_Object_var aGeomObj;
|
||||||
SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
|
SALOMEDS::Study_var aStudy = SMESHGUI::GetSMESHGen()->GetCurrentStudy();
|
||||||
if (aStudy != 0) {
|
if ( !aStudy->_is_nil() )
|
||||||
|
{
|
||||||
SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
|
SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( theEntry.toLatin1().data() );
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
if (!aSObj->_is_nil() )
|
||||||
|
{
|
||||||
if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
|
CORBA::Object_var obj = aSObj->GetObject();
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
|
||||||
CORBA::String_var aVal = anIOR->Value();
|
|
||||||
CORBA::Object_var obj = aStudy->ConvertIORToObject(aVal);
|
|
||||||
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
|
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
|
||||||
|
aSObj->UnRegister();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aGeomObj;
|
return aGeomObj._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -32,8 +32,9 @@
|
|||||||
#include "SMESH_PythonDump.hxx"
|
#include "SMESH_PythonDump.hxx"
|
||||||
#include "StdMeshers_ObjRefUlils.hxx"
|
#include "StdMeshers_ObjRefUlils.hxx"
|
||||||
|
|
||||||
#include "Utils_CorbaException.hxx"
|
#include <Utils_CorbaException.hxx>
|
||||||
#include "utilities.h"
|
#include <utilities.h>
|
||||||
|
#include <SALOMEDS_wrap.hxx>
|
||||||
|
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ void StdMeshers_ImportSource1D_i::SetSourceEdges(const SMESH::ListOfGroups& grou
|
|||||||
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
|
||||||
smesh_groups.push_back( gp_i->GetSmeshGroup() );
|
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())
|
if ( !so->_is_nil())
|
||||||
{
|
{
|
||||||
CORBA::String_var entry = so->GetID();
|
CORBA::String_var entry = so->GetID();
|
||||||
@ -178,8 +179,8 @@ char* StdMeshers_ImportSource1D_i::SaveTo()
|
|||||||
os << " " << _groupEntries[i];
|
os << " " << _groupEntries[i];
|
||||||
|
|
||||||
// id
|
// id
|
||||||
SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
|
SALOMEDS::SObject_wrap groupSO = study->FindObjectID( _groupEntries[i] );
|
||||||
CORBA::Object_var groupObj;
|
CORBA::Object_var groupObj;
|
||||||
if ( !groupSO->_is_nil() )
|
if ( !groupSO->_is_nil() )
|
||||||
groupObj = groupSO->GetObject();
|
groupObj = groupSO->GetObject();
|
||||||
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
|
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
|
||||||
|
@ -97,11 +97,12 @@ void StdMeshers_ImportSource2D_i::SetSourceFaces(const SMESH::ListOfGroups& grou
|
|||||||
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION("Wrong group type", SALOME::BAD_PARAM);
|
||||||
smesh_groups.push_back( gp_i->GetSmeshGroup() );
|
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())
|
if ( !so->_is_nil())
|
||||||
{
|
{
|
||||||
CORBA::String_var entry = so->GetID();
|
CORBA::String_var entry = so->GetID();
|
||||||
entries.push_back( entry.in() );
|
entries.push_back( entry.in() );
|
||||||
|
so->UnRegister();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->GetImpl()->SetGroups( smesh_groups );
|
this->GetImpl()->SetGroups( smesh_groups );
|
||||||
@ -179,9 +180,11 @@ char* StdMeshers_ImportSource2D_i::SaveTo()
|
|||||||
|
|
||||||
// id
|
// id
|
||||||
SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
|
SALOMEDS::SObject_var groupSO = study->FindObjectID( _groupEntries[i] );
|
||||||
CORBA::Object_var groupObj;
|
CORBA::Object_var groupObj;
|
||||||
if ( !groupSO->_is_nil() )
|
if ( !groupSO->_is_nil() ) {
|
||||||
groupObj = groupSO->GetObject();
|
groupObj = groupSO->GetObject();
|
||||||
|
groupSO->UnRegister();
|
||||||
|
}
|
||||||
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
|
StdMeshers_ObjRefUlils::SaveToStream( groupObj, os );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,11 +88,16 @@ void StdMeshers_LayerDistribution_i::SetLayerDistribution(SMESH::SMESH_Hypothesi
|
|||||||
this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
|
this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
|
||||||
myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
|
myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
|
||||||
// Remove SO of 1D hypothesis if it was published
|
// 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::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() )
|
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
|
// Update Python script: write creation of 1D hyp as it is not published and
|
||||||
// for this, SMESH_Gen does not write it's creation
|
// for this, SMESH_Gen does not write it's creation
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
//
|
//
|
||||||
#include "StdMeshers_ObjRefUlils.hxx"
|
#include "StdMeshers_ObjRefUlils.hxx"
|
||||||
|
|
||||||
|
#include <SALOMEDS_wrap.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -60,8 +61,8 @@ StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject (const std::string& theEntry,
|
|||||||
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::Study_var study = gen->GetCurrentStudy();
|
||||||
if ( ! theEntry.empty() && ! study->_is_nil() ) {
|
if ( ! theEntry.empty() && ! study->_is_nil() ) {
|
||||||
SALOMEDS::SObject_var sobj= study->FindObjectID( theEntry.c_str() );
|
SALOMEDS::SObject_wrap sobj = study->FindObjectID( theEntry.c_str() );
|
||||||
CORBA::Object_var obj = gen->SObjectToObject( sobj );
|
CORBA::Object_var obj = gen->SObjectToObject( sobj );
|
||||||
geom = GEOM::GEOM_Object::_narrow( obj );
|
geom = GEOM::GEOM_Object::_narrow( obj );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,9 +88,10 @@ void StdMeshers_ObjRefUlils::SaveToStream( const TopoDS_Shape& theShape, ostream
|
|||||||
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
|
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
|
||||||
GEOM::GEOM_Object_var geom = gen->ShapeToGeomObject( theShape );
|
GEOM::GEOM_Object_var geom = gen->ShapeToGeomObject( theShape );
|
||||||
if ( ! geom->_is_nil() ) {
|
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() ) {
|
if ( !sobj->_is_nil() ) {
|
||||||
stream << " " << sobj->GetID();
|
CORBA::String_var entry = sobj->GetID();
|
||||||
|
stream << " " << entry.in();
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,9 +116,9 @@ TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream)
|
|||||||
if ( ! study->_is_nil() ) {
|
if ( ! study->_is_nil() ) {
|
||||||
string str;
|
string str;
|
||||||
if (stream >> str) {
|
if (stream >> str) {
|
||||||
SALOMEDS::SObject_var sobj= study->FindObjectID( str.c_str() );
|
SALOMEDS::SObject_wrap sobj = study->FindObjectID( str.c_str() );
|
||||||
CORBA::Object_var obj = gen->SObjectToObject( sobj );
|
CORBA::Object_var obj = gen->SObjectToObject( sobj );
|
||||||
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
|
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
|
||||||
return gen->GeomObjectToShape( geom.in() );
|
return gen->GeomObjectToShape( geom.in() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user