//
#include "SMESH_2smeshpy.hxx"
-#include "utilities.h"
#include "SMESH_PythonDump.hxx"
#include "SMESH_NoteBook.hxx"
#include "SMESH_Filter_i.hxx"
+#include <SALOMEDS_wrap.hxx>
+#include <utilities.h>
+
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
{
// find a GEOM entry
_pyID geomID;
- SALOMEDS::SComponent_var geomComp = theStudy->FindComponent("GEOM");
+ SALOMEDS::SComponent_wrap geomComp = theStudy->FindComponent("GEOM");
if ( geomComp->_is_nil() ) return;
CORBA::String_var entry = geomComp->GetID();
geomID = entry.in();
// either the SMESH object is not in study or it is a GEOM object
if ( IsGeomObject( theObjID ))
{
- SALOMEDS::SObject_var so = myStudy->FindObjectID( theObjID.ToCString() );
+ SALOMEDS::SObject_wrap so = myStudy->FindObjectID( theObjID.ToCString() );
if ( so->_is_nil() ) return true;
CORBA::Object_var obj = so->GetObject();
return CORBA::is_nil( obj );
// Module : SMESH
#include "SMESH_PythonDump.hxx"
-#include "SMESH_Gen_i.hxx"
+
+#include "SMESH_2smeshpy.hxx"
+#include "SMESH_Comment.hxx"
#include "SMESH_Filter_i.hxx"
+#include "SMESH_Gen_i.hxx"
#include "SMESH_MeshEditor_i.hxx"
-#include "SMESH_2smeshpy.hxx"
+
+#include <SALOMEDS_wrap.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
-#include <SMESH_Comment.hxx>
-
#ifdef _DEBUG_
static int MYDEBUG = 0;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
std::string aString = myStream.str();
TCollection_AsciiString aCollection(Standard_CString(aString.c_str()));
- SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
if(!aStudy->_is_nil() && !aCollection.IsEmpty()){
aSMESHGen->AddToPythonScript(aStudy->StudyId(),aCollection);
if(MYDEBUG) MESSAGE(aString);
TPythonDump::
operator<<(SALOMEDS::SObject_ptr aSObject)
{
- if ( !aSObject->_is_nil() )
- myStream << aSObject->GetID();
- else
+ if ( !aSObject->_is_nil() ) {
+ CORBA::String_var entry = aSObject->GetID();
+ myStream << entry.in();
+ }
+ else {
myStream << NotPublishedObjectName();
+ }
return *this;
}
TPythonDump::
operator<<(CORBA::Object_ptr theArg)
{
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
- SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
if(!aSObject->_is_nil()) {
CORBA::String_var id = aSObject->GetID();
myStream << id;
TPythonDump::
operator<<(SMESH::SMESH_Hypothesis_ptr theArg)
{
- SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+ SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
+ SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
if(aSObject->_is_nil() && !CORBA::is_nil(theArg))
myStream << "hyp_" << theArg->GetId();
else
{
if ( CORBA::is_nil( theArg ) )
return *this << "None";
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
- SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
if(!aSObject->_is_nil())
+ {
return *this << aSObject;
+ }
if ( SMESH::Filter_i* filter = SMESH::DownCast<SMESH::Filter_i*>( theArg ))
+ {
return *this << filter;
- SMESH::SMESH_Mesh_var mesh = theArg->GetMesh();
- if ( !theArg->_is_equivalent( mesh ))
+ }
+ if ( SMESH_MeshEditor_i::IsTemporaryIDSource( theArg ))
{
- SMESH::long_array_var anElementsId = theArg->GetIDs();
- SMESH::array_of_ElementType_var types = theArg->GetTypes();
+ SMESH::SMESH_Mesh_var mesh = theArg->GetMesh();
+ SMESH::long_array_var anElementsId = theArg->GetIDs();
+ SMESH::array_of_ElementType_var types = theArg->GetTypes();
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
}
if (CORBA::is_nil(aStudy))
return new Engines::TMPFile(0);
- SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType());
+ CORBA::String_var compDataType = ComponentDataType();
+ SALOMEDS::SObject_wrap aSO = aStudy->FindComponent( compDataType.in() );
if (CORBA::is_nil(aSO))
return new Engines::TMPFile(0);
Resource_DataMapOfAsciiStringAsciiString aMapNames;
//TCollection_AsciiString s ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
- SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
+ SALOMEDS::ChildIterator_wrap Itr = aStudy->NewChildIterator(aSO);
for (Itr->InitEx(true); Itr->More(); Itr->Next()) {
- SALOMEDS::SObject_var aValue = Itr->Value();
+ SALOMEDS::SObject_wrap aValue = Itr->Value();
CORBA::String_var anID = aValue->GetID();
CORBA::String_var aName = aValue->GetName();
TCollection_AsciiString aGUIName ( (char*) aName.in() );
}
// Get trace of restored study
- //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+ //SALOMEDS::SObject_wrap aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::GenericAttribute_wrap anAttr =
aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
- char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
- TCollection_AsciiString aSavedTrace (oldValue);
+ SALOMEDS::AttributePythonObject_var pyAttr =
+ SALOMEDS::AttributePythonObject::_narrow(anAttr);
+ CORBA::String_var oldValue = pyAttr->GetObject();
+ TCollection_AsciiString aSavedTrace (oldValue.out());
// Add trace of API methods calls and replace study entries by names
TCollection_AsciiString aScript;
TCollection_AsciiString aScript = GetNewPythonLines(theStudy->StudyId());
// Check contents of PythonObject attribute
- SALOMEDS::SObject_var aSO = theStudy->FindComponent(ComponentDataType());
- //SALOMEDS::SObject_var aSO = SMESH_Gen_i::ObjectToSObject(theStudy, _this());
+ CORBA::String_var compDataType = ComponentDataType();
+ SALOMEDS::SObject_wrap aSO = theStudy->FindComponent( compDataType.in() );
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::GenericAttribute_wrap anAttr =
aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePythonObject");
- char* oldValue = SALOMEDS::AttributePythonObject::_narrow(anAttr)->GetObject();
- TCollection_AsciiString oldScript (oldValue);
+ SALOMEDS::AttributePythonObject_var pyAttr =
+ SALOMEDS::AttributePythonObject::_narrow(anAttr);
+ CORBA::String_var oldValue = pyAttr->GetObject();
+ TCollection_AsciiString oldScript (oldValue.out());
if (oldScript.Length() > 0) {
oldScript += "\n";
}
// Store in PythonObject attribute
- SALOMEDS::AttributePythonObject::_narrow(anAttr)->SetObject(oldScript.ToCString(), 1);
+ pyAttr->SetObject(oldScript.ToCString(), 1);
// Clean trace of API methods calls
CleanPythonTrace(theStudy->StudyId());
isValidName = false;
}
// shorten names like CartesianParameters3D_400_400_400_1000000_1
- if ( aName.Length() > 20 && nbUnderscore > 2 )
+ const int nbAllowedUnderscore = 3; /* changed from 2 to 3 by an user request
+ posted to SALOME Forum */
+ if ( aName.Length() > 20 && nbUnderscore > nbAllowedUnderscore )
{
p = aName.Location( "_", 20, aName.Length());
if ( p > 1 )
*/
//=============================================================================
TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
- (SALOMEDS::Study_ptr theStudy,
+ (SALOMEDS::Study_ptr theStudy,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
Resource_DataMapOfAsciiStringAsciiString& theNames,
- bool isPublished,
- bool isMultiFile,
- bool isHistoricalDump,
- bool& aValidScript,
- const TCollection_AsciiString& theSavedTrace)
+ bool isPublished,
+ bool isMultiFile,
+ bool isHistoricalDump,
+ bool& aValidScript,
+ const TCollection_AsciiString& theSavedTrace)
{
int aStudyID = theStudy->StudyId();
if (isPublished)
{
//Output the script that sets up the visual parameters.
- char* script = theStudy->GetDefaultScript(ComponentDataType(), "\t");
+ CORBA::String_var compDataType = ComponentDataType();
+ char* script = theStudy->GetDefaultScript( compDataType.in(), "\t");
if (script && strlen(script) > 0) {
anUpdatedScript += "\n\n\t### Store presentation parameters of displayed objects\n";
anUpdatedScript += script;
//
#include "SMESH_Filter_i.hxx"
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_PythonDump.hxx"
-
+#include "SMDS_ElemIterator.hxx"
#include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
#include "SMDS_MeshElement.hxx"
-#include "SMDS_ElemIterator.hxx"
-
+#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include <SALOMEDS_wrap.hxx>
#include <BRep_Tool.hxx>
#include <Geom_CylindricalSurface.hxx>
{
CORBA::Object_var anObj = aList[ 0 ]->GetObject();
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( anObj );
- return aSMESHGen->GeomObjectToShape( aGeomObj );
+ TopoDS_Shape shape = aSMESHGen->GeomObjectToShape( aGeomObj );
+ SALOME::UnRegister( aList ); // UnRegister() objects in aList
+ return shape;
}
}
}
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+ SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
if ( !aSObj->_is_nil() ) {
CORBA::Object_var obj = aSObj->GetObject();
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj);
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+ SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
if ( !aSObj->_is_nil() ) {
CORBA::String_var name = aSObj->GetName();
return name.in();
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
+// helpers about SALOME::GenericObj
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+#include <GEOM_GenericObjPtr.h>
+
#include <map>
#include <fstream>
#include <cstdio>
CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject )
{
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::GenericAttribute_wrap anAttr;
CORBA::Object_var anObj;
if ( !theSObject->_is_nil() ) {
try {
- if( theSObject->FindAttribute( anAttr, "AttributeIOR" ) ) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr );
+ if( theSObject->FindAttribute( anAttr.inout(), "AttributeIOR" ) ) {
+ SALOMEDS::AttributeIOR_wrap anIOR = anAttr;
CORBA::String_var aValue = anIOR->Value();
if( strcmp( aValue, "" ) != 0 )
anObj = GetORB()->string_to_object( aValue );
- }
+ }
}
catch( ... ) {
INFOS( "SObjectToObject - Unknown exception was caught!!!" );
* Get GEOM::GEOM_Gen reference
*/
//=============================================================================
-GEOM::GEOM_Gen_ptr SMESH_Gen_i::GetGeomEngine() {
+GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine() {
//CCRT GEOM::GEOM_Gen_var aGeomEngine =
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
//CCRT return aGeomEngine._retn();
}
myStudyContextMap.clear();
// delete shape reader
- if ( !myShapeReader )
+ if ( myShapeReader )
delete myShapeReader;
}
myCurrentStudy = SALOMEDS::Study::_duplicate( theStudy );
// create study context, if it doesn't exist and set current study
int studyId = GetCurrentStudyID();
- if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() ) {
+ if ( myStudyContextMap.find( studyId ) == myStudyContextMap.end() )
myStudyContextMap[ studyId ] = new StudyContext;
- }
// myCurrentStudy may be nil
if ( !theStudyIsBeingClosed && !CORBA::is_nil( myCurrentStudy ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
- if( !myCurrentStudy->FindComponent( "GEOM" )->_is_nil() )
- aStudyBuilder->LoadWith( myCurrentStudy->FindComponent( "GEOM" ), GetGeomEngine() );
-
+ SALOMEDS::SComponent_wrap GEOM_var = myCurrentStudy->FindComponent( "GEOM" );
+ if( !GEOM_var->_is_nil() )
+ aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
// NPAL16168, issue 0020210
// Let meshes update their data depending on GEOM groups that could change
if ( curStudyId != studyId )
{
- //SALOMEDS::SComponent_var me = PublishComponent( myCurrentStudy );
- SALOMEDS::SComponent_var me = SALOMEDS::SComponent::_narrow
- ( myCurrentStudy->FindComponent( ComponentDataType() ) );
+ CORBA::String_var compDataType = ComponentDataType();
+ SALOMEDS::SComponent_wrap me = myCurrentStudy->FindComponent( compDataType.in() );
if ( !me->_is_nil() ) {
- SALOMEDS::ChildIterator_var anIter = myCurrentStudy->NewChildIterator( me );
+ SALOMEDS::ChildIterator_wrap anIter = myCurrentStudy->NewChildIterator( me );
for ( ; anIter->More(); anIter->Next() ) {
- SALOMEDS::SObject_var so = anIter->Value();
- CORBA::Object_var ior = SObjectToObject( so );
- if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
+ SALOMEDS::SObject_wrap so = anIter->Value();
+ CORBA::Object_var ior = SObjectToObject( so );
+ if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( ior ))
mesh->CheckGeomGroupModif();
}
}
// Publish hypothesis/algorithm in the study
if ( CanPublishInStudy( hyp ) ) {
- SALOMEDS::SObject_var aSO = PublishHypothesis( myCurrentStudy, hyp );
+ SALOMEDS::SObject_wrap aSO = PublishHypothesis( myCurrentStudy, hyp );
if ( !aSO->_is_nil() ) {
// Update Python script
TPythonDump() << aSO << " = " << this << ".CreateHypothesis('"
// check local shape
SMESH::ListOfHypothesis_var aHypList = theMesh->GetHypothesisList( theGeom );
int nbLocalHyps = aHypList->length();
- for ( int i = 0; i < nbLocalHyps; i++ )
- if ( strcmp( theHypType, aHypList[i]->GetName() ) == 0 ) // FOUND local!
+ for ( int i = 0; i < nbLocalHyps; i++ ) {
+ CORBA::String_var hypName = aHypList[i]->GetName();
+ if ( strcmp( theHypType, hypName.in() ) == 0 ) // FOUND local!
return SMESH::SMESH_Hypothesis::_duplicate( aHypList[i] );
+ }
// check super shapes
TopTools_ListIteratorOfListOfShape itShape( mesh->GetAncestors( shape ));
while ( nbLocalHyps == 0 && itShape.More() ) {
if ( CanPublishInStudy( mesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
- SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
+ SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
// Update Python script
if ( CanPublishInStudy( mesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
- SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, mesh.in() );
+ SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, mesh.in() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
// Update Python script
if ( CanPublishInStudy( aMesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
- SALOMEDS::SObject_var aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
+ SALOMEDS::SObject_wrap aSO = PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
// Update Python script
SMESH::SMESH_Mesh_var mesh = createMesh();
// publish mesh in the study
- SALOMEDS::SObject_var aSO;
+ SALOMEDS::SObject_wrap aSO;
if ( CanPublishInStudy( mesh ) )
aSO = PublishMesh( myCurrentStudy, mesh.in(), (*it).c_str() );
if ( !aSO->_is_nil() ) {
if ( CanPublishInStudy( aMesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
- SALOMEDS::SObject_var aSO = PublishInStudy
+ SALOMEDS::SObject_wrap aSO = PublishInStudy
( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
meshServant->GetImpl().GetMeshDS()->Modified();
// publish mesh in the study
- SALOMEDS::SObject_var aSO;
+ SALOMEDS::SObject_wrap aSO;
if ( CanPublishInStudy( mesh ) )
aSO = PublishMesh( myCurrentStudy, mesh.in(), meshName.c_str() );
// Python Dump
- if ( !aSO->_is_nil() )
+ if ( !aSO->_is_nil() ) {
aPythonDump << aSO;
- else
+ }
+ else {
aPythonDump << "mesh_" << i;
+ }
}
aStudyBuilder->CommitCommand();
}
if ( CanPublishInStudy( aMesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
- SALOMEDS::SObject_var aSO = PublishInStudy
+ SALOMEDS::SObject_wrap aSO = PublishInStudy
( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
if ( algo ) {
if ( !myCurrentStudy->_is_nil() ) {
// find algo in the study
- SALOMEDS::SComponent_var father = SALOMEDS::SComponent::_narrow
- ( myCurrentStudy->FindComponent( ComponentDataType() ) );
+ CORBA::String_var compDataType = ComponentDataType();
+ SALOMEDS::SComponent_wrap father = myCurrentStudy->FindComponent( compDataType.in() );
if ( !father->_is_nil() ) {
- SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( father );
+ SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( father );
for ( ; itBig->More(); itBig->Next() ) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
+ SALOMEDS::SObject_wrap gotBranch = itBig->Value();
if ( gotBranch->Tag() == GetAlgorithmsRootTag() ) {
- SALOMEDS::ChildIterator_var algoIt = myCurrentStudy->NewChildIterator( gotBranch );
+ SALOMEDS::ChildIterator_wrap algoIt = myCurrentStudy->NewChildIterator( gotBranch );
for ( ; algoIt->More(); algoIt->Next() ) {
- SALOMEDS::SObject_var algoSO = algoIt->Value();
+ SALOMEDS::SObject_wrap algoSO = algoIt->Value();
CORBA::Object_var algoIOR = SObjectToObject( algoSO );
if ( !CORBA::is_nil( algoIOR )) {
SMESH_Hypothesis_i* impl = SMESH::DownCast<SMESH_Hypothesis_i*>( algoIOR );
errStruct.code = -( error->myName < 0 ? error->myName + 1: error->myName ); // -1 -> 0
errStruct.comment = error->myComment.c_str();
errStruct.subShapeID = sm->GetId();
- SALOMEDS::SObject_var algoSO = GetAlgoSO( error->myAlgo );
- if ( !algoSO->_is_nil() )
- errStruct.algoName = algoSO->GetName();
- else
+ SALOMEDS::SObject_wrap algoSO = GetAlgoSO( error->myAlgo );
+ if ( !algoSO->_is_nil() ) {
+ CORBA::String_var algoName = algoSO->GetName();
+ errStruct.algoName = algoName;
+ }
+ else {
errStruct.algoName = error->myAlgo->GetName();
+ }
errStruct.hasBadMesh = !error->myBadElements.empty();
}
}
errStruct.algoDim = error->_algoDim;
errStruct.isGlobalAlgo = error->_isGlobalAlgo;
errStruct.algoName = "";
- SALOMEDS::SObject_var algoSO = GetAlgoSO( error->_algo );
- if ( !algoSO->_is_nil() )
- errStruct.algoName = algoSO->GetName();
+ SALOMEDS::SObject_wrap algoSO = GetAlgoSO( error->_algo );
+ if ( !algoSO->_is_nil() ) {
+ CORBA::String_var algoName = algoSO->GetName();
+ errStruct.algoName = algoName.in();
+ }
}
}
}
* \param theMesh - the mesh the element is in
* \param theElementID - the element ID
* \param theGeomName - the name of the result geom object if it is not yet published
- * \retval GEOM::GEOM_Object_ptr - the found or just published geom object
+ * \retval GEOM::GEOM_Object_ptr - the found or just published geom object (no need to UnRegister())
*/
//================================================================================
{
Unexpect aCatch(SALOME_SalomeException);
- GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID);
+ GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine();
// try to find the corresponding SObject
- SALOMEDS::SObject_var SObj = ObjectToSObject( myCurrentStudy, geom.in() );
+ SALOMEDS::SObject_wrap SObj = ObjectToSObject( myCurrentStudy, geom.in() );
if ( SObj->_is_nil() ) // submesh can be not found even if published
{
// try to find published submesh
GEOM::ListOfLong_var list = geom->GetSubShapeIndices();
if ( !geom->IsMainShape() && list->length() == 1 ) {
- SALOMEDS::SObject_var mainSO = ObjectToSObject( myCurrentStudy, mainShape );
- SALOMEDS::ChildIterator_var it;
- if ( !mainSO->_is_nil() )
+ SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+ SALOMEDS::ChildIterator_wrap it;
+ if ( !mainSO->_is_nil() ) {
it = myCurrentStudy->NewChildIterator( mainSO );
+ }
if ( !it->_is_nil() ) {
- for ( it->InitEx(true); SObj->_is_nil() && it->More(); it->Next() ) {
- GEOM::GEOM_Object_var subGeom =
- GEOM::GEOM_Object::_narrow( SObjectToObject( it->Value() ));
+ for ( it->InitEx(true); it->More(); it->Next() ) {
+ SALOMEDS::SObject_wrap so = it->Value();
+ CORBA::Object_var obj = SObjectToObject( so );
+ GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
if ( !subGeom->_is_nil() ) {
GEOM::ListOfLong_var subList = subGeom->GetSubShapeIndices();
if ( subList->length() == 1 && list[0] == subList[0] ) {
- SObj = it->Value();
+ SObj = so;
geom = subGeom;
+ break;
}
}
}
SObj = geomGen->AddInStudy( myCurrentStudy, geom, theGeomName, mainShape );
// return only published geometry
- if ( !SObj->_is_nil() )
- return geom._retn();
+ if ( !SObj->_is_nil() ) {
+ //return geom._retn(); -- servant of geom must be UnRegister()ed;
+ CORBA::Object_var obj = SObjectToObject( SObj );
+ GEOM::GEOM_Object_var go = GEOM::GEOM_Object::_narrow( obj );
+ return go._retn();
+ }
}
return GEOM::GEOM_Object::_nil();
}
* \brief Return geometrical object the given element is built on.
* \param theMesh - the mesh the element is in
* \param theElementID - the element ID
- * \retval GEOM::GEOM_Object_ptr - the found geom object
+ * \retval GEOM::GEOM_Object_ptr - the found or created (UnRegister()!) geom object
*/
//================================================================================
GEOM::GEOM_Object_var geom = ShapeToGeomObject( meshDS->IndexToShape( shapeID ));
if ( geom->_is_nil() ) {
// try to find a published sub-shape
- SALOMEDS::SObject_var mainSO = ObjectToSObject( myCurrentStudy, mainShape );
- SALOMEDS::ChildIterator_var it;
- if ( !mainSO->_is_nil() )
+ SALOMEDS::SObject_wrap mainSO = ObjectToSObject( myCurrentStudy, mainShape );
+ SALOMEDS::ChildIterator_wrap it;
+ if ( !mainSO->_is_nil() ) {
it = myCurrentStudy->NewChildIterator( mainSO );
+ }
if ( !it->_is_nil() ) {
for ( it->InitEx(true); it->More(); it->Next() ) {
- GEOM::GEOM_Object_var subGeom =
- GEOM::GEOM_Object::_narrow( SObjectToObject( it->Value() ));
+ SALOMEDS::SObject_wrap so = it->Value();
+ CORBA::Object_var obj = SObjectToObject( so );
+ GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
if ( !subGeom->_is_nil() ) {
GEOM::ListOfLong_var subList = subGeom->GetSubShapeIndices();
if ( subList->length() == 1 && shapeID == subList[0] ) {
}
if ( geom->_is_nil() ) {
// explode
- GEOM::GEOM_IShapesOperations_var op =
- geomGen->GetIShapesOperations( GetCurrentStudyID() );
+ GEOM::ShapesOpPtr op = geomGen->GetIShapesOperations( GetCurrentStudyID() );
if ( !op->_is_nil() )
geom = op->GetSubShape( mainShape, shapeID );
}
+ else {
+ geom->Register();
+ }
if ( !geom->_is_nil() ) {
GeomObjectToShape( geom ); // let geom client remember the found shape
return geom._retn();
if ( theCommonGroups ) {
for(aGroupType=SMESH::NODE;aGroupType<=SMESH::BALL;aGroupType=(SMESH::ElementType)(aGroupType+1)) {
string str = "Gr";
- SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
+ SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, anInitMesh );
if(aMeshSObj)
str += aMeshSObj->GetName();
str += "_";
}
// IPAL21468 Change icon of compound because it need not be computed.
- SALOMEDS::SObject_var aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
+ SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, aNewMesh );
SetPixMap( aMeshSObj, "ICON_SMESH_TREE_MESH" );
if (aNewMeshDS)
SMESH_Mesh_i* newMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( newMesh );
if ( !newMesh_i )
THROW_SALOME_CORBA_EXCEPTION( "can't create a mesh", SALOME::INTERNAL_ERROR );
- SALOMEDS::SObject_var meshSO = ObjectToSObject(myCurrentStudy, newMesh );
+ SALOMEDS::SObject_wrap meshSO = ObjectToSObject(myCurrentStudy, newMesh );
if ( !meshSO->_is_nil() )
{
SetName( meshSO, meshName, "Mesh" );
// SetStoreName() to groups before storing hypotheses to let them refer to
// groups using "store name", which is "Group <group_persistent_id>"
{
- SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( theComponent );
+ SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
for ( ; itBig->More(); itBig->Next() ) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
+ SALOMEDS::SObject_wrap gotBranch = itBig->Value();
if ( gotBranch->Tag() > GetAlgorithmsRootTag() ) {
CORBA::Object_var anObject = SObjectToObject( gotBranch );
if ( !CORBA::is_nil( anObject ) ) {
aFile->CreateOnDisk();
// --> iterator for top-level objects
- SALOMEDS::ChildIterator_var itBig = myCurrentStudy->NewChildIterator( theComponent );
+ SALOMEDS::ChildIterator_wrap itBig = myCurrentStudy->NewChildIterator( theComponent );
for ( ; itBig->More(); itBig->Next() ) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
+ SALOMEDS::SObject_wrap gotBranch = itBig->Value();
// --> hypotheses root branch (only one for the study)
if ( gotBranch->Tag() == GetHypothesisRootTag() ) {
aTopGroup->CreateOnDisk();
// iterator for all hypotheses
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( gotBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
+ SALOMEDS::SObject_wrap mySObject = it->Value();
CORBA::Object_var anObject = SObjectToObject( mySObject );
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
aTopGroup->CreateOnDisk();
// iterator for all algorithms
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( gotBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( gotBranch );
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
+ SALOMEDS::SObject_wrap mySObject = it->Value();
CORBA::Object_var anObject = SObjectToObject( mySObject );
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
aDataset->CloseOnDisk();
// write reference on a shape if exists
- SALOMEDS::SObject_var myRef;
+ SALOMEDS::SObject_wrap myRef;
bool shapeRefFound = false;
- bool found = gotBranch->FindSubObject( GetRefOnShapeTag(), myRef );
+ bool found = gotBranch->FindSubObject( GetRefOnShapeTag(), myRef.inout() );
if ( found ) {
- SALOMEDS::SObject_var myShape;
- bool ok = myRef->ReferencedObject( myShape );
+ SALOMEDS::SObject_wrap myShape;
+ bool ok = myRef->ReferencedObject( myShape.inout() );
if ( ok ) {
shapeRefFound = (! CORBA::is_nil( myShape->GetObject() ));
string myRefOnObject = myShape->GetID();
}
// write applied hypotheses if exist
- SALOMEDS::SObject_var myHypBranch;
- found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch );
+ SALOMEDS::SObject_wrap myHypBranch;
+ found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch.inout() );
if ( found && !shapeRefFound && hasShape) { // remove applied hyps
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
}
aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
aGroup->CreateOnDisk();
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myHypBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myHypBranch );
int hypNb = 0;
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
- SALOMEDS::SObject_var myRefOnHyp;
- bool ok = mySObject->ReferencedObject( myRefOnHyp );
+ SALOMEDS::SObject_wrap mySObject = it->Value();
+ SALOMEDS::SObject_wrap myRefOnHyp;
+ bool ok = mySObject->ReferencedObject( myRefOnHyp.inout() );
if ( ok ) {
// san - it is impossible to recover applied hypotheses
// using their entries within Load() method,
}
// write applied algorithms if exist
- SALOMEDS::SObject_var myAlgoBranch;
- found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(), myAlgoBranch );
+ SALOMEDS::SObject_wrap myAlgoBranch;
+ found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(),
+ myAlgoBranch.inout() );
if ( found && !shapeRefFound && hasShape) { // remove applied algos
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
}
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
aGroup->CreateOnDisk();
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myAlgoBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myAlgoBranch );
int algoNb = 0;
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
- SALOMEDS::SObject_var myRefOnAlgo;
- bool ok = mySObject->ReferencedObject( myRefOnAlgo );
+ SALOMEDS::SObject_wrap mySObject = it->Value();
+ SALOMEDS::SObject_wrap myRefOnAlgo;
+ bool ok = mySObject->ReferencedObject( myRefOnAlgo.inout() );
if ( ok ) {
// san - it is impossible to recover applied algorithms
// using their entries within Load() method,
// --> submesh objects sub-branches
for ( int i = GetSubMeshOnVertexTag(); i <= GetSubMeshOnCompoundTag(); i++ ) {
- SALOMEDS::SObject_var mySubmeshBranch;
- found = gotBranch->FindSubObject( i, mySubmeshBranch );
+ SALOMEDS::SObject_wrap mySubmeshBranch;
+ found = gotBranch->FindSubObject( i, mySubmeshBranch.inout() );
if ( found ) // check if there is shape reference in submeshes
{
bool hasShapeRef = false;
- SALOMEDS::ChildIterator_var itSM =
+ SALOMEDS::ChildIterator_wrap itSM =
myCurrentStudy->NewChildIterator( mySubmeshBranch );
for ( ; itSM->More(); itSM->Next() ) {
- SALOMEDS::SObject_var mySubRef, myShape, mySObject = itSM->Value();
- if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ))
- mySubRef->ReferencedObject( myShape );
+ SALOMEDS::SObject_wrap mySubRef, myShape, mySObject = itSM->Value();
+ if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ))
+ mySubRef->ReferencedObject( myShape.inout() );
if ( !CORBA::is_nil( myShape ) && !CORBA::is_nil( myShape->GetObject() ))
hasShapeRef = true;
else
aGroup->CreateOnDisk();
// iterator for all submeshes of given type
- SALOMEDS::ChildIterator_var itSM = myCurrentStudy->NewChildIterator( mySubmeshBranch );
+ SALOMEDS::ChildIterator_wrap itSM = myCurrentStudy->NewChildIterator( mySubmeshBranch );
for ( ; itSM->More(); itSM->Next() ) {
- SALOMEDS::SObject_var mySObject = itSM->Value();
+ SALOMEDS::SObject_wrap mySObject = itSM->Value();
CORBA::Object_var anSubObject = SObjectToObject( mySObject );
if ( !CORBA::is_nil( anSubObject ))
{
aSubGroup->CreateOnDisk();
// write reference on a shape, already checked if it exists
- SALOMEDS::SObject_var mySubRef, myShape;
- if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ))
- mySubRef->ReferencedObject( myShape );
+ SALOMEDS::SObject_wrap mySubRef, myShape;
+ if ( mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ))
+ mySubRef->ReferencedObject( myShape.inout() );
string myRefOnObject = myShape->GetID();
if ( myRefOnObject.length() > 0 ) {
aSize[ 0 ] = myRefOnObject.length() + 1;
}
// write applied hypotheses if exist
- SALOMEDS::SObject_var mySubHypBranch;
- found = mySObject->FindSubObject( GetRefOnAppliedHypothesisTag(), mySubHypBranch );
+ SALOMEDS::SObject_wrap mySubHypBranch;
+ found = mySObject->FindSubObject( GetRefOnAppliedHypothesisTag(),
+ mySubHypBranch.inout() );
if ( found ) {
aSubSubGroup = new HDFgroup( "Applied Hypotheses", aSubGroup );
aSubSubGroup->CreateOnDisk();
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( mySubHypBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( mySubHypBranch );
int hypNb = 0;
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySubSObject = it->Value();
- SALOMEDS::SObject_var myRefOnHyp;
- bool ok = mySubSObject->ReferencedObject( myRefOnHyp );
+ SALOMEDS::SObject_wrap mySubSObject = it->Value();
+ SALOMEDS::SObject_wrap myRefOnHyp;
+ bool ok = mySubSObject->ReferencedObject( myRefOnHyp.inout() );
if ( ok ) {
//string myRefOnObject = myRefOnHyp->GetID();
CORBA::Object_var anObject = SObjectToObject( myRefOnHyp );
}
// write applied algorithms if exist
- SALOMEDS::SObject_var mySubAlgoBranch;
- found = mySObject->FindSubObject( GetRefOnAppliedAlgorithmsTag(), mySubAlgoBranch );
+ SALOMEDS::SObject_wrap mySubAlgoBranch;
+ found = mySObject->FindSubObject( GetRefOnAppliedAlgorithmsTag(),
+ mySubAlgoBranch.inout() );
if ( found ) {
aSubSubGroup = new HDFgroup( "Applied Algorithms", aSubGroup );
aSubSubGroup->CreateOnDisk();
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( mySubAlgoBranch );
+ SALOMEDS::ChildIterator_wrap it =
+ myCurrentStudy->NewChildIterator( mySubAlgoBranch );
int algoNb = 0;
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySubSObject = it->Value();
- SALOMEDS::SObject_var myRefOnAlgo;
- bool ok = mySubSObject->ReferencedObject( myRefOnAlgo );
+ SALOMEDS::SObject_wrap mySubSObject = it->Value();
+ SALOMEDS::SObject_wrap myRefOnAlgo;
+ bool ok = mySubSObject->ReferencedObject( myRefOnAlgo.inout() );
if ( ok ) {
//string myRefOnObject = myRefOnAlgo->GetID();
CORBA::Object_var anObject = SObjectToObject( myRefOnAlgo );
}
// groups root sub-branch
- SALOMEDS::SObject_var myGroupsBranch;
+ SALOMEDS::SObject_wrap myGroupsBranch;
for ( int i = GetNodeGroupsTag(); i <= GetBallElementsGroupsTag(); i++ ) {
- found = gotBranch->FindSubObject( i, myGroupsBranch );
+ found = gotBranch->FindSubObject( i, myGroupsBranch.inout() );
if ( found ) {
char name_group[ 30 ];
if ( i == GetNodeGroupsTag() )
aGroup = new HDFgroup( name_group, aTopGroup );
aGroup->CreateOnDisk();
- SALOMEDS::ChildIterator_var it = myCurrentStudy->NewChildIterator( myGroupsBranch );
+ SALOMEDS::ChildIterator_wrap it = myCurrentStudy->NewChildIterator( myGroupsBranch );
for ( ; it->More(); it->Next() ) {
- SALOMEDS::SObject_var mySObject = it->Value();
+ SALOMEDS::SObject_wrap mySObject = it->Value();
CORBA::Object_var aSubObject = SObjectToObject( mySObject );
if ( !CORBA::is_nil( aSubObject ) ) {
SMESH_GroupBase_i* myGroupImpl =
SMESHDS_GroupOnGeom* aGeomGrp =
dynamic_cast<SMESHDS_GroupOnGeom*>( aGrpBaseDS );
if ( aGeomGrp ) {
- SALOMEDS::SObject_var mySubRef, myShape;
- if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef ) &&
- mySubRef->ReferencedObject( myShape ) &&
+ SALOMEDS::SObject_wrap mySubRef, myShape;
+ if (mySObject->FindSubObject( GetRefOnShapeTag(), mySubRef.inout() ) &&
+ mySubRef->ReferencedObject( myShape.inout() ) &&
!CORBA::is_nil( myShape->GetObject() ))
{
string myRefOnObject = myShape->GetID();
TCollection_AsciiString tmpDir =
isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str();
- INFOS( "THE URL++++++++++++++" )
- INFOS( theURL );
- INFOS( "THE TMP PATH+++++++++" );
- INFOS( tmpDir );
+ INFOS( "THE URL++++++++++++++" );
+ INFOS( theURL );
+ INFOS( "THE TMP PATH+++++++++" );
+ INFOS( tmpDir );
// Convert the stream into sequence of files to process
SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream,
if ( myImpl ) {
// myImpl->LoadFrom( hypdata.c_str() );
hypDataList.push_back( make_pair( myImpl, hypdata ));
- string iorString = GetORB()->object_to_string( myHyp );
- int newId = myStudyContext->findId( iorString );
+ CORBA::String_var iorString = GetORB()->object_to_string( myHyp );
+ int newId = myStudyContext->findId( iorString.in() );
myStudyContext->mapOldToNew( id, newId );
}
else
if ( myImpl ) {
//myImpl->LoadFrom( hypdata.c_str() );
hypDataList.push_back( make_pair( myImpl, hypdata ));
- string iorString = GetORB()->object_to_string( myHyp );
- int newId = myStudyContext->findId( iorString );
+ CORBA::String_var iorString = GetORB()->object_to_string( myHyp );
+ int newId = myStudyContext->findId( iorString.in() );
myStudyContext->mapOldToNew( id, newId );
}
else
continue;
meshGroupList.push_back( make_pair( myNewMeshImpl, aTopGroup ));
- string iorString = GetORB()->object_to_string( myNewMesh );
- int newId = myStudyContext->findId( iorString );
+ CORBA::String_var iorString = GetORB()->object_to_string( myNewMesh );
+ int newId = myStudyContext->findId( iorString.in() );
myStudyContext->mapOldToNew( id, newId );
// ouv : NPAL12872
aDataset->ReadFromDisk( anAutoColor );
aDataset->CloseOnDisk();
myNewMeshImpl->GetImpl().SetAutoColor( (bool)anAutoColor[0] );
+ delete [] anAutoColor;
}
// try to read and set reference to shape
aDataset->ReadFromDisk( refFromFile );
aDataset->CloseOnDisk();
if ( strlen( refFromFile ) > 0 ) {
- SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+ SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
// Make sure GEOM data are loaded first
//loadGeomData( shapeSO->GetFatherComponent() );
myNewMeshImpl->SetShape( aShapeObject );
}
}
+ delete [] refFromFile;
}
// issue 20918. Restore Persistent Id of SMESHDS_Mesh
aDataset->ReadFromDisk( meshPersistentId );
aDataset->CloseOnDisk();
myNewMeshImpl->GetImpl().GetMeshDS()->SetPersistentId( *meshPersistentId );
+ delete [] meshPersistentId;
}
}
}
bool hasData = false;
// get mesh old id
- string iorString = GetORB()->object_to_string( myNewMeshImpl->_this() );
- int newId = myStudyContext->findId( iorString );
+ CORBA::String_var iorString = GetORB()->object_to_string( myNewMeshImpl->_this() );
+ int newId = myStudyContext->findId( iorString.in() );
int id = myStudyContext->getOldId( newId );
// try to find mesh data dataset
// myReader.Perform();
hasData = true;
}
+ delete [] strHasData;
}
// Try to get applied ALGORITHMS (mesh is not cleared by algo addition because
aDataset->ReadFromDisk( refFromFile );
aDataset->CloseOnDisk();
// san - it is impossible to recover applied algorithms using their entries within Load() method
- //SALOMEDS::SObject_var hypSO = myCurrentStudy->FindObjectID( refFromFile );
+ //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
//CORBA::Object_var hypObject = SObjectToObject( hypSO );
int id = atoi( refFromFile );
+ delete [] refFromFile;
string anIOR = myStudyContext->getIORbyOldId( id );
if ( !anIOR.empty() ) {
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
aDataset->ReadFromDisk( refFromFile );
aDataset->CloseOnDisk();
// san - it is impossible to recover applied hypotheses using their entries within Load() method
- //SALOMEDS::SObject_var hypSO = myCurrentStudy->FindObjectID( refFromFile );
+ //SALOMEDS::SObject_wrap hypSO = myCurrentStudy->FindObjectID( refFromFile );
//CORBA::Object_var hypObject = SObjectToObject( hypSO );
int id = atoi( refFromFile );
+ delete [] refFromFile;
string anIOR = myStudyContext->getIORbyOldId( id );
if ( !anIOR.empty() ) {
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
aDataset->ReadFromDisk( refFromFile );
aDataset->CloseOnDisk();
if ( strlen( refFromFile ) > 0 ) {
- SALOMEDS::SObject_var subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
+ SALOMEDS::SObject_wrap subShapeSO = myCurrentStudy->FindObjectID( refFromFile );
CORBA::Object_var subShapeObject = SObjectToObject( subShapeSO );
if ( !CORBA::is_nil( subShapeObject ) ) {
aSubShapeObject = GEOM::GEOM_Object::_narrow( subShapeObject );
aDataset->ReadFromDisk( refFromFile );
aDataset->CloseOnDisk();
if ( strlen( refFromFile ) > 0 ) {
- SALOMEDS::SObject_var shapeSO = myCurrentStudy->FindObjectID( refFromFile );
+ SALOMEDS::SObject_wrap shapeSO = myCurrentStudy->FindObjectID( refFromFile );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
if ( !CORBA::is_nil( shapeObject ) ) {
aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
continue;
string iorSubString = GetORB()->object_to_string( aNewGroup );
- int newSubId = myStudyContext->findId( iorSubString );
+ int newSubId = myStudyContext->findId( iorSubString );
myStudyContext->mapOldToNew( subid, newSubId );
SMESH_GroupBase_i* aGroupImpl = SMESH::DownCast< SMESH_GroupBase_i*>( aNewGroup );
myStudyContextMap.erase( studyId );
}
- // delete SMESH_Mesh's
-// See bug IPAL19437.
-//
-// StudyContextStruct* context = myGen.GetStudyContext( studyId );
-// map< int, SMESH_Mesh* >::iterator i_mesh = context->mapMesh.begin();
-// for ( ; i_mesh != context->mapMesh.end(); ++i_mesh ) {
-// printf( "--------------------------- SMESH_Gen_i::Close, delete aGroup = %p \n", i_mesh->second );
-// delete i_mesh->second;
-// }
-
-
- // delete SMESHDS_Mesh's
- // it's too long on big meshes
-// if ( context->myDocument ) {
-// delete context->myDocument;
-// context->myDocument = 0;
-// }
-
// remove the tmp files meshes are loaded from
SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
{
if ( theIOR && strcmp( theIOR, "" ) ) {
CORBA::Object_var anObject = GetORB()->string_to_object( theIOR );
- SALOMEDS::SObject_var aSO = ObjectToSObject( myCurrentStudy, anObject );
+ SALOMEDS::SObject_wrap aSO = ObjectToSObject( myCurrentStudy, anObject );
if ( !aSO->_is_nil() ) {
SetName( aSO, theName );
}
// Get SALOME_LifeCycleCORBA object
static SALOME_LifeCycleCORBA* GetLCC();
// Retrieve and get GEOM engine reference
- static GEOM::GEOM_Gen_ptr GetGeomEngine();
+ static GEOM::GEOM_Gen_var GetGeomEngine();
// Get object of the CORBA reference
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
// Get CORBA object corresponding to the SALOMEDS::SObject
#include "SMESH_Gen_i.hxx"
-#include "SMESH_Mesh_i.hxx"
-#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_Algo_i.hxx"
+#include "SMESH_Comment.hxx"
#include "SMESH_Group_i.hxx"
+#include "SMESH_Hypothesis_i.hxx"
+#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
-#include "utilities.h"
-#include "Utils_ExceptHandlers.hxx"
+#include <utilities.h>
+#include <Utils_ExceptHandlers.hxx>
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Solid.hxx>
//=======================================================================
//function : ObjectToSObject
-//purpose :
+//purpose : Put a result into a SALOMEDS::SObject_wrap or call UnRegister()!
//=======================================================================
SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(SALOMEDS::Study_ptr theStudy,
CORBA::Object_ptr theObject)
{
- SALOMEDS::SObject_var aSO;
+ SALOMEDS::SObject_wrap aSO;
if ( !CORBA::is_nil( theStudy ) && !CORBA::is_nil( theObject ))
{
CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theObject );
const char* thePixMap = 0,
const bool theSelectable = true)
{
- SALOMEDS::SObject_var SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
+ SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
if ( SO->_is_nil() ) {
if ( theTag == 0 )
SO = aStudyBuilder->NewObject( theFatherObject );
- else if ( !theFatherObject->FindSubObject( theTag, SO ))
+ else if ( !theFatherObject->FindSubObject( theTag, SO.inout() ))
SO = aStudyBuilder->NewObjectToTag( theFatherObject, theTag );
}
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::GenericAttribute_wrap anAttr;
if ( !CORBA::is_nil( theIOR )) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" );
CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
- SALOMEDS::AttributeIOR::_narrow(anAttr)->SetValue( objStr.in() );
+ SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
+ iorAttr->SetValue( objStr.in() );
}
if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
- SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ SALOMEDS::AttributePixMap_wrap pm = anAttr;
pm->SetPixMap( thePixMap );
}
if ( !theSelectable ) {
- anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
- SALOMEDS::AttributeSelectable::_narrow( anAttr )->SetSelectable( false );
+ anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
+ SALOMEDS::AttributeSelectable_wrap selAttr = anAttr;
+ selAttr->SetSelectable( false );
}
+
return SO._retn();
}
const char* theDefaultName)
{
if ( !theSObject->_is_nil() ) {
- SALOMEDS::StudyBuilder_var aStudyBuilder = theSObject->GetStudy()->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_wrap anAttr =
aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributeName" );
- SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
+ SALOMEDS::AttributeName_wrap aNameAttr = anAttr;
if ( theName && strlen( theName ) != 0 )
aNameAttr->SetValue( theName );
else {
- CORBA::String_var curName = CORBA::string_dup( aNameAttr->Value() );
- if ( strlen( curName ) == 0 ) {
- TCollection_AsciiString aName( (char*) theDefaultName );
- aName += TCollection_AsciiString("_") + TCollection_AsciiString( theSObject->Tag() );
- aNameAttr->SetValue( aName.ToCString() );
+ CORBA::String_var curName = aNameAttr->Value();
+ if ( strlen( curName.in() ) == 0 ) {
+ SMESH_Comment aName(theDefaultName);
+ aNameAttr->SetValue( ( aName<< "_" << theSObject->Tag()).c_str() );
}
}
}
{
if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap ))
{
- SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::GenericAttribute_wrap anAttr =
aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributePixMap" );
- SALOMEDS::AttributePixMap_var aPMAttr = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ SALOMEDS::AttributePixMap_wrap aPMAttr = anAttr;
aPMAttr->SetPixMap( thePixMap );
}
}
CORBA::Object_ptr theToObject,
int theTag = 0)
{
- SALOMEDS::SObject_var aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject );
+ SALOMEDS::SObject_wrap aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject );
if ( !aToObjSO->_is_nil() && !theSObject->_is_nil() ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
- SALOMEDS::SObject_var aReferenceSO;
+ SALOMEDS::SObject_wrap aReferenceSO;
if ( !theTag ) {
// check if the reference to theToObject already exists
// and find a free label for the reference object
bool isReferred = false;
int tag = 1;
- SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator( theSObject );
+ SALOMEDS::ChildIterator_wrap anIter = theStudy->NewChildIterator( theSObject );
for ( ; !isReferred && anIter->More(); anIter->Next(), ++tag ) {
- if ( anIter->Value()->ReferencedObject( aReferenceSO )) {
- if ( strcmp( aReferenceSO->GetID(), aToObjSO->GetID() ) == 0 )
+ SALOMEDS::SObject_wrap curSO = anIter->Value();
+ if ( curSO->ReferencedObject( aReferenceSO.inout() )) {
+ CORBA::String_var refEntry = aReferenceSO->GetID();
+ CORBA::String_var toEntry = aToObjSO->GetID();
+ if ( strcmp( refEntry, toEntry ) == 0 )
isReferred = true;
}
else if ( !theTag ) {
- SALOMEDS::GenericAttribute_var anAttr;
- if ( !anIter->Value()->FindAttribute( anAttr, "AttributeIOR" ))
+ SALOMEDS::GenericAttribute_wrap anAttr;
+ if ( !curSO->FindAttribute( anAttr.inout(), "AttributeIOR" ))
theTag = tag;
}
}
if ( !theTag )
theTag = tag;
}
- if ( !theSObject->FindSubObject( theTag, aReferenceSO ))
+ if ( !theSObject->FindSubObject( theTag, aReferenceSO.inout() ))
aReferenceSO = aStudyBuilder->NewObjectToTag( theSObject, theTag );
aStudyBuilder->Addreference( aReferenceSO, aToObjSO );
}
throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
- SALOMEDS::SObject_var aSO;
+ SALOMEDS::SObject_wrap aSO;
if ( CORBA::is_nil( theStudy ) || CORBA::is_nil( theIOR ))
return aSO._retn();
if(MYDEBUG) MESSAGE("PublishInStudy");
return SALOMEDS::SComponent::_nil();
if(MYDEBUG) MESSAGE("PublishComponent");
- SALOMEDS::SComponent_var father =
- SALOMEDS::SComponent::_narrow( theStudy->FindComponent( ComponentDataType() ) );
+ CORBA::String_var compDataType = ComponentDataType();
+ SALOMEDS::SComponent_wrap father = theStudy->FindComponent( compDataType.in() );
if ( !CORBA::is_nil( father ) )
return father._retn();
if ( CORBA::is_nil( aCat ) )
return father._retn();
- SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( ComponentDataType() );
+ SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.in() );
if ( CORBA::is_nil( aComp ) )
return father._retn();
- SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributePixMap_var aPixmap;
+ SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_wrap anAttr;
+ SALOMEDS::AttributePixMap_wrap aPixmap;
- father = aStudyBuilder->NewComponent( ComponentDataType() );
+ father = aStudyBuilder->NewComponent( compDataType.in() );
aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() );
anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" );
- aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr );
- aPixmap ->SetPixMap( "ICON_OBJBROWSER_SMESH" );
- SetName( father, aComp->componentusername(), "MESH" );
+ aPixmap = anAttr;
+ aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
+ CORBA::String_var userName = aComp->componentusername();
+ SetName( father, userName.in(), "MESH" );
if(MYDEBUG) MESSAGE("PublishComponent--END");
return father._retn();
if ( !theSObject->_is_nil() ) {
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( theSObject );
+ SALOMEDS::ChildIterator_wrap anIter = aStudy->NewChildIterator( theSObject );
for ( ; anIter->More(); anIter->Next() ) {
- long nTag = anIter->Value()->Tag();
+ SALOMEDS::SObject_wrap anSO = anIter->Value();
+ long nTag = anSO->Tag();
if ( nTag > aTag )
aTag = nTag;
}
// find or publish a mesh
- SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+ SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
if ( aMeshSO->_is_nil() )
{
- SALOMEDS::SComponent_var father = PublishComponent( theStudy );
+ SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
if ( father->_is_nil() )
return aMeshSO._retn();
// Publish global hypotheses
SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject );
- for ( int i = 0; i < hypList->length(); i++ ) {
+ for ( int i = 0; i < hypList->length(); i++ )
+ {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
- PublishHypothesis( theStudy, aHyp );
+ SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp );
}
}
SMESH::SMESH_subMesh_ptr aSubMesh = (*subIt).second->_this();
if ( !CORBA::is_nil( aSubMesh )) {
aShapeObject = aSubMesh->GetSubShape();
- PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject );
+ SALOMEDS::SObject_wrap( PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject ));
}
}
{
SMESH::SMESH_GroupBase_ptr aGroup = (*it).second;
if ( !aGroup->_is_nil() ) {
- GEOM::GEOM_Object_var aShapeObj;
- SMESH::SMESH_GroupOnGeom_var aGeomGroup =
- SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
+ GEOM::GEOM_Object_var aShapeObj;
+ SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGroup );
if ( !aGeomGroup->_is_nil() )
aShapeObj = aGeomGroup->GetShape();
- PublishGroup( theStudy, theMesh, aGroup, aShapeObj );
+ SALOMEDS::SObject_wrap( PublishGroup( theStudy, theMesh, aGroup, aShapeObj ));
}
}
theSubMesh->_is_nil() || theShapeObject->_is_nil() )
return SALOMEDS::SObject::_nil();
- SALOMEDS::SObject_var aSubMeshSO = ObjectToSObject( theStudy, theSubMesh );
+ SALOMEDS::SObject_wrap aSubMeshSO = ObjectToSObject( theStudy, theSubMesh );
if ( aSubMeshSO->_is_nil() )
{
- SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+ SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
if ( aMeshSO->_is_nil() ) {
aMeshSO = PublishMesh( theStudy, theMesh );
if ( aMeshSO->_is_nil())
}
// Find or create submesh root
- SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(),
+ SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
aMeshSO, aRootTag, 0, false );
+ if ( aRootSO->_is_nil() )
+ return aSubMeshSO._retn();
+
SetName( aRootSO, aRootName );
// Add new submesh to corresponding sub-tree
// Publish hypothesis
- SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( theShapeObject );
- if ( hypList )
- for ( int i = 0; i < hypList->length(); i++ ) {
- SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]);
- PublishHypothesis( theStudy, aHyp );
- AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
- }
+ SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( theShapeObject );
+ for ( int i = 0; i < hypList->length(); i++ ) {
+ SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
+ SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
+ AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
+ }
return aSubMeshSO._retn();
}
if (theStudy->_is_nil() || theMesh->_is_nil() || theGroup->_is_nil() )
return SALOMEDS::SObject::_nil();
- SALOMEDS::SObject_var aGroupSO = ObjectToSObject( theStudy, theGroup );
+ SALOMEDS::SObject_wrap aGroupSO = ObjectToSObject( theStudy, theGroup );
if ( aGroupSO->_is_nil() )
{
- SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+ SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
if ( aMeshSO->_is_nil() ) {
aMeshSO = PublishInStudy( theStudy, SALOMEDS::SObject::_nil(), theMesh, "");
if ( aMeshSO->_is_nil())
long aRootTag = GetNodeGroupsTag() + aType - 1;
// Find or create groups root
- SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(),
+ SALOMEDS::SObject_wrap aRootSO = publish (theStudy, CORBA::Object::_nil(),
aMeshSO, aRootTag, 0, false );
+ if ( aRootSO->_is_nil() ) return SALOMEDS::SObject::_nil();
+
if ( aType < sizeof(aRootNames)/sizeof(char*) )
SetName( aRootSO, aRootNames[aType] );
if (theStudy->_is_nil() || theHyp->_is_nil())
return SALOMEDS::SObject::_nil();
- SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
+ CORBA::String_var hypType = theHyp->GetName();
+
+ SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
if ( aHypSO->_is_nil() )
{
- SALOMEDS::SComponent_var father = PublishComponent( theStudy );
+ SALOMEDS::SComponent_wrap father = PublishComponent( theStudy );
if ( father->_is_nil() )
return aHypSO._retn();
//Find or Create Hypothesis root
bool isAlgo = ( !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil() );
int aRootTag = isAlgo ? GetAlgorithmsRootTag() : GetHypothesisRootTag();
- SALOMEDS::SObject_var aRootSO =
+ SALOMEDS::SObject_wrap aRootSO =
publish (theStudy, CORBA::Object::_nil(),father, aRootTag,
isAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
SetName( aRootSO, isAlgo ? "Algorithms" : "Hypotheses" );
// Add New Hypothesis
string aPmName = isAlgo ? "ICON_SMESH_TREE_ALGO_" : "ICON_SMESH_TREE_HYPO_";
- aPmName += theHyp->GetName();
+ aPmName += hypType.in();
// prepend plugin name to pixmap name
- string pluginName = myHypCreatorMap[string(theHyp->GetName())]->GetModuleName();
+ string pluginName = myHypCreatorMap[ hypType.in() ]->GetModuleName();
if ( pluginName != "StdMeshers" )
aPmName = pluginName + "::" + aPmName;
aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() );
}
- if ( !aHypSO->_is_nil() ) {
- CORBA::String_var aHypName = CORBA::string_dup( theHyp->GetName() );
- SetName( aHypSO, theName, aHypName );
- }
+ SetName( aHypSO, theName, hypType.in() );
if(MYDEBUG) MESSAGE("PublishHypothesis--END")
return aHypSO._retn();
GEOM::GEOM_Object_ptr theShape)
{
if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
- SALOMEDS::SObject_var aMeshOrSubMesh;
+ SALOMEDS::SObject_wrap aMeshOrSubMesh;
if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh()))
return aMeshOrSubMesh._retn();
&& theMesh->HasShapeToMesh()) )
return false;
- SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
+ SALOMEDS::SObject_wrap aMeshSO = ObjectToSObject( theStudy, theMesh );
if ( aMeshSO->_is_nil() )
aMeshSO = PublishMesh( theStudy, theMesh );
- SALOMEDS::SObject_var aHypSO = PublishHypothesis( theStudy, theHyp );
+ SALOMEDS::SObject_wrap aHypSO = PublishHypothesis( theStudy, theHyp );
if ( aMeshSO->_is_nil() || aHypSO->_is_nil())
return false;
// Find a mesh or submesh refering to theShape
- SALOMEDS::SObject_var aMeshOrSubMesh =
+ SALOMEDS::SObject_wrap aMeshOrSubMesh =
GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
if ( aMeshOrSubMesh->_is_nil() )
{
//Find or Create Applied Hypothesis root
bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil();
- SALOMEDS::SObject_var AHR =
+ SALOMEDS::SObject_wrap AHR =
publish (theStudy, CORBA::Object::_nil(), aMeshOrSubMesh,
aIsAlgo ? GetRefOnAppliedAlgorithmsTag() : GetRefOnAppliedHypothesisTag(),
aIsAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false);
SetName( AHR, aIsAlgo ? "Applied algorithms" : "Applied hypotheses" );
- if ( AHR->_is_nil() )
- return false;
addReference( theStudy, AHR, theHyp );
+
if(MYDEBUG) MESSAGE("AddHypothesisToShape--END")
return true;
}
&& theMesh->HasShapeToMesh()))
return false;
- SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
+ SALOMEDS::SObject_wrap aHypSO = ObjectToSObject( theStudy, theHyp );
if ( aHypSO->_is_nil() )
return false;
+ CORBA::String_var hypEntry = aHypSO->GetID();
+
// Find a mesh or submesh refering to theShape
- SALOMEDS::SObject_var aMeshOrSubMesh =
+ SALOMEDS::SObject_wrap aMeshOrSubMesh =
GetMeshOrSubmeshByShape( theStudy, theMesh, theShape );
if ( aMeshOrSubMesh->_is_nil() )
return false;
// Find and remove a reference to aHypSO
- SALOMEDS::SObject_var aRef, anObj;
- CORBA::String_var anID = CORBA::string_dup( aHypSO->GetID() );
- SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( aMeshOrSubMesh );
- for ( it->InitEx( true ); it->More(); it->Next() ) {
+ SALOMEDS::SObject_wrap aRef, anObj;
+ SALOMEDS::ChildIterator_wrap it = theStudy->NewChildIterator( aMeshOrSubMesh );
+ bool found = false;
+ for ( it->InitEx( true ); ( it->More() && !found ); it->Next() ) {
anObj = it->Value();
- if (anObj->ReferencedObject( aRef ) && strcmp( aRef->GetID(), anID ) == 0 ) {
- theStudy->NewBuilder()->RemoveObject( anObj );
- break;
+ if (anObj->ReferencedObject( aRef.inout() ))
+ {
+ CORBA::String_var refEntry = aRef->GetID();
+ found = ( strcmp( refEntry, hypEntry ) == 0 );
+ }
+ if ( found )
+ {
+ SALOMEDS::StudyBuilder_var builder = theStudy->NewBuilder();
+ builder->RemoveObject( anObj );
}
}
+
return true;
}
//=======================================================================
void SMESH_Gen_i::UpdateParameters(/*CORBA::Object_ptr theObject,*/ const char* theParameters)
{
- SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = GetCurrentStudy();
if ( aStudy->_is_nil() )
return;
myLastParameters.clear();
// if(VARIABLE_DEBUG)
// cout<<"UpdateParameters : "<<theParameters<<endl;
- // //SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+ // //SALOMEDS::Study_var aStudy = GetCurrentStudy();
// if(aStudy->_is_nil() || CORBA::is_nil(theObject))
// return;
- // SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
+ // SALOMEDS::SObject_wrap aSObj = ObjectToSObject(aStudy,theObject);
// if(aSObj->_is_nil())
// return;
//function : GetParameters
//purpose :
//=======================================================================
+
char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
{
- TCollection_AsciiString aResult;
-
- SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
- SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
-
- if(!aStudy->_is_nil() &&
- !CORBA::is_nil(theObject) &&
- !aSObj->_is_nil()){
-
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObj->FindAttribute(anAttr, "AttributeString")) {
- aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value());
+ CORBA::String_var aResult("");
+
+ SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy,theObject);
+ if ( !aSObj->_is_nil() )
+ {
+ SALOMEDS::GenericAttribute_wrap attr;
+ if ( aSObj->FindAttribute( attr.inout(), "AttributeString"))
+ {
+ SALOMEDS::AttributeString_wrap strAttr = attr;
+ aResult = strAttr->Value();
}
}
-
- return CORBA::string_dup( aResult.ToCString() );
+
+ return CORBA::string_dup( aResult.in() );
}
// Author : Paul RASCLE, EDF
// Module : SMESH
//
-#include <iostream>
-#include <sstream>
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_Gen_i.hxx"
-#include "utilities.h"
+
+#include <utilities.h>
+#include <SALOMEDS_wrap.hxx>
+
+#include <iostream>
+#include <sstream>
using namespace std;
//=============================================================================
SMESH_Hypothesis_i::SMESH_Hypothesis_i( PortableServer::POA_ptr thePOA )
- : SALOME::GenericObj_i( thePOA )
+ : SALOME::GenericObj_i( thePOA )
{
MESSAGE( "SMESH_Hypothesis_i::SMESH_Hypothesis_i / Début" );
myBaseImpl = 0;
*
*/
//=============================================================================
-bool SMESH_Hypothesis_i::IsPublished(){
+bool SMESH_Hypothesis_i::IsPublished()
+{
bool res = false;
- SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
- if(gen){
- SALOMEDS::SObject_var SO =
- SMESH_Gen_i::ObjectToSObject(gen->GetCurrentStudy() , SMESH::SMESH_Hypothesis::_narrow(_this()));
+ if ( SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen())
+ {
+ SALOMEDS::Study_var study = gen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( study, _this());
res = !SO->_is_nil();
}
return res;
}
}
-//=============================================================================
-/*!
- * SMESH_Hypothesis_i::SetParameters()
- *
- */
-//=============================================================================
-// void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
-// {
-// SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-// //char * aParameters = CORBA::string_dup(theParameters);
-// if(gen){
-// gen->UpdateParameters(theParameters);
-// // if(IsPublished()) {
-// // SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Hypothesis::_narrow(_this()),aParameters);
-// // }
-// // else {
-// // myBaseImpl->SetParameters(gen->ParseParameters(aParameters));
-// // }
-// }
-// }
-
-// //=============================================================================
-// /*!
-// * SMESH_Hypothesis_i::GetParameters()
-// *
-// */
-// //=============================================================================
-// char* SMESH_Hypothesis_i::GetParameters()
-// {
-// SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-// char* aResult;
-// if(IsPublished()) {
-// MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get Parameters from SObject");
-// aResult = gen->GetParameters(SMESH::SMESH_Hypothesis::_narrow(_this()));
-// }
-// else {
-// MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get local parameters");
-// aResult = myBaseImpl->GetParameters();
-// }
-// return CORBA::string_dup(aResult);
-// }
-
-// //=============================================================================
-// /*!
-// * SMESH_Hypothesis_i::GetLastParameters()
-// *
-// */
-// //=============================================================================
-// SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
-// {
-// SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters();
-// SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
-// if(gen) {
-// char *aParameters;
-// if(IsPublished())
-// aParameters = GetParameters();
-// else
-// aParameters = myBaseImpl->GetLastParameters();
-
-// SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
-// if(!aStudy->_is_nil()) {
-// SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
-// if(aSections->length() > 0) {
-// SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
-// aResult->length(aVars.length());
-// for(int i = 0;i < aVars.length();i++)
-// aResult[i] = CORBA::string_dup( aVars[i]);
-// }
-// }
-// }
-// return aResult._retn();
-// }
-
-// //=============================================================================
-// /*!
-// * SMESH_Hypothesis_i::SetLastParameters()
-// *
-// */
-// //=============================================================================
-// void SMESH_Hypothesis_i::SetLastParameters(const char* theParameters)
-// {
-// if(!IsPublished()) {
-// myBaseImpl->SetLastParameters(theParameters);
-// }
-// }
-// //=============================================================================
-// /*!
-// * SMESH_Hypothesis_i::ClearParameters()
-// *
-// */
-// //=============================================================================
-// void SMESH_Hypothesis_i::ClearParameters()
-// {
-// myMethod2VarParams.clear();
-// // if(!IsPublished()) {
-// // myBaseImpl->ClearParameters();
-// // }
-// }
-
//=============================================================================
/*!
* SMESH_Hypothesis_i::GetImpl
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
+#include "SMESH_MEDSupport_i.hxx"
+#include "SMESH_MEDFamily_i.hxx"
+
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_MapOfShape.hxx>
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-#include "SMESH_MEDSupport_i.hxx"
-#include "SMESH_MEDFamily_i.hxx"
+#include <utilities.h>
+#include <Utils_CorbaException.hxx>
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-# include "Utils_ExceptHandlers.hxx"
+#include <Utils_ORB_INIT.hxx>
+#include <Utils_SINGLETON.hxx>
+#include <Utils_ExceptHandlers.hxx>
+#include <SALOMEDS_wrap.hxx>
extern "C"
{
{
SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_var study = gen->GetCurrentStudy();
- SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
+ SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, _mesh_i->_this());
if ( meshSO->_is_nil() )
return CORBA::string_dup("toto");
CORBA::String_var name = meshSO->GetName();
+
return CORBA::string_dup( name.in() );
}
catch(...)
if (_meshId != "")
{
MESSAGE("Mesh already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study",
- SALOME::BAD_PARAM);
- };
-
- /*
- * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- *
- * // Create SComponent labelled 'MED' if it doesn't already exit
- * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- * if ( CORBA::is_nil(medfather) )
- * {
- * MESSAGE("Add Component MED");
- * medfather = myBuilder->NewComponent("MED");
- * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED");
- * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
- * myBuilder->FindOrCreateAttribute(medfather, "AttributeName"));
- * aName->SetValue("MED");
- *
- * myBuilder->DefineComponentInstance(medfather,myIor);
- *
- * } ;
- *
- * MESSAGE("Add a mesh Object under MED");
- * myBuilder->NewCommand();
- * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
- *
- * ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- * ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- * CORBA::ORB_var &orb = init(0,0);
- * CORBA::String_var iorStr = orb->object_to_string(myIor);
- * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.in());
- * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow(
- * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"));
- * aIOR->SetValue(iorStr.c_str());
- *
- * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str());
- * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(
- * myBuilder->FindOrCreateAttribute(newObj, "AttributeName"));
- * aName->SetValue(_mesh_i->getName().c_str());
- *
- * _meshId = newObj->GetID();
- * myBuilder->CommitCommand();
- *
- */
+ THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", SALOME::BAD_PARAM);
+ }
END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
}
#include "SMESH_MeshEditor_i.hxx"
-#include "DriverMED_R_SMESHDS_Mesh.h"
-#include "DriverMED_W_SMESHDS_Mesh.h"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_ElemIterator.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_MeshVolume.hxx"
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
#include "SMDS_SetIterator.hxx"
-#include "SMDS_SetIterator.hxx"
#include "SMDS_VolumeTool.hxx"
-#include "SMESHDS_Command.hxx"
-#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include "SMESH_ControlsDef.hxx"
#include "SMESH_Filter_i.hxx"
-#include "SMESH_Filter_i.hxx"
-#include "SMESH_Gen_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_Group_i.hxx"
-#include "SMESH_Group_i.hxx"
-#include "SMESH_MEDMesh_i.hxx"
-#include "SMESH_MeshEditor.hxx"
#include "SMESH_MeshPartDS.hxx"
#include "SMESH_MesherHelper.hxx"
-#include "SMESH_PreMeshInfo.hxx"
-#include "SMESH_PythonDump.hxx"
#include "SMESH_PythonDump.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "SMESH_subMesh_i.hxx"
-#include "SMESH_subMesh_i.hxx"
-#include "utilities.h"
-#include "Utils_ExceptHandlers.hxx"
-#include "Utils_CorbaException.hxx"
+#include <utilities.h>
+#include <Utils_ExceptHandlers.hxx>
+#include <Utils_CorbaException.hxx>
+#include <SALOMEDS_wrap.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRep_Tool.hxx>
SMDSAbs_ElementType myPreviewType; // type to show
//!< Constructor
TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
- _isShapeToMesh = (_id =_studyId =_idDoc = 0);
+ _isShapeToMesh = (_id =_studyId = 0);
_myMeshDS = new SMESHDS_Mesh( _id, true );
myPreviewType = previewElements;
}
return anIDSourceVar._retn();
}
+bool SMESH_MeshEditor_i::IsTemporaryIDSource( SMESH::SMESH_IDSource_ptr& idSource )
+{
+ return SMESH::DownCast<SMESH_MeshEditor_i::_IDSource*>( idSource );
+}
+
void SMESH_MeshEditor_i::deleteAuxIDSources()
{
std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
{
- SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
- SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh();
- SALOMEDS::Study_var study = gen->GetCurrentStudy();
- SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, mesh );
+ SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
+ SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh();
+ SALOMEDS::Study_var study = gen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject( study, mesh );
gen->SetName( meshSO, theMeshName, "Mesh" );
gen->SetPixMap( meshSO, "ICON_SMESH_TREE_MESH_IMPORTED");
#include "SMESH_subMesh_i.hxx"
#include <OpUtil.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+#include <SALOMEDS_wrap.hxx>
#include <SALOME_NamingService.hxx>
#include <Utils_CorbaException.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <Utils_SINGLETON.hxx>
#include <utilities.h>
+
#include <GEOMImpl_Types.hxx>
+#include <GEOM_GenericObjPtr.h>
// OCCT Includes
#include <BRep_Builder.hxx>
int SMESH_Mesh_i::_idGenerator = 0;
-//To disable automatic genericobj management, the following line should be commented.
-//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
-#define WITHGENERICOBJ
//=============================================================================
/*!
: SALOME::GenericObj_i( thePOA )
{
MESSAGE("SMESH_Mesh_i");
- _impl = NULL;
- _gen_i = gen_i;
- _id = _idGenerator++;
- _studyId = studyId;
+ _impl = NULL;
+ _gen_i = gen_i;
+ _id = _idGenerator++;
+ _studyId = studyId;
_preMeshInfo = NULL;
}
{
MESSAGE("~SMESH_Mesh_i");
-#ifdef WITHGENERICOBJ
// destroy groups
map<int, SMESH::SMESH_GroupBase_ptr>::iterator itGr;
- for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++) {
- if ( CORBA::is_nil( itGr->second ))
- continue;
- SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>(SMESH_Gen_i::GetServant(itGr->second).in());
- if (aGroup) {
- // this method is called from destructor of group (PAL6331)
+ for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++)
+ if (SMESH_GroupBase_i* aGroup = SMESH::DownCast<SMESH_GroupBase_i*>(itGr->second))
+ {
+ // _impl->RemoveGroup() is called by ~SMESH_GroupBase_i() (PAL6331)
//_impl->RemoveGroup( aGroup->GetLocalID() );
aGroup->myMeshServant = 0;
aGroup->UnRegister();
}
- }
_mapGroups.clear();
// destroy submeshes
map<int, SMESH::SMESH_subMesh_ptr>::iterator itSM;
- for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ ) {
- if ( CORBA::is_nil( itSM->second ))
- continue;
- SMESH_subMesh_i* aSubMesh = dynamic_cast<SMESH_subMesh_i*>(SMESH_Gen_i::GetServant(itSM->second).in());
- if (aSubMesh) {
+ for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ )
+ if ( SMESH_subMesh_i* aSubMesh = SMESH::DownCast<SMESH_subMesh_i*>( itSM->second ))
+ {
aSubMesh->UnRegister();
}
- }
_mapSubMeshIor.clear();
// destroy hypotheses
map<int, SMESH::SMESH_Hypothesis_ptr>::iterator itH;
- for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ ) {
- if ( CORBA::is_nil( itH->second ))
- continue;
- SMESH_Hypothesis_i* aHypo = dynamic_cast<SMESH_Hypothesis_i*>(SMESH_Gen_i::GetServant(itH->second).in());
- if (aHypo) {
+ for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ )
+ if ( SMESH_Hypothesis_i* aHypo = SMESH::DownCast<SMESH_Hypothesis_i*>( itH->second ))
+ {
aHypo->UnRegister();
}
- }
_mapHypo.clear();
-#endif
delete _impl; _impl = NULL;
-
- if ( _preMeshInfo ) delete _preMeshInfo; _preMeshInfo = NULL;
+ delete _preMeshInfo; _preMeshInfo = NULL;
}
//=============================================================================
catch(SALOME_Exception & S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
+ _impl->GetMeshDS()->Modified();
+
TPythonDump() << _this() << ".Clear()";
}
catch(SALOME_Exception & S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
+ _impl->GetMeshDS()->Modified();
+
+ TPythonDump() << _this() << ".ClearSubMesh( " << ShapeID << " )";
}
//=============================================================================
status = _impl->AddHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
_mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
-#ifdef WITHGENERICOBJ
_mapHypo[hypId]->Register();
-#endif
// assure there is a corresponding submesh
if ( !_impl->IsMainShape( myLocSubShape )) {
int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );
if ( subMesh->_is_nil() )
subMesh = createSubMesh( aSubShapeObject );
if ( _gen_i->CanPublishInStudy( subMesh )) {
- SALOMEDS::SObject_var aSO =
+ SALOMEDS::SObject_wrap aSO =
_gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
subMesh, aSubShapeObject, theName );
if ( !aSO->_is_nil()) {
//=============================================================================
void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::RemoveSubMesh");
if ( theSubMesh->_is_nil() )
return;
GEOM::GEOM_Object_var aSubShapeObject;
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
// Remove submesh's SObject
- SALOMEDS::SObject_var anSO = _gen_i->ObjectToSObject( aStudy, theSubMesh );
+ SALOMEDS::SObject_wrap anSO = _gen_i->ObjectToSObject( aStudy, theSubMesh );
if ( !anSO->_is_nil() ) {
long aTag = SMESH_Gen_i::GetRefOnShapeTag();
- SALOMEDS::SObject_var anObj, aRef;
- if ( anSO->FindSubObject( aTag, anObj ) && anObj->ReferencedObject( aRef ) )
- aSubShapeObject = GEOM::GEOM_Object::_narrow( aRef->GetObject() );
-
-// if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
-// aSubShapeObject = theSubMesh->GetSubShape();
+ SALOMEDS::SObject_wrap anObj, aRef;
+ if ( anSO->FindSubObject( aTag, anObj.inout() ) &&
+ anObj->ReferencedObject( aRef.inout() ))
+ {
+ CORBA::Object_var obj = aRef->GetObject();
+ aSubShapeObject = GEOM::GEOM_Object::_narrow( obj );
+ }
+ // if ( aSubShapeObject->_is_nil() ) // not published shape (IPAL13617)
+ // aSubShapeObject = theSubMesh->GetSubShape();
- aStudy->NewBuilder()->RemoveObjectWithChildren( anSO );
+ SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
+ builder->RemoveObjectWithChildren( anSO );
// Update Python script
TPythonDump() << _this() << ".RemoveSubMesh( " << anSO << " )";
SMESH::SMESH_Group::_narrow( createGroup( theElemType, theName ));
if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
- SALOMEDS::SObject_var aSO =
+ SALOMEDS::SObject_wrap aSO =
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
aNewGroup, GEOM::GEOM_Object::_nil(), theName);
if ( !aSO->_is_nil()) {
( createGroup( theElemType, theName, aShape ));
if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
- SALOMEDS::SObject_var aSO =
+ SALOMEDS::SObject_wrap aSO =
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
aNewGroup, theGeomObj, theName);
if ( !aSO->_is_nil()) {
if ( _gen_i->CanPublishInStudy( aNewGroup ) )
{
- SALOMEDS::SObject_var aSO =
+ SALOMEDS::SObject_wrap aSO =
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(), aNewGroup,
GEOM::GEOM_Object::_nil(), theName);
if ( !aSO->_is_nil()) {
if ( !aGroup )
return;
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_var aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
+ SALOMEDS::SObject_wrap aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
if ( !aGroupSO->_is_nil() ) {
// Update Python script
TPythonDump() << _this() << ".RemoveGroup( " << aGroupSO << " )";
// Remove group's SObject
- aStudy->NewBuilder()->RemoveObjectWithChildren( aGroupSO );
+ SALOMEDS::StudyBuilder_var builder = aStudy->NewBuilder();
+ builder->RemoveObjectWithChildren( aGroupSO );
}
}
theGroup1->GetType() != theGroup2->GetType() )
return SMESH::SMESH_Group::_nil();
+ TPythonDump pyDump;
+
// Create Union
SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
if ( aResGrp->_is_nil() )
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-
// Update Python script
- TPythonDump() << aResGrp << " = " << _this() << ".UnionGroups( "
- << theGroup1 << ", " << theGroup2 << ", '"
- << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".UnionGroups( "
+ << theGroup1 << ", " << theGroup2 << ", '"
+ << theName << "' )";
return aResGrp._retn();
}
}
}
+ TPythonDump pyDump;
+
// Create group
SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
if ( aResGrp->_is_nil() )
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( anIds.size() );
- //NCollection_Map< int >::Iterator anIter( anIds );
- for ( int i = 0; i<anIds.size(); i++ )
- {
+ for ( size_t i = 0; i<anIds.size(); i++ )
aResIds[ i ] = anIds[i];
- }
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-
// Update Python script
-
- TPythonDump() << aResGrp << " = " << _this() << ".UnionListOfGroups( "
- << &theGroups << ", '" << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".UnionListOfGroups( "
+ << &theGroups << ", '" << theName << "' )";
return aResGrp._retn();
}
//=============================================================================
SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
- const char* theName )
+ const char* theName )
throw (SALOME::SALOME_Exception)
{
if ( _preMeshInfo )
theGroup1->GetType() != theGroup2->GetType() )
return SMESH::SMESH_Group::_nil();
+ TPythonDump pyDump;
+
// Create Intersection
SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
if ( aResGrp->_is_nil() )
aMap1.Add( anIds1[ i1 ] );
TColStd_SequenceOfInteger aSeq;
-
for ( int i2 = 0, n2 = anIds2->length(); i2 < n2; i2++ )
if ( aMap1.Contains( anIds2[ i2 ] ) )
aSeq.Append( anIds2[ i2 ] );
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( aSeq.Length() );
-
- for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
+ for ( size_t resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
aResIds[ resI ] = aSeq( resI + 1 );
-
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-
// Update Python script
- TPythonDump() << aResGrp << " = " << _this() << ".IntersectGroups( "
- << theGroup1 << ", " << theGroup2 << ", '" << theName << "')";
+ pyDump << aResGrp << " = " << _this() << ".IntersectGroups( "
+ << theGroup1 << ", " << theGroup2 << ", '" << theName << "')";
return aResGrp._retn();
}
anIds.push_back( aCurrId );
}
+ TPythonDump pyDump;
+
// Create group
SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
if ( aResGrp->_is_nil() )
SMESH::long_array_var aResIds = new SMESH::long_array;
aResIds->length( anIds.size() );
- //NCollection_Map< int >::Iterator aListIter( anIds );
- for ( int i = 0; i<anIds.size(); i++ )
- {
+ for ( size_t i = 0; i<anIds.size(); i++ )
aResIds[ i ] = anIds[i];
- }
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-
// Update Python script
-
- TPythonDump() << aResGrp << " = " << _this() << ".IntersectListOfGroups( "
- << &theGroups << ", '" << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".IntersectListOfGroups( "
+ << &theGroups << ", '" << theName << "' )";
return aResGrp._retn();
}
theGroup1->GetType() != theGroup2->GetType() )
return SMESH::SMESH_Group::_nil();
+ TPythonDump pyDump;
+
// Perform Cutting
SMESH::SMESH_Group_var aResGrp = CreateGroup( theGroup1->GetType(), theName );
if ( aResGrp->_is_nil() )
for ( int resI = 0, resN = aSeq.Length(); resI < resN; resI++ )
aResIds[ resI ] = aSeq( resI + 1 );
-
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
- _gen_i->RemoveLastFromPythonScript(aStudy->StudyId());
-
// Update Python script
- TPythonDump() << aResGrp << " = " << _this() << ".CutGroups( "
- << theGroup1 << ", " << theGroup2 << ", '"
- << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".CutGroups( "
+ << theGroup1 << ", " << theGroup2 << ", '"
+ << theName << "' )";
return aResGrp._retn();
}
}
}
+ TPythonDump pyDump;
+
// Create group
SMESH::SMESH_Group_var aResGrp = CreateGroup( aType, theName );
if ( aResGrp->_is_nil() )
aResIds->length( anIds.size() );
for (int i=0; i<anIds.size(); i++ )
- {
aResIds[ i ] = anIds[i];
- }
aResGrp->Add( aResIds );
- // Clear python lines, created by CreateGroup() and Add()
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-
// Update Python script
-
- TPythonDump() << aResGrp << " = " << _this() << ".CutListOfGroups( "
- << &theMainGroups << ", " << &theToolGroups << ", '"
- << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".CutListOfGroups( "
+ << &theMainGroups << ", " << &theToolGroups << ", '"
+ << theName << "' )";
return aResGrp._retn();
}
// Create group
+ TPythonDump pyDump;
+
SMESH::SMESH_Group_var aResGrp = CreateGroup( theElemType, theName );
if ( aResGrp->_is_nil() )
return SMESH::SMESH_Group::_nil();
aResIds[ i ] = aResultIds[i];
aResGrp->Add( aResIds );
- // Remove strings corresponding to group creation
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
- _gen_i->RemoveLastFromPythonScript( aStudy->StudyId() );
-
// Update Python script
-
- TPythonDump() << aResGrp << " = " << _this() << ".CreateDimGroup( "
- << &theGroups << ", " << theElemType << ", '" << theName << "' )";
+ pyDump << aResGrp << " = " << _this() << ".CreateDimGroup( "
+ << &theGroups << ", " << theElemType << ", '" << theName << "' )";
return aResGrp._retn();
}
if ( CORBA::is_nil( theGeomObj ) || theGeomObj->GetType() != GEOM_GROUP )
return;
// group SO
- SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
- SALOMEDS::SObject_var groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
if ( groupSO->_is_nil() )
return;
// group indices
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
- GEOM::GEOM_IGroupOperations_var groupOp =
+ GEOM::GEOM_IGroupOperations_wrap groupOp =
geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
// get geom group
SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
if ( study->_is_nil() ) return newShape; // means "not changed"
- SALOMEDS::SObject_var groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
+ SALOMEDS::SObject_wrap groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
if ( !groupSO->_is_nil() )
{
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
// get indices of group items
set<int> curIndices;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
- GEOM::GEOM_IGroupOperations_var groupOp =
+ GEOM::GEOM_IGroupOperations_wrap groupOp =
geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
- GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
+ GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
for ( int i = 0; i < ids->length(); ++i )
curIndices.insert( ids[i] );
TCollection_AsciiString groupIOR = geomGen->GetStringFromIOR( geomGroup );
geomClient->RemoveShapeFromBuffer( groupIOR );
newShape = _gen_i->GeomObjectToShape( geomGroup );
- }
+ }
if ( newShape.IsNull() ) {
// geom group becomes empty - return empty compound
if ( _mapGroups.find( oldID ) == _mapGroups.end() )
continue;
// get group name
- SALOMEDS::SObject_var groupSO = _gen_i->ObjectToSObject( study,_mapGroups[oldID] );
- CORBA::String_var name = groupSO->GetName();
+ SALOMEDS::SObject_wrap groupSO = _gen_i->ObjectToSObject( study,_mapGroups[oldID] );
+ CORBA::String_var name = groupSO->GetName();
// update
- SMESH_GroupBase_i* group_i = SMESH::DownCast<SMESH_GroupBase_i*>(_mapGroups[oldID] );
+ SMESH_GroupBase_i* group_i = SMESH::DownCast<SMESH_GroupBase_i*>(_mapGroups[oldID] );
int newID;
if ( group_i && _impl->AddGroup( geomType->second, name.in(), newID, geom._shape ))
group_i->changeLocalId( newID );
// Update icons
CORBA::Long newNbEntities = NbNodes() + NbElements();
- list< SALOMEDS::SObject_var > soToUpdateIcons;
+ list< SALOMEDS::SObject_wrap > soToUpdateIcons;
if ( newNbEntities != nbEntities )
{
// Add all SObjects with icons to soToUpdateIcons
soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_gr->second ));
}
- list< SALOMEDS::SObject_var >::iterator so = soToUpdateIcons.begin();
+ list< SALOMEDS::SObject_wrap >::iterator so = soToUpdateIcons.begin();
for ( ; so != soToUpdateIcons.end(); ++so )
_gen_i->SetPixMap( *so, "ICON_SMESH_TREE_MESH_WARN" );
}
_mapGroups.erase( anId );
SALOMEDS::StudyBuilder_var builder;
- SALOMEDS::SObject_var aGroupSO;
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
- if ( !aStudy->_is_nil() ) {
- builder = aStudy->NewBuilder();
+ SALOMEDS::SObject_wrap aGroupSO;
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
+ if ( !aStudy->_is_nil() ) {
+ builder = aStudy->NewBuilder();
aGroupSO = _gen_i->ObjectToSObject( aStudy, theGroup );
- if ( !aGroupSO->_is_nil() ) {
-
+ if ( !aGroupSO->_is_nil() )
+ {
// remove reference to geometry
- SALOMEDS::ChildIterator_var chItr = aStudy->NewChildIterator(aGroupSO);
+ SALOMEDS::ChildIterator_wrap chItr = aStudy->NewChildIterator(aGroupSO);
for ( ; chItr->More(); chItr->Next() )
// Remove group's child SObject
builder->RemoveObject( chItr->Value() );
const int isEmpty = ( elemTypes->length() == 0 );
if ( !isEmpty )
{
- SALOMEDS::GenericAttribute_var anAttr =
+ SALOMEDS::GenericAttribute_wrap anAttr =
builder->FindOrCreateAttribute( aGroupSO, "AttributePixMap" );
- SALOMEDS::AttributePixMap_var pm = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ SALOMEDS::AttributePixMap_wrap pm = anAttr;
pm->SetPixMap( "ICON_SMESH_TREE_GROUP" );
}
}
}
}
- // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
- SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
- aGroupImpl->Register();
- // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-
// remember new group in own map
aGroup = SMESH::SMESH_Group::_narrow( aGroupImpl->_this() );
_mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );
// register CORBA object for persistence
- /*int nextId =*/ _gen_i->RegisterObject( aGroup );
+ _gen_i->RegisterObject( aGroup );
- builder->SetIOR( aGroupSO, _gen_i->GetORB()->object_to_string( aGroup ) );
+ CORBA::String_var ior = _gen_i->GetORB()->object_to_string( aGroup );
+ builder->SetIOR( aGroupSO, ior.in() );
return aGroup._retn();
}
else
aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
- // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
- SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
- aGroupImpl->Register();
- // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
-
aGroup = SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
_mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );
// Perform Export
PrepareForWriting(file, overwrite);
string aMeshName = "Mesh";
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_var aMeshSO = _gen_i->ObjectToSObject( aStudy, _this() );
+ SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( aStudy, _this() );
if ( !aMeshSO->_is_nil() ) {
CORBA::String_var name = aMeshSO->GetName();
aMeshName = name;
// asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes
if ( !aStudy->GetProperties()->IsLocked() )
{
- SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::GenericAttribute_wrap anAttr;
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
- SALOMEDS::AttributeExternalFileDef_var aFileName;
anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeExternalFileDef");
- aFileName = SALOMEDS::AttributeExternalFileDef::_narrow(anAttr);
+ SALOMEDS::AttributeExternalFileDef_wrap aFileName = anAttr;
ASSERT(!aFileName->_is_nil());
aFileName->SetValue(file);
- SALOMEDS::AttributeFileType_var aFileType;
anAttr=aStudyBuilder->FindOrCreateAttribute(aMeshSO, "AttributeFileType");
- aFileType = SALOMEDS::AttributeFileType::_narrow(anAttr);
+ SALOMEDS::AttributeFileType_wrap aFileType = anAttr;
ASSERT(!aFileType->_is_nil());
aFileType->SetValue("FICHIERMED");
}
PrepareForWriting(file, overwrite);
string aMeshName = "Mesh";
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_var SO = _gen_i->ObjectToSObject( aStudy, meshPart );
+ SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( aStudy, meshPart );
if ( !SO->_is_nil() ) {
CORBA::String_var name = SO->GetName();
aMeshName = name;
if(!elem)
return -1;
- //SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
::SMESH_MeshEditor aMeshEditor(_impl);
int index = aMeshEditor.FindShape( elem );
if(index>0)
void SMESH_Mesh_i::CreateGroupServants()
{
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
set<int> addedIDs;
::SMESH_Mesh::GroupIteratorPtr groupIt = _impl->GetGroups();
aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
}
- // To ensure correct mapping of servant and correct reference counting in GenericObj_i
- SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
- aGroupImpl->Register();
-
SMESH::SMESH_GroupBase_var groupVar =
SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
_mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( groupVar );
if ( !nbGrp )
return;
- SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = _gen_i->GetCurrentStudy();
if ( aStudy->_is_nil() )
return; // nothing to do
SMESH::SMESH_GroupBase_ptr aGrp = (*grpList)[ gIndx ];
if ( !aGrp )
continue;
- SALOMEDS::SObject_var aGrpSO = _gen_i->ObjectToSObject( aStudy, aGrp );
+ SALOMEDS::SObject_wrap aGrpSO = _gen_i->ObjectToSObject( aStudy, aGrp );
if ( aGrpSO->_is_nil() )
continue;
// correct name of the mesh group if necessary
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
if(gen) {
char *aParameters = GetParameters();
- SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = gen->GetCurrentStudy();
if(!aStudy->_is_nil()) {
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
if(aSections->length() > 0) {
#include <TColStd_SequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
+#include <SALOMEDS_wrap.hxx>
+#include <SALOMEDS_Attributes_wrap.hxx>
+
#include <vector>
#include <string>
// this (and above) code can work wrong since nb of states can differ from nb of
// dumped calls due to the fix of
// issue 0021364:: Dump of netgen parameters has duplicate lines
- SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
- SALOMEDS::SObject_var sobj = aStudy->FindObjectID( (*it).first.ToCString() );
- CORBA::Object_var obj = aGen->SObjectToObject( sobj );
+ SMESH_Gen_i * aGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap sobj = aStudy->FindObjectID( (*it).first.ToCString() );
+ CORBA::Object_var obj = aGen->SObjectToObject( sobj );
if ( SMESH_Hypothesis_i* h = SMESH::DownCast< SMESH_Hypothesis_i*>( obj ))
{
TState aCurrentState = aStates->GetCurrectState();
- int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
+ int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
if ( 0 <= argIndex && argIndex < aCurrentState.size() &&
!aCurrentState[argIndex].IsEmpty() )
aCmd->SetArg( 1, aCurrentState[argIndex] );
if(!aGen)
return;
- SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
+ SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
if(aStudy->_is_nil())
return;
- SALOMEDS::SObject_var aSO = aStudy->FindComponent(aGen->ComponentDataType());
+ CORBA::String_var compDataType = aGen->ComponentDataType();
+ SALOMEDS::SObject_wrap aSO = aStudy->FindComponent( compDataType.in() );
if(CORBA::is_nil(aSO))
return;
- SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
- char* aParameters;
- for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
- SALOMEDS::SObject_var aSObject = Itr->Value();
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObject->FindAttribute(anAttr, "AttributeString")) {
- aParameters = SALOMEDS::AttributeString::_narrow(anAttr)->Value();
- SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
+ SALOMEDS::ChildIterator_wrap Itr = aStudy->NewChildIterator(aSO);
+ CORBA::String_var aParameters;
+ for( Itr->InitEx(true); Itr->More(); Itr->Next())
+ {
+ SALOMEDS::SObject_wrap aSObject = Itr->Value();
+ SALOMEDS::GenericAttribute_wrap anAttr;
+ if ( aSObject->FindAttribute( anAttr.inout(), "AttributeString"))
+ {
+ SALOMEDS::AttributeString_wrap strAttr = anAttr;
+ aParameters = strAttr->Value();
+ SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters.in());
if(MYDEBUG) {
cout<<"Entry : "<< aSObject->GetID()<<endl;
cout<<"aParameters : "<<aParameters<<endl;
if(anObjType == "LayerDistribution")
aState = new LayerDistributionStates();
else
- aState = new SMESH_ObjectStates(anObjType);
+ aState = new SMESH_ObjectStates(anObjType);
for(int i = 0; i < aSections->length(); i++) {
TState aVars;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
- for(int j = 0;j<aListOfVars.length();j++) {
+ for ( int j = 0; j<aListOfVars.length(); j++)
+ {
TCollection_AsciiString aVar(aListOfVars[j].in());
if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
aVar.InsertBefore(1, SMESH::TVar::Quote() );
const char* aName = aVarName.ToCString();
if(aStudy->IsVariable(aName) && (aStudy->IsReal(aName) || aStudy->IsInteger(aName))) {
- theValue = aStudy->GetReal(aVarName.ToCString());
+ theValue = aStudy->GetReal(aName);
ok = true;
}
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
+#include <MED_Factory.hxx>
+
#include <HDFarray.hxx>
#include <HDFdataset.hxx>
#include <HDFfile.hxx>
#include <HDFgroup.hxx>
-#include <MED_Factory.hxx>
#include <SALOMEDS_Tool.hxx>
+#include <SALOMEDS_wrap.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
SALOMEDS::Study_var study = gen->GetCurrentStudy();
if ( !study->_is_nil() && study->StudyId() == mesh->GetStudyId() )
{
- SALOMEDS::SObject_var meshSO = gen->ObjectToSObject(study, mesh->_this() );
- CORBA::Object_var obj = gen->GetNS()->Resolve( "/Kernel/Session" );
+ SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject(study, mesh->_this() );
+ CORBA::Object_var obj = gen->GetNS()->Resolve( "/Kernel/Session" );
_session = SALOME::Session::_narrow( obj );
if ( !meshSO->_is_nil() && !_session->_is_nil() )
{
aDataset->ReadFromDisk( isModified );
aDataset->CloseOnDisk();
_mesh->GetImpl().SetIsModified( bool(*isModified));
+ delete [] isModified;
}
bool submeshesInFamilies = ( ! aTopGroup->ExistInternalObject( "Submeshes" ));
map<int, SMESH::SMESH_subMesh_ptr>::iterator id2sm = _mesh->_mapSubMeshIor.begin();
for ( ; id2sm != _mesh->_mapSubMeshIor.end(); ++id2sm )
{
- if ( SMESH_subMesh_i* sm = SMESH::DownCast<SMESH_subMesh_i*>( id2sm->second ))
+ if ( SMESH_subMesh_i* sm_i = SMESH::DownCast<SMESH_subMesh_i*>( id2sm->second ))
{
- SMESH_PreMeshInfo* & info = sm->changePreMeshInfo();
+ SMESH_PreMeshInfo* & info = sm_i->changePreMeshInfo();
delete info;
info = NULL;
}
// PreMeshInfo_CATCH;
}
+//================================================================================
+/*!
+ * \brief remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading
+ */
+//================================================================================
+
+void SMESH_PreMeshInfo::ForgetAllData( SMESH_Mesh_i* mesh )
+{
+ if ( mesh && mesh->changePreMeshInfo() )
+ mesh->changePreMeshInfo()->ForgetAllData();
+}
+
//================================================================================
/*!
* \brief Calls either FullLoadFromFile() or ForgetAllData() depending on preferences
SALOMEDS::Study_var study = smeshComp->GetStudy();
if ( theStudyIDToMeshCounter[ (int) study->StudyId() ] > 0 )
{
- SALOMEDS::ChildIterator_var itBig = study->NewChildIterator( smeshComp );
+ SALOMEDS::ChildIterator_wrap itBig = study->NewChildIterator( smeshComp );
for ( ; itBig->More(); itBig->Next() ) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
- CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject( gotBranch );
+ SALOMEDS::SObject_wrap gotBranch = itBig->Value();
+ CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject( gotBranch );
if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( anObject ))
{
if ( mesh->changePreMeshInfo() )