Correction 2 of GUI part

This commit is contained in:
mpa 2014-05-23 15:43:01 +04:00
parent a782d52dec
commit e39d0de8bc
3 changed files with 68 additions and 15 deletions

View File

@ -152,6 +152,7 @@ std::string DependencyTree_Object::getEntry() const
//================================================================================= //=================================================================================
void DependencyTree_Object::updateName() void DependencyTree_Object::updateName()
{ {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return; if ( !app ) return;
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy()); SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
@ -160,8 +161,15 @@ void DependencyTree_Object::updateName()
GEOM::_objref_GEOM_BaseObject* object = GeometryGUI::GetGeomGen()->GetObject( StudyId, myEntry.c_str() ); GEOM::_objref_GEOM_BaseObject* object = GeometryGUI::GetGeomGen()->GetObject( StudyId, myEntry.c_str() );
QString name = object->GetName(); QString name = object->GetName();
QString StudyEntry = object->GetStudyEntry();
std::cout << "\n\n\n StudyEntry = " << StudyEntry.toStdString() << " " << StudyEntry.isEmpty() << std::endl;
// QString name = myEntry.c_str();
if( StudyEntry.isEmpty() ) {
if( name.isEmpty() )
name = "unpublished";
myColor = resMgr->colorValue( "Geometry", "dependency_tree_background_color", QColor( 255, 255, 255 ) );
}
setName( name ); setName( name );

View File

@ -101,16 +101,18 @@ void DependencyTree_View::drawArrows()
GEOMUtils::TreeModel::const_iterator i; GEOMUtils::TreeModel::const_iterator i;
for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) { for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) {
DependencyTree_Object* Main_object = myTreeMap[i->first]; DependencyTree_Object* Main_object = myTreeMap[i->first];
GEOMUtils::LevelInfo Levelup = i->second.first.at(0); if( i->second.first.size() > 0 ) {
if( myDisplayAscendants ->isChecked() ) { GEOMUtils::LevelInfo Levelup = i->second.first.at(0);
GEOMUtils::LevelInfo::const_iterator node; if( myDisplayAscendants ->isChecked() ) {
for (node = Levelup.begin(); node != Levelup.end(); node++ ) { GEOMUtils::LevelInfo::const_iterator node;
DependencyTree_Object* object = myTreeMap[node->first]; for (node = Levelup.begin(); node != Levelup.end(); node++ ) {
DependencyTree_Arrow* arrow = Arrows[std::pair<DependencyTree_Object*,DependencyTree_Object*>(Main_object, object)]; DependencyTree_Object* object = myTreeMap[node->first];
if( arrow && !isItemAdded( arrow) ) DependencyTree_Arrow* arrow = Arrows[std::pair<DependencyTree_Object*,DependencyTree_Object*>(Main_object, object)];
addItem( arrow ); if( arrow && !isItemAdded( arrow) )
addItem( arrow );
}
} }
} }
if( myDisplayAscendants ->isChecked() ) if( myDisplayAscendants ->isChecked() )
drawWardArrows( i->second.first ); drawWardArrows( i->second.first );
if( myDisplayDescendants->isChecked() ) if( myDisplayDescendants->isChecked() )
@ -158,11 +160,13 @@ void DependencyTree_View::parseTree()
for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) { for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) {
DependencyTree_Object* Main_object = myTreeMap[i->first]; DependencyTree_Object* Main_object = myTreeMap[i->first];
GEOMUtils::LevelInfo Levelup = i->second.first.at(0); if( i->second.first.size() > 0 ) {
GEOMUtils::LevelInfo::const_iterator node; GEOMUtils::LevelInfo Levelup = i->second.first.at(0);
for (node = Levelup.begin(); node != Levelup.end(); node++ ) { GEOMUtils::LevelInfo::const_iterator node;
DependencyTree_Object* object = myTreeMap[node->first]; for (node = Levelup.begin(); node != Levelup.end(); node++ ) {
addArrow( Main_object, object ); DependencyTree_Object* object = myTreeMap[node->first];
addArrow( Main_object, object );
}
} }
parseTreeWardArrow( i->second.first ); parseTreeWardArrow( i->second.first );
parseTreeWardArrow( i->second.second ); parseTreeWardArrow( i->second.second );
@ -699,6 +703,45 @@ void DependencyTree_View::setSelectArrowColor( const QColor& theColor )
} }
} }
int DependencyTree_View::select( const QRectF& theRect, bool theIsAppend )
{
GraphicsView_ViewPort::select( theRect, theIsAppend );
// SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
//
// LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
//
// // get selection
// SALOME_ListIO listIO;
//
// SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
// SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy( study->studyDS());
// int StudyId = aStudyDS->StudyId();
// for( initSelected(); moreSelected(); nextSelected() )
// if( DependencyTree_Object* aDepObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) ) {
//
// _PTR(SObject) SO ( aStudyDS->FindObjectID( aDepObject->getEntry().c_str() ) );
// if ( SO ) { //;&& QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str()) ) {
// _PTR(SComponent) SC ( SO->GetFatherComponent() );
// // if component is selected
// _PTR(ChildIterator) anIter ( aStudyDS->NewChildIterator( SO ) );
// anIter->InitEx( true );
// while( anIter->More() ) {
// _PTR(SObject) valSO ( anIter->Value() );
// _PTR(SObject) refSO;
// if ( !valSO->ReferencedObject( refSO ) ) {
// listIO.Append( new SALOME_InteractiveObject(valSO->GetID().c_str(),
// SC->ComponentDataType().c_str(),
// valSO->GetName().c_str()) );
// }
// anIter->Next();
// }
// break;
// }
// }
// aSelMgr->setSelectedObjects( listIO, true );
}
//================================================================================ //================================================================================
//================================================================================ //================================================================================

View File

@ -74,6 +74,8 @@ public:
void setHighlightArrowColor( const QColor& ); void setHighlightArrowColor( const QColor& );
void setSelectArrowColor( const QColor& ); void setSelectArrowColor( const QColor& );
virtual int select( const QRectF&, bool );
// typedef QList<QString> NodeLinks; // typedef QList<QString> NodeLinks;
// typedef QMap<QString, NodeLinks> LevelInfo; // typedef QMap<QString, NodeLinks> LevelInfo;
// typedef QList<LevelInfo> LevelsList; // typedef QList<LevelInfo> LevelsList;