mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-24 10:05:36 +05:00
Correction of case with bi-directional links.
This commit is contained in:
parent
965dcbfba8
commit
178a0726fb
@ -3057,14 +3057,13 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
|||||||
GEOM::GEOM_BaseObject_var anObj = GetObject( theStudy->StudyId(), entry.c_str() );
|
GEOM::GEOM_BaseObject_var anObj = GetObject( theStudy->StudyId(), entry.c_str() );
|
||||||
if ( anObj->_is_nil() )
|
if ( anObj->_is_nil() )
|
||||||
continue;
|
continue;
|
||||||
std::set<std::string> passedEntries;
|
std::map< std::string, std::set<std::string> > passedEntries;
|
||||||
passedEntries.insert( entry );
|
|
||||||
GEOMUtils::LevelsList upLevelList;
|
GEOMUtils::LevelsList upLevelList;
|
||||||
// get objects from which current one depends on recursively
|
// get objects from which current one depends on recursively
|
||||||
getUpwardDependency( anObj, upLevelList, passedEntries );
|
getUpwardDependency( anObj, upLevelList, passedEntries );
|
||||||
GEOMUtils::LevelsList downLevelList;
|
GEOMUtils::LevelsList downLevelList;
|
||||||
// get objects that depends on current one recursively
|
// get objects that depends on current one recursively
|
||||||
//getDownwardDependency( anObj, downLevelList, passedEntries );
|
getDownwardDependency( anObj, downLevelList, passedEntries );
|
||||||
tree.insert( std::pair<std::string, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList> >(entry, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList>( upLevelList, downLevelList ) ) );
|
tree.insert( std::pair<std::string, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList> >(entry, std::pair<GEOMUtils::LevelsList,GEOMUtils::LevelsList>( upLevelList, downLevelList ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3089,18 +3088,9 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
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::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();
|
||||||
passedEntries.insert( aGboEntry );
|
|
||||||
/*
|
|
||||||
for (int i=0; i < upLevelList.size(); i++ ) {
|
|
||||||
GEOMUtils::LevelInfo aMap = upLevelList.at(i);
|
|
||||||
if ( aMap.count( aGboEntry ) > 0 )
|
|
||||||
// this object has been processed earlier
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
GEOMUtils::NodeLinks anEntries;
|
GEOMUtils::NodeLinks anEntries;
|
||||||
GEOMUtils::LevelInfo aLevelMap;
|
GEOMUtils::LevelInfo aLevelMap;
|
||||||
if ( level > 0 ) {
|
if ( level > 0 ) {
|
||||||
@ -3117,15 +3107,22 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
}
|
}
|
||||||
// get objects on that the current one depends
|
// get objects on that the current one depends
|
||||||
GEOM::ListOfGBO_var depList = gbo->GetDependency();
|
GEOM::ListOfGBO_var depList = gbo->GetDependency();
|
||||||
|
std::string aDepEntry;
|
||||||
for( int j = 0; j < depList->length(); j++ ) {
|
for( int j = 0; j < depList->length(); j++ ) {
|
||||||
if ( depList[j]->_is_nil() )
|
if ( depList[j]->_is_nil() )
|
||||||
continue;
|
continue;
|
||||||
|
aDepEntry = depList[j]->GetEntry();
|
||||||
|
if ( passedEntries.count( aGboEntry ) > 0 &&
|
||||||
|
passedEntries[aGboEntry].count( aDepEntry ) > 0 ) {
|
||||||
|
//avoid checking the passed objects
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
passedEntries[aGboEntry].insert( aDepEntry );
|
||||||
if ( level > 0 ) {
|
if ( level > 0 ) {
|
||||||
anEntries.push_back( depList[j]->GetEntry() );
|
anEntries.push_back( aDepEntry );
|
||||||
}
|
}
|
||||||
// get dependencies recursively
|
// get dependencies recursively
|
||||||
if ( !depList[j]->_is_equivalent( gbo ) && /*avoid self-recursion*/
|
if ( !depList[j]->_is_equivalent( gbo ) /*avoid self-recursion*/ ) {
|
||||||
passedEntries.count( depList[j]->GetEntry() ) == 0 /*avoid checking the passed objects*/ ) {
|
|
||||||
getUpwardDependency(depList[j], upLevelList, passedEntries, level+1);
|
getUpwardDependency(depList[j], upLevelList, passedEntries, level+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3141,8 +3138,9 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
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::set<std::string> &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level ) {
|
int level ) {
|
||||||
|
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;
|
||||||
Handle(GEOM_Function) aFunction;
|
Handle(GEOM_Function) aFunction;
|
||||||
@ -3173,9 +3171,15 @@ 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 &&
|
||||||
|
passedEntries[aGoEntry].count( aGboEntry ) > 0 ) {
|
||||||
|
//avoid checking the passed objects
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
passedEntries[aGoEntry].insert( aGboEntry );
|
||||||
GEOMUtils::NodeLinks anEntries;
|
GEOMUtils::NodeLinks anEntries;
|
||||||
GEOMUtils::LevelInfo aLevelMap;
|
GEOMUtils::LevelInfo aLevelMap;
|
||||||
anEntries.push_back( gbo->GetEntry());
|
anEntries.push_back( aGboEntry );
|
||||||
if ( level >= downLevelList.size() ) {
|
if ( level >= downLevelList.size() ) {
|
||||||
downLevelList.push_back( aLevelMap );
|
downLevelList.push_back( aLevelMap );
|
||||||
} else {
|
} else {
|
||||||
|
@ -374,12 +374,12 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
|
|
||||||
void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||||
GEOMUtils::LevelsList &upLevelList,
|
GEOMUtils::LevelsList &upLevelList,
|
||||||
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::set<std::string> &passedEntries,
|
std::map< std::string, std::set<std::string> > &passedEntries,
|
||||||
int level = 0 );
|
int level = 0 );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user