mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
SIMAN removal
This commit is contained in:
parent
a207750f4a
commit
44d3906d3c
@ -66,7 +66,6 @@
|
|||||||
|
|
||||||
#include <SALOMEDS_Tool.hxx>
|
#include <SALOMEDS_Tool.hxx>
|
||||||
#include <SALOMEDS_wrap.hxx>
|
#include <SALOMEDS_wrap.hxx>
|
||||||
#include <SALOME_DataContainer_i.hxx>
|
|
||||||
#include <Basics_DirUtils.hxx>
|
#include <Basics_DirUtils.hxx>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -326,8 +325,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
std::string plgId;
|
std::string plgId;
|
||||||
for ( size_t j = 0; j < infoSeq->length(); ++j )
|
for ( size_t j = 0; j < infoSeq->length(); ++j )
|
||||||
for ( size_t i = 0; i < infoSeq[j].params.length(); ++i ) {
|
for ( size_t i = 0; i < infoSeq[j].params.length(); ++i ) {
|
||||||
std::string param_name = infoSeq[j].params[i].name.in();
|
std::string param_name = infoSeq[j].params[i].name.in();
|
||||||
std::string param_value = infoSeq[j].params[i].value.in();
|
std::string param_value = infoSeq[j].params[i].value.in();
|
||||||
if( param_name == PLUGIN_NAME) {
|
if( param_name == PLUGIN_NAME) {
|
||||||
plgId = param_value;
|
plgId = param_value;
|
||||||
break;
|
break;
|
||||||
@ -684,8 +683,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
|
|||||||
useCaseBuilder->SetRootCurrent();
|
useCaseBuilder->SetRootCurrent();
|
||||||
useCaseBuilder->Append( theComponent ); // component object is added as the top level item
|
useCaseBuilder->Append( theComponent ); // component object is added as the top level item
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
|
SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent );
|
||||||
for ( it->InitEx(true); it->More(); it->Next() ) {
|
for ( it->InitEx(true); it->More(); it->Next() ) {
|
||||||
if ( !useCaseBuilder->IsUseCaseNode( it->Value() ) ) {
|
if ( !useCaseBuilder->IsUseCaseNode( it->Value() ) ) {
|
||||||
useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
|
useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
|
||||||
@ -2459,7 +2458,7 @@ GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyI
|
|||||||
aServant = myOpCreatorMap[aLibName]->Create(_poa, theStudyID, engine, _impl);
|
aServant = myOpCreatorMap[aLibName]->Create(_poa, theStudyID, engine, _impl);
|
||||||
// activate the CORBA servant
|
// activate the CORBA servant
|
||||||
if (aServant)
|
if (aServant)
|
||||||
operations = aServant->_this();
|
operations = aServant->_this();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SALOME_Exception& S_ex) {
|
catch (SALOME_Exception& S_ex) {
|
||||||
@ -2484,7 +2483,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
|
|||||||
aPlatformLibName += theLibName;
|
aPlatformLibName += theLibName;
|
||||||
aPlatformLibName += ".so";
|
aPlatformLibName += ".so";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check, if corresponding operations are already created
|
// check, if corresponding operations are already created
|
||||||
if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
|
if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
|
||||||
// load plugin library
|
// load plugin library
|
||||||
@ -2497,7 +2496,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
|
|||||||
throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
|
throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// get method, returning operations creator
|
// get method, returning operations creator
|
||||||
typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
|
typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
|
||||||
GetOperationsCreator procHandle =
|
GetOperationsCreator procHandle =
|
||||||
@ -2506,7 +2505,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName)
|
|||||||
UnLoadLib(libHandle);
|
UnLoadLib(libHandle);
|
||||||
throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
|
throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get operations creator
|
// get operations creator
|
||||||
GEOM_GenericOperationsCreator* aCreator = procHandle();
|
GEOM_GenericOperationsCreator* aCreator = procHandle();
|
||||||
if (aCreator) {
|
if (aCreator) {
|
||||||
@ -2808,8 +2807,8 @@ char* GEOM_Gen_i::getVersion()
|
|||||||
// function : CreateFolder()
|
// function : CreateFolder()
|
||||||
// purpose : Creates and returns a new folder object
|
// purpose : Creates and returns a new folder object
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
|
SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
|
||||||
SALOMEDS::SObject_ptr theFather)
|
SALOMEDS::SObject_ptr theFather)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aFolderSO;
|
SALOMEDS::SObject_var aFolderSO;
|
||||||
|
|
||||||
@ -2861,8 +2860,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName,
|
|||||||
// function : MoveToFolder()
|
// function : MoveToFolder()
|
||||||
// purpose : Moves GEOM object to the specified folder
|
// purpose : Moves GEOM object to the specified folder
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
|
void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theFolder) {
|
SALOMEDS::SObject_ptr theFolder) {
|
||||||
GEOM::object_list_var objects = new GEOM::object_list();
|
GEOM::object_list_var objects = new GEOM::object_list();
|
||||||
objects->length( 1 );
|
objects->length( 1 );
|
||||||
SALOMEDS::SObject_var aSO = theFolder->GetStudy()->FindObjectID( theObject->GetStudyEntry() );
|
SALOMEDS::SObject_var aSO = theFolder->GetStudy()->FindObjectID( theObject->GetStudyEntry() );
|
||||||
@ -2874,8 +2873,8 @@ void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject,
|
|||||||
// function : MoveListToFolder()
|
// function : MoveListToFolder()
|
||||||
// purpose : Moves list of GEOM objects to the specified folder
|
// purpose : Moves list of GEOM objects to the specified folder
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
|
void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
|
||||||
SALOMEDS::SObject_ptr theFolder) {
|
SALOMEDS::SObject_ptr theFolder) {
|
||||||
int aLen = theListOfGO.length();
|
int aLen = theListOfGO.length();
|
||||||
GEOM::object_list_var objects = new GEOM::object_list();
|
GEOM::object_list_var objects = new GEOM::object_list();
|
||||||
objects->length( aLen );
|
objects->length( aLen );
|
||||||
@ -2892,12 +2891,12 @@ void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
|
|||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Move()
|
// function : Move()
|
||||||
// purpose : Moves objects to the specified position.
|
// purpose : Moves objects to the specified position.
|
||||||
// Is used in the drag-n-drop functionality.
|
// Is used in the drag-n-drop functionality.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
||||||
SALOMEDS::SObject_ptr where,
|
SALOMEDS::SObject_ptr where,
|
||||||
CORBA::Long row )
|
CORBA::Long row )
|
||||||
{
|
{
|
||||||
if ( CORBA::is_nil( where ) ) return;
|
if ( CORBA::is_nil( where ) ) return;
|
||||||
|
|
||||||
@ -2907,7 +2906,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
|||||||
SALOMEDS::SComponent_var father = where->GetFatherComponent();
|
SALOMEDS::SComponent_var father = where->GetFatherComponent();
|
||||||
std::string dataType = father->ComponentDataType();
|
std::string dataType = father->ComponentDataType();
|
||||||
if ( dataType != "GEOM" ) return; // not a GEOM component
|
if ( dataType != "GEOM" ) return; // not a GEOM component
|
||||||
|
|
||||||
SALOMEDS::SObject_var objAfter;
|
SALOMEDS::SObject_var objAfter;
|
||||||
if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
|
if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) {
|
||||||
// insert at given row -> find insertion position
|
// insert at given row -> find insertion position
|
||||||
@ -2918,7 +2917,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
|||||||
objAfter = useCaseIt->Value();
|
objAfter = useCaseIt->Value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < what.length(); i++ ) {
|
for ( int i = 0; i < what.length(); i++ ) {
|
||||||
SALOMEDS::SObject_var sobj = what[i];
|
SALOMEDS::SObject_var sobj = what[i];
|
||||||
if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
|
if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
|
||||||
@ -2930,155 +2929,12 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : importData
|
|
||||||
// purpose : imports geometrical data file into the GEOM internal data structure
|
|
||||||
//=================================================================================
|
|
||||||
Engines::ListOfIdentifiers* GEOM_Gen_i::importData(
|
|
||||||
CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options)
|
|
||||||
{
|
|
||||||
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
|
|
||||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
|
||||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
|
|
||||||
|
|
||||||
Engines::ListOfIdentifiers_var aResult = new Engines::ListOfIdentifiers;
|
|
||||||
GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
|
|
||||||
if (aInsOp->_is_nil()) {
|
|
||||||
MESSAGE("No insert operations!");
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a temporary directory to store a file
|
|
||||||
std::string aTmpDir = SALOMEDS_Tool::GetTmpDir();
|
|
||||||
std::string aFileName("file");
|
|
||||||
if (aFileName.rfind("/") != std::string::npos) { // remove folders from the name
|
|
||||||
aFileName = aFileName.substr(aFileName.rfind("/") + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string anExtension(data->extension());
|
|
||||||
aFileName += "." + anExtension;
|
|
||||||
// convert extension to upper case
|
|
||||||
std::transform(anExtension.begin(), anExtension.end(), anExtension.begin(), ::toupper);
|
|
||||||
std::string aFullPath = aTmpDir + aFileName;
|
|
||||||
|
|
||||||
Engines::TMPFile* aFileStream = data->get();
|
|
||||||
const char *aBuffer = (const char*)aFileStream->NP_data();
|
|
||||||
#ifdef WIN32
|
|
||||||
std::ofstream aFile(aFullPath.c_str(), std::ios::binary);
|
|
||||||
#else
|
|
||||||
std::ofstream aFile(aFullPath.c_str());
|
|
||||||
#endif
|
|
||||||
aFile.write(aBuffer, aFileStream->length());
|
|
||||||
aFile.close();
|
|
||||||
|
|
||||||
GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO");
|
|
||||||
|
|
||||||
if ( aObjects->length() > 0 && aInsOp->IsDone() ) {
|
|
||||||
aResult->length(aObjects->length());
|
|
||||||
// publish main object (first in the list of returned geom objects)
|
|
||||||
CORBA::String_var aName = aObjects[0]->GetName();
|
|
||||||
SALOMEDS::SObject_var aSO = PublishInStudy(aStudy.in(), SALOMEDS::SObject::_nil(), aObjects[0].in(), aName.in());
|
|
||||||
aResult[0] = aSO->GetID();
|
|
||||||
// publish groups && fields
|
|
||||||
for (int i = 1; i < aObjects->length(); i++ ) {
|
|
||||||
aName = aObjects[i]->GetName();
|
|
||||||
aSO = AddInStudy(aStudy.in(), aObjects[0].in(), aName.in(), aObjects[0].in());
|
|
||||||
aResult[i] = aSO->GetID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (aObjects->length() == 0)
|
|
||||||
MESSAGE("ImportXAO operation is failed for file "<<aFullPath.c_str());
|
|
||||||
if (!aInsOp->IsDone())
|
|
||||||
MESSAGE("Import operation is not done for file "<<aFullPath.c_str());
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove temporary file and directory
|
|
||||||
SALOMEDS::ListOfFileNames aTmpFiles;
|
|
||||||
aTmpFiles.length(1);
|
|
||||||
aTmpFiles[0] = aFileName.c_str();
|
|
||||||
SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aTmpFiles, true);
|
|
||||||
|
|
||||||
_impl->DocumentModified(studyId, false);
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : getModifiedData
|
|
||||||
// purpose : exports all geometry of this GEOM module into one BRep file
|
|
||||||
//=================================================================================
|
|
||||||
Engines::ListOfData* GEOM_Gen_i::getModifiedData(CORBA::Long studyId)
|
|
||||||
{
|
|
||||||
Engines::ListOfData_var aResult = new Engines::ListOfData;
|
|
||||||
|
|
||||||
if (!_impl->DocumentModified(studyId)) {
|
|
||||||
MESSAGE("Document is not modified")
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
CORBA::Object_var aSMObject = name_service->Resolve("/myStudyManager");
|
|
||||||
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
|
|
||||||
if (CORBA::is_nil(aStudyManager))
|
|
||||||
return aResult._retn();
|
|
||||||
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
|
|
||||||
if (CORBA::is_nil(aStudy))
|
|
||||||
return aResult._retn();
|
|
||||||
SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("GEOM");
|
|
||||||
if (CORBA::is_nil(aComponent))
|
|
||||||
return aResult._retn();
|
|
||||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published shapes
|
|
||||||
|
|
||||||
GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId());
|
|
||||||
if (aInsOp->_is_nil()) {
|
|
||||||
MESSAGE("No insert operations!");
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
GEOM::GEOM_Object_var shapeObj;
|
|
||||||
|
|
||||||
for(; anIter->More(); anIter->Next()) {
|
|
||||||
SALOMEDS::SObject_var aSO = anIter->Value();
|
|
||||||
SALOMEDS::SObject_var aRefSO;
|
|
||||||
// export only not referenced objects, or referenced outside of GEOM
|
|
||||||
if (!aSO->ReferencedObject(aRefSO) || aRefSO->GetFatherComponent()->GetID() != aComponent->GetID()) {
|
|
||||||
CORBA::Object_var anObj = aSO->GetObject();
|
|
||||||
if (!CORBA::is_nil(anObj)) {
|
|
||||||
GEOM::GEOM_Object_var aCORBAMainShape = GEOM::GEOM_Object::_narrow(anObj);
|
|
||||||
if(!aCORBAMainShape->_is_nil()) {
|
|
||||||
CORBA::String_var entry = aCORBAMainShape->GetEntry();
|
|
||||||
Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast(_impl->GetObject(studyId, entry));
|
|
||||||
|
|
||||||
GEOM::shape_type aCORBAShapeType = aCORBAMainShape->GetShapeType();
|
|
||||||
if (!aMainShape.IsNull() && !(aCORBAShapeType == GEOM::VERTEX) && !(aCORBAShapeType == GEOM::EDGE)) {
|
|
||||||
shapeObj = aCORBAMainShape;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CORBA::is_nil(shapeObj)) { // Shape is correct, write it to the temporary file
|
|
||||||
std::string aPath = Kernel_Utils::GetTmpFileName() + ".xao";
|
|
||||||
aInsOp->Export(shapeObj.in(), aPath.c_str(), "XAO");
|
|
||||||
aResult->length(1);
|
|
||||||
Engines::DataContainer_var aData = (new Engines_DataContainer_i(
|
|
||||||
aPath.c_str(), "", "", true))->_this();
|
|
||||||
aResult[0] = aData;
|
|
||||||
} else {
|
|
||||||
MESSAGE("No shapes to export");
|
|
||||||
}
|
|
||||||
|
|
||||||
return aResult._retn();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GetDependencyTree
|
// function : GetDependencyTree
|
||||||
// purpose : Collects dependencies of the given objects from other ones
|
// purpose : Collects dependencies of the given objects from other ones
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
||||||
const GEOM::string_array& theObjectEntries ) {
|
const GEOM::string_array& theObjectEntries ) {
|
||||||
// fill in the tree structure
|
// fill in the tree structure
|
||||||
GEOMUtils::TreeModel tree;
|
GEOMUtils::TreeModel tree;
|
||||||
|
|
||||||
@ -3102,7 +2958,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
|||||||
// translation the tree into string
|
// translation the tree into string
|
||||||
std::string treeStr;
|
std::string treeStr;
|
||||||
GEOMUtils::ConvertTreeToString( tree, treeStr );
|
GEOMUtils::ConvertTreeToString( tree, treeStr );
|
||||||
|
|
||||||
// put string into stream
|
// put string into stream
|
||||||
char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str());
|
char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str());
|
||||||
int aBufferSize = strlen((char*)aBuffer);
|
int aBufferSize = strlen((char*)aBuffer);
|
||||||
@ -3118,10 +2974,10 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
|||||||
// function : getUpwardDependency
|
// function : getUpwardDependency
|
||||||
// purpose : Collects the entries of objects on that the given one depends
|
// purpose : Collects the entries of objects on that the given one depends
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
GEOMUtils::LevelsList &upLevelList,
|
GEOMUtils::LevelsList &upLevelList,
|
||||||
std::map< std::string, std::set<std::string> > &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level ) {
|
int level ) {
|
||||||
std::string aGboEntry = gbo->GetEntry();
|
std::string aGboEntry = gbo->GetEntry();
|
||||||
GEOMUtils::NodeLinks anEntries;
|
GEOMUtils::NodeLinks anEntries;
|
||||||
GEOMUtils::LevelInfo aLevelMap;
|
GEOMUtils::LevelInfo aLevelMap;
|
||||||
@ -3133,7 +2989,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
// get the existent map
|
// get the existent map
|
||||||
aLevelMap = upLevelList.at(level-1);
|
aLevelMap = upLevelList.at(level-1);
|
||||||
if ( aLevelMap.count( aGboEntry ) > 0 ) {
|
if ( aLevelMap.count( aGboEntry ) > 0 ) {
|
||||||
anEntries = aLevelMap[ aGboEntry ];
|
anEntries = aLevelMap[ aGboEntry ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3144,7 +3000,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
if ( depList[j]->_is_nil() )
|
if ( depList[j]->_is_nil() )
|
||||||
continue;
|
continue;
|
||||||
aDepEntry = depList[j]->GetEntry();
|
aDepEntry = depList[j]->GetEntry();
|
||||||
if ( passedEntries.count( aGboEntry ) > 0 &&
|
if ( passedEntries.count( aGboEntry ) > 0 &&
|
||||||
passedEntries[aGboEntry].count( aDepEntry ) > 0 ) {
|
passedEntries[aGboEntry].count( aDepEntry ) > 0 ) {
|
||||||
//avoid checking the passed objects
|
//avoid checking the passed objects
|
||||||
continue;
|
continue;
|
||||||
@ -3166,10 +3022,10 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
// function : getDownwardDependency
|
// function : getDownwardDependency
|
||||||
// purpose : Collects the entries of objects that depends on the given one
|
// purpose : Collects the entries of objects that depends on the given one
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
GEOMUtils::LevelsList &downLevelList,
|
GEOMUtils::LevelsList &downLevelList,
|
||||||
std::map< std::string, std::set<std::string> > &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level ) {
|
int level ) {
|
||||||
std::string aGboEntry = gbo->GetEntry();
|
std::string aGboEntry = gbo->GetEntry();
|
||||||
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
|
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
|
||||||
Handle(TDataStd_TreeNode) aNode, aRoot;
|
Handle(TDataStd_TreeNode) aNode, aRoot;
|
||||||
@ -3201,7 +3057,7 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
continue;
|
continue;
|
||||||
if ( depList[i]->_is_equivalent( gbo ) ) {
|
if ( depList[i]->_is_equivalent( gbo ) ) {
|
||||||
// yes, the current object depends on the given object
|
// yes, the current object depends on the given object
|
||||||
if ( passedEntries.count( aGoEntry ) > 0 &&
|
if ( passedEntries.count( aGoEntry ) > 0 &&
|
||||||
passedEntries[aGoEntry].count( aGboEntry ) > 0 ) {
|
passedEntries[aGoEntry].count( aGboEntry ) > 0 ) {
|
||||||
//avoid checking the passed objects
|
//avoid checking the passed objects
|
||||||
continue;
|
continue;
|
||||||
@ -3234,10 +3090,10 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
// purpose : Fills 3 lists that is used to clean study of redundant objects
|
// purpose : Fills 3 lists that is used to clean study of redundant objects
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::string_array& theSelectedEntries,
|
GEOM::string_array& theSelectedEntries,
|
||||||
GEOM::string_array& theParentEntries,
|
GEOM::string_array& theParentEntries,
|
||||||
GEOM::string_array& theSubEntries,
|
GEOM::string_array& theSubEntries,
|
||||||
GEOM::string_array& theOtherEntries)
|
GEOM::string_array& theOtherEntries)
|
||||||
{
|
{
|
||||||
std::set<std::string> aSelected, aParents, aChildren, anOthers;
|
std::set<std::string> aSelected, aParents, aChildren, anOthers;
|
||||||
for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
|
for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
|
||||||
@ -3271,7 +3127,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
if ( aSelected.count( anEntry ) > 0 &&
|
if ( aSelected.count( anEntry ) > 0 &&
|
||||||
aParents.count( anEntry ) == 0 ) {
|
aParents.count( anEntry ) == 0 ) {
|
||||||
includeParentDependencies( geomObj, aSelected, aParents, aChildren, anOthers );
|
includeParentDependencies( geomObj, aSelected, aParents, aChildren, anOthers );
|
||||||
} else if ( aParents.count( anEntry ) == 0 &&
|
} else if ( aParents.count( anEntry ) == 0 &&
|
||||||
aChildren.count( anEntry ) == 0 ) {
|
aChildren.count( anEntry ) == 0 ) {
|
||||||
anOthers.insert( geomObj->GetEntry() );
|
anOthers.insert( geomObj->GetEntry() );
|
||||||
}
|
}
|
||||||
@ -3288,7 +3144,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if some selected object is not a main shape,
|
// if some selected object is not a main shape,
|
||||||
// we move it's main shapes into 'selected' list,
|
// we move it's main shapes into 'selected' list,
|
||||||
// because they could not be modified anyhow.
|
// because they could not be modified anyhow.
|
||||||
std::set<std::string> aToBeInSelected;
|
std::set<std::string> aToBeInSelected;
|
||||||
for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
|
for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
|
||||||
@ -3341,13 +3197,13 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// function : includeParentDependencies
|
// function : includeParentDependencies
|
||||||
// purpose :
|
// purpose :
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
|
void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
|
||||||
std::set<std::string>& aSelected,
|
std::set<std::string>& aSelected,
|
||||||
std::set<std::string>& aParents,
|
std::set<std::string>& aParents,
|
||||||
std::set<std::string>& aChildren,
|
std::set<std::string>& aChildren,
|
||||||
std::set<std::string>& anOthers)
|
std::set<std::string>& anOthers)
|
||||||
{
|
{
|
||||||
std::string anEntry = geomObj->GetEntry();
|
std::string anEntry = geomObj->GetEntry();
|
||||||
if ( aSelected.count( anEntry ) == 0 ) {
|
if ( aSelected.count( anEntry ) == 0 ) {
|
||||||
@ -3369,10 +3225,10 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
|
|||||||
for( int i = 0; i < depList->length(); i++ ) {
|
for( int i = 0; i < depList->length(); i++ ) {
|
||||||
aDepEntry = depList[i]->GetEntry();
|
aDepEntry = depList[i]->GetEntry();
|
||||||
if ( depList[i]->_is_nil() ||
|
if ( depList[i]->_is_nil() ||
|
||||||
aDepEntry == anEntry || // skip self-depending
|
aDepEntry == anEntry || // skip self-depending
|
||||||
aSelected.count( aDepEntry ) > 0 || // skip selected objects
|
aSelected.count( aDepEntry ) > 0 || // skip selected objects
|
||||||
aParents.count( aDepEntry ) > 0 // skip already processed objects
|
aParents.count( aDepEntry ) > 0 // skip already processed objects
|
||||||
)
|
)
|
||||||
continue;
|
continue;
|
||||||
includeParentDependencies( depList[i], aSelected, aParents, aChildren, anOthers );
|
includeParentDependencies( depList[i], aSelected, aParents, aChildren, anOthers );
|
||||||
}
|
}
|
||||||
@ -3380,14 +3236,14 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// function : includeSubObjects
|
// function : includeSubObjects
|
||||||
// purpose :
|
// purpose :
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
|
void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
|
||||||
const std::string& aSelectedEntry,
|
const std::string& aSelectedEntry,
|
||||||
std::set<std::string>& aSelected,
|
std::set<std::string>& aSelected,
|
||||||
std::set<std::string>& aParents,
|
std::set<std::string>& aParents,
|
||||||
std::set<std::string>& aChildren,
|
std::set<std::string>& aChildren,
|
||||||
std::set<std::string>& anOthers)
|
std::set<std::string>& anOthers)
|
||||||
{
|
{
|
||||||
std::set<std::string>::iterator foundIt;
|
std::set<std::string>::iterator foundIt;
|
||||||
Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
|
Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
|
||||||
@ -3412,10 +3268,10 @@ void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
|
|||||||
if ( foundIt == aParents.end() ) { // add to sub-objects if it is not in parents list
|
if ( foundIt == aParents.end() ) { // add to sub-objects if it is not in parents list
|
||||||
foundIt = aSelected.find( aSubEntryStr );
|
foundIt = aSelected.find( aSubEntryStr );
|
||||||
if ( foundIt == aSelected.end() ) { // add to sub-objects if it is not in selected list
|
if ( foundIt == aSelected.end() ) { // add to sub-objects if it is not in selected list
|
||||||
aChildren.insert( aSubEntryStr );
|
aChildren.insert( aSubEntryStr );
|
||||||
foundIt = anOthers.find( aSubEntryStr );
|
foundIt = anOthers.find( aSubEntryStr );
|
||||||
if ( foundIt != anOthers.end() )
|
if ( foundIt != anOthers.end() )
|
||||||
anOthers.erase( foundIt );
|
anOthers.erase( foundIt );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
includeSubObjects( theStudy, aSubEntryStr, aSelected, aParents, aChildren, anOthers );
|
includeSubObjects( theStudy, aSubEntryStr, aSelected, aParents, aChildren, anOthers );
|
||||||
|
@ -201,7 +201,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
|
|
||||||
//Collects dependencies of the given objects from other ones
|
//Collects dependencies of the given objects from other ones
|
||||||
SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy,
|
SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy,
|
||||||
const GEOM::string_array& theObjectEntries);
|
const GEOM::string_array& theObjectEntries);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// Transaction methods //
|
// Transaction methods //
|
||||||
@ -301,37 +301,30 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
virtual char* getVersion();
|
virtual char* getVersion();
|
||||||
|
|
||||||
// Create a new folder object
|
// Create a new folder object
|
||||||
SALOMEDS::SObject_ptr CreateFolder(const char* theName,
|
SALOMEDS::SObject_ptr CreateFolder(const char* theName,
|
||||||
SALOMEDS::SObject_ptr theFather);
|
SALOMEDS::SObject_ptr theFather);
|
||||||
|
|
||||||
// Move GEOM object to the specified folder
|
// Move GEOM object to the specified folder
|
||||||
void MoveToFolder(GEOM::GEOM_Object_ptr theObject,
|
void MoveToFolder(GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theFolder);
|
SALOMEDS::SObject_ptr theFolder);
|
||||||
|
|
||||||
// Move list of GEOM objects to the specified folder
|
// Move list of GEOM objects to the specified folder
|
||||||
void MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
|
void MoveListToFolder (const GEOM::ListOfGO& theListOfGO,
|
||||||
SALOMEDS::SObject_ptr theFolder);
|
SALOMEDS::SObject_ptr theFolder);
|
||||||
|
|
||||||
// Move objects to the specified position
|
// Move objects to the specified position
|
||||||
void Move( const GEOM::object_list& what,
|
void Move( const GEOM::object_list& what,
|
||||||
SALOMEDS::SObject_ptr where,
|
SALOMEDS::SObject_ptr where,
|
||||||
CORBA::Long row );
|
CORBA::Long row );
|
||||||
|
|
||||||
// SIMAN-related functions (check out/check in) : import data to study
|
|
||||||
virtual Engines::ListOfIdentifiers* importData(CORBA::Long studyId,
|
|
||||||
Engines::DataContainer_ptr data,
|
|
||||||
const Engines::ListOfOptions& options);
|
|
||||||
// SIMAN-related functions (check out/check in) : get modified data
|
|
||||||
virtual Engines::ListOfData* getModifiedData(CORBA::Long studyId);
|
|
||||||
|
|
||||||
/*! \brief Fills 3 lists that is used to clean study of redundant objects.
|
/*! \brief Fills 3 lists that is used to clean study of redundant objects.
|
||||||
* To be used from GUI.
|
* To be used from GUI.
|
||||||
*/
|
*/
|
||||||
void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::string_array& theSelectedEntries,
|
GEOM::string_array& theSelectedEntries,
|
||||||
GEOM::string_array& theParentEntries,
|
GEOM::string_array& theParentEntries,
|
||||||
GEOM::string_array& theSubEntries,
|
GEOM::string_array& theSubEntries,
|
||||||
GEOM::string_array& theOtherEntries);
|
GEOM::string_array& theOtherEntries);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// Internal methods //
|
// Internal methods //
|
||||||
@ -381,28 +374,28 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
const Standard_CString& GrName,
|
const Standard_CString& GrName,
|
||||||
GEOM::ListOfGO_var aResList);
|
GEOM::ListOfGO_var aResList);
|
||||||
|
|
||||||
void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
GEOMUtils::LevelsList &upLevelList,
|
GEOMUtils::LevelsList &upLevelList,
|
||||||
std::map< std::string, std::set<std::string> > &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level = 0 );
|
int level = 0 );
|
||||||
|
|
||||||
void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
GEOMUtils::LevelsList &downLevelList,
|
GEOMUtils::LevelsList &downLevelList,
|
||||||
std::map< std::string, std::set<std::string> > &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level = 0 );
|
int level = 0 );
|
||||||
|
|
||||||
void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo,
|
void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
std::set<std::string>& aSelected,
|
std::set<std::string>& aSelected,
|
||||||
std::set<std::string>& aParents,
|
std::set<std::string>& aParents,
|
||||||
std::set<std::string>& aChildren,
|
std::set<std::string>& aChildren,
|
||||||
std::set<std::string>& anOthers);
|
std::set<std::string>& anOthers);
|
||||||
|
|
||||||
void includeSubObjects(SALOMEDS::Study_ptr theStudy,
|
void includeSubObjects(SALOMEDS::Study_ptr theStudy,
|
||||||
const std::string& aSelectedEntry,
|
const std::string& aSelectedEntry,
|
||||||
std::set<std::string>& aSelected,
|
std::set<std::string>& aSelected,
|
||||||
std::set<std::string>& aParents,
|
std::set<std::string>& aParents,
|
||||||
std::set<std::string>& aChildren,
|
std::set<std::string>& aChildren,
|
||||||
std::set<std::string>& anOthers);
|
std::set<std::string>& anOthers);
|
||||||
|
|
||||||
void LoadPlugin(const std::string& theLibName);
|
void LoadPlugin(const std::string& theLibName);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user