mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-12 00:29:18 +05:00
Debug of GetDependencyTree.
This commit is contained in:
parent
bec320673b
commit
0fd903e83e
@ -26,13 +26,13 @@ INCLUDE(${QT_USE_FILE})
|
||||
INCLUDE_DIRECTORIES(
|
||||
${QT_INCLUDES}
|
||||
${GUI_INCLUDE_DIRS}
|
||||
${CAS_INCLUDE_DIRS}
|
||||
${OMNIORB_INCLUDE_DIR}
|
||||
${CAS_INCLUDE_DIRS}
|
||||
${OMNIORB_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMGUI
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMBase
|
||||
${PROJECT_SOURCE_DIR}/src/GEOM
|
||||
${PROJECT_SOURCE_DIR}/src/GEOM
|
||||
|
||||
|
||||
${PROJECT_BINARY_DIR}/idl
|
||||
@ -40,6 +40,7 @@ INCLUDE_DIRECTORIES(
|
||||
${PROJECT_SOURCE_DIR}/src/OBJECT
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMClient
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMImpl
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMUtils
|
||||
${PROJECT_SOURCE_DIR}/src/DlgRef
|
||||
${PROJECT_BINARY_DIR}/src/DlgRef
|
||||
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include <GEOM_InteractiveObject.hxx>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
#include "GEOMUtils.hxx"
|
||||
|
||||
|
||||
|
||||
@ -85,7 +86,7 @@ myIsUpdate( true )
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||
if ( !aSelMgr ) return;
|
||||
|
||||
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
@ -106,7 +107,8 @@ myIsUpdate( true )
|
||||
|
||||
GEOM::GEOM_Object_var myObject = GEOM::GEOM_Object::_nil();
|
||||
myObject = GEOMBase::ConvertIOinGEOMObject( io );
|
||||
QString ior = GEOMBase::GetIORFromObject(myObject);
|
||||
//QString ior = GEOMBase::GetIORFromObject(myObject);
|
||||
QString ior = myObject->GetEntry();
|
||||
ObjectIORs[aaa] = ior.toLatin1().constData();
|
||||
aaa++;
|
||||
|
||||
@ -133,12 +135,18 @@ myIsUpdate( true )
|
||||
//
|
||||
// }
|
||||
|
||||
// get dependencies tree as a stream
|
||||
SALOMEDS::TMPFile_var SeqFile =
|
||||
GeometryGUI::GetGeomGen()->GetDependencyTree( aStudyDS, ObjectIORs );
|
||||
char* buf;
|
||||
buf = (char*) &SeqFile[0];
|
||||
GeometryGUI::GetGeomGen()->GetDependencyTree( aStudyDS, ObjectIORs );
|
||||
// convert stream into string
|
||||
char* treeStr;
|
||||
treeStr = (char*) &SeqFile[0];
|
||||
|
||||
std::cout << "\n\n\n\n\n TREE = " << buf << std::endl;
|
||||
std::cout << "\n TREE = " << treeStr << std::endl;
|
||||
|
||||
// parse string to deal with 'TreeModel' object
|
||||
GEOMUtils::TreeModel tree;
|
||||
GEOMUtils::ConvertStringToTree( treeStr, tree );
|
||||
}
|
||||
|
||||
DependencyTree_View::~DependencyTree_View()
|
||||
|
@ -963,6 +963,30 @@ gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
|
||||
return ResultPoint;
|
||||
}
|
||||
|
||||
void parseWard( const LevelsList &theLevelList, std::string &treeStr )
|
||||
{
|
||||
treeStr.append( "{" );
|
||||
for( LevelsList::const_iterator j = theLevelList.begin();
|
||||
j != theLevelList.end(); ++j ) {
|
||||
if ( j != theLevelList.begin() ) {
|
||||
treeStr.append( ";" );
|
||||
}
|
||||
LevelInfo level = (*j);
|
||||
LevelInfo::iterator upIter;
|
||||
for ( upIter = level.begin(); upIter != level.end(); ++upIter ) {
|
||||
if ( upIter != level.begin() ) {
|
||||
treeStr.append( "," );
|
||||
}
|
||||
treeStr.append( upIter->first );
|
||||
for ( std::vector<std::string>::iterator k = upIter->second.begin(); k != upIter->second.end(); ++k ) {
|
||||
treeStr.append( "_" );
|
||||
treeStr.append( *k );
|
||||
}
|
||||
}
|
||||
}
|
||||
treeStr.append( "}" );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : ConvertTreeToString()
|
||||
// purpose : Returns the string representation of dependency tree
|
||||
@ -976,42 +1000,10 @@ void ConvertTreeToString( const TreeModel &tree,
|
||||
treeStr.append( "-" );
|
||||
std::vector<LevelInfo> upLevelList = i->second.first;
|
||||
treeStr.append( "upward" );
|
||||
treeStr.append( "{" );
|
||||
for( std::vector<LevelInfo>::iterator j = upLevelList.begin();
|
||||
j != upLevelList.end(); ++j ) {
|
||||
LevelInfo level = (*j);
|
||||
LevelInfo::iterator upIter;
|
||||
for ( upIter = level.begin(); upIter != level.end(); ++upIter ) {
|
||||
treeStr.append( upIter->first );
|
||||
for ( std::vector<std::string>::iterator k = upIter->second.begin();
|
||||
k != upIter->second.end(); ++k ) {
|
||||
treeStr.append( "_" );
|
||||
treeStr.append( *k );
|
||||
}
|
||||
treeStr.append( upIter++ == level.end() ? ";" : "," );
|
||||
upIter--;
|
||||
}
|
||||
}
|
||||
treeStr.append( "}" );
|
||||
parseWard( upLevelList, treeStr );
|
||||
std::vector<LevelInfo> downLevelList = i->second.second;
|
||||
treeStr.append( "downward" );
|
||||
treeStr.append( "{" );
|
||||
for( std::vector<LevelInfo>::iterator j = downLevelList.begin();
|
||||
j != downLevelList.end(); ++j ) {
|
||||
LevelInfo level = (*j);
|
||||
LevelInfo::iterator downIter;
|
||||
for ( downIter = level.begin(); downIter != level.end(); ++downIter ) {
|
||||
treeStr.append( downIter->first );
|
||||
for ( std::vector<std::string>::iterator k = downIter->second.begin();
|
||||
k != downIter->second.end(); ++k ) {
|
||||
treeStr.append( "_" );
|
||||
treeStr.append( *k );
|
||||
}
|
||||
treeStr.append( downIter++ == level.end() ? ";" : "," );
|
||||
downIter--;
|
||||
}
|
||||
}
|
||||
treeStr.append("}");
|
||||
parseWard( downLevelList, treeStr );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3052,7 +3052,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
||||
std::string ior;
|
||||
for ( int i = 0; i < theObjectIORs.length(); i++ ) {
|
||||
ior = theObjectIORs[i].in();
|
||||
GEOM::GEOM_Object_ptr anObj = GetIORFromString( ior.c_str() );
|
||||
GEOM::GEOM_BaseObject_var anObj = GetObject( theStudy->StudyId(), ior.c_str() );
|
||||
GEOMUtils::LevelsList upLevelList;
|
||||
getUpwardDependency( anObj, upLevelList );
|
||||
GEOMUtils::LevelsList downLevelList;
|
||||
@ -3081,23 +3081,38 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
||||
void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
GEOMUtils::LevelsList &upLevelList,
|
||||
int level ) {
|
||||
std::string aGboIOR = GetStringFromIOR(GEOM::GEOM_Object::_narrow(gbo));
|
||||
std::string aGboIOR = gbo->GetEntry();
|
||||
//std::cout << "\n\nAKL: upnode IOR: " << aGboIOR << endl;
|
||||
//std::cout << "AKL: level: " << level << endl;
|
||||
GEOMUtils::NodeLinks anIORs;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
if ( level > 0 ) {
|
||||
if ( level-1 >= upLevelList.size() ) {
|
||||
upLevelList.push_back( aLevelMap );
|
||||
//std::cout << "AKL: new map" << endl;
|
||||
} else {
|
||||
aLevelMap = upLevelList.at(level-1);
|
||||
if ( aLevelMap.count( aGboIOR ) > 0 ) {
|
||||
anIORs = aLevelMap[ aGboIOR ];
|
||||
//std::cout << "AKL: get already added iors list: " << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
GEOM::ListOfGBO_var depList = gbo->GetDependency();
|
||||
for( int j = 0; j < depList->length(); j++ ) {
|
||||
if ( level > 0 ) {
|
||||
GEOMUtils::NodeLinks anIORs;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
if ( level-1 >= upLevelList.size() ) {
|
||||
upLevelList.push_back( aLevelMap );
|
||||
} else {
|
||||
aLevelMap = upLevelList.at(level-1);
|
||||
if ( aLevelMap.count( aGboIOR ) > 0 )
|
||||
anIORs = aLevelMap[ aGboIOR ];
|
||||
}
|
||||
anIORs.push_back( GetStringFromIOR(GEOM::GEOM_Object::_narrow(depList[j])) );
|
||||
aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGboIOR, anIORs) );
|
||||
anIORs.push_back( depList[j]->GetEntry() );
|
||||
//std::cout << "AKL: add link ior: " << depList[j]->GetEntry() << endl;
|
||||
}
|
||||
getUpwardDependency(depList[j], upLevelList, level++);
|
||||
//std::cout << "AKL: <<<<<<<< start next step: " << endl;
|
||||
getUpwardDependency(depList[j], upLevelList, level+1);
|
||||
//std::cout << "AKL: end next step >>>>>>>> : " << endl;
|
||||
}
|
||||
if ( level > 0 ) {
|
||||
//std::cout << "AKL: insert links for node: " << aGboIOR << endl;
|
||||
aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGboIOR, anIORs) );
|
||||
//std::cout << "AKL: insert level map: " << endl;
|
||||
upLevelList[level-1] = aLevelMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3113,6 +3128,21 @@ void GEOM_Gen_i::getDownwardDependency( SALOMEDS::Study_ptr theStudy,
|
||||
if ( !comp )
|
||||
return;
|
||||
|
||||
GEOMUtils::NodeLinks anIORs;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
std::string aGboIOR = gbo->GetEntry();
|
||||
if ( level > 0 ) {
|
||||
if ( level-1 >= downLevelList.size() ) {
|
||||
downLevelList.push_back( aLevelMap );
|
||||
//std::cout << "AKL: new map" << endl;
|
||||
} else {
|
||||
aLevelMap = downLevelList.at(level-1);
|
||||
if ( aLevelMap.count( aGboIOR ) > 0 ) {
|
||||
anIORs = aLevelMap[ aGboIOR ];
|
||||
//std::cout << "AKL: get already added iors list: " << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( comp );
|
||||
for ( it->InitEx( true ); it->More(); it->Next() ) {
|
||||
SALOMEDS::SObject_var child = it->Value();
|
||||
@ -3124,25 +3154,20 @@ void GEOM_Gen_i::getDownwardDependency( SALOMEDS::Study_ptr theStudy,
|
||||
GEOM::ListOfGBO_var depList = geomObj->GetDependency();
|
||||
if( depList->length() == 0 )
|
||||
continue;
|
||||
std::string aGoIOR = GetStringFromIOR( geomObj );
|
||||
std::string aGoIOR = geomObj->GetEntry();
|
||||
|
||||
for( int i = 0; i < depList->length(); i++ ) {
|
||||
if ( depList[i]->IsSame( gbo ) ) {
|
||||
GEOMUtils::NodeLinks anIORs;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
if ( level >= downLevelList.size() ) {
|
||||
aLevelMap = GEOMUtils::LevelInfo();
|
||||
downLevelList.push_back( aLevelMap );
|
||||
} else {
|
||||
aLevelMap = downLevelList.at(level);
|
||||
if ( aLevelMap.count( aGoIOR ) > 0 )
|
||||
anIORs = aLevelMap[ aGoIOR ];
|
||||
}
|
||||
anIORs.push_back( GetStringFromIOR(GEOM::GEOM_Object::_narrow(depList[i])));
|
||||
aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGoIOR, anIORs) );
|
||||
if ( level > 0 ) {
|
||||
anIORs.push_back( geomObj->GetEntry());
|
||||
}
|
||||
getDownwardDependency(theStudy, geomObj, downLevelList, level+1);
|
||||
}
|
||||
}
|
||||
getDownwardDependency(theStudy, geomObj, downLevelList, level++);
|
||||
}
|
||||
if ( level > 0 ) {
|
||||
aLevelMap.insert( std::pair<std::string, GEOMUtils::NodeLinks>(aGboIOR, anIORs) );
|
||||
downLevelList[level-1] = aLevelMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user