diff --git a/src/DependencyTree/DependencyTree_Object.cxx b/src/DependencyTree/DependencyTree_Object.cxx index 0f85a0405..2f839df33 100644 --- a/src/DependencyTree/DependencyTree_Object.cxx +++ b/src/DependencyTree/DependencyTree_Object.cxx @@ -152,6 +152,7 @@ std::string DependencyTree_Object::getEntry() const //================================================================================= void DependencyTree_Object::updateName() { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); if ( !app ) return; SalomeApp_Study* study = dynamic_cast(app->activeStudy()); @@ -160,8 +161,15 @@ void DependencyTree_Object::updateName() GEOM::_objref_GEOM_BaseObject* object = GeometryGUI::GetGeomGen()->GetObject( StudyId, myEntry.c_str() ); 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 ); diff --git a/src/DependencyTree/DependencyTree_View.cxx b/src/DependencyTree/DependencyTree_View.cxx index 198a50bc6..9a3a50774 100644 --- a/src/DependencyTree/DependencyTree_View.cxx +++ b/src/DependencyTree/DependencyTree_View.cxx @@ -101,16 +101,18 @@ void DependencyTree_View::drawArrows() GEOMUtils::TreeModel::const_iterator i; for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) { DependencyTree_Object* Main_object = myTreeMap[i->first]; - GEOMUtils::LevelInfo Levelup = i->second.first.at(0); - if( myDisplayAscendants ->isChecked() ) { - GEOMUtils::LevelInfo::const_iterator node; - for (node = Levelup.begin(); node != Levelup.end(); node++ ) { - DependencyTree_Object* object = myTreeMap[node->first]; - DependencyTree_Arrow* arrow = Arrows[std::pair(Main_object, object)]; - if( arrow && !isItemAdded( arrow) ) - addItem( arrow ); + if( i->second.first.size() > 0 ) { + GEOMUtils::LevelInfo Levelup = i->second.first.at(0); + if( myDisplayAscendants ->isChecked() ) { + GEOMUtils::LevelInfo::const_iterator node; + for (node = Levelup.begin(); node != Levelup.end(); node++ ) { + DependencyTree_Object* object = myTreeMap[node->first]; + DependencyTree_Arrow* arrow = Arrows[std::pair(Main_object, object)]; + if( arrow && !isItemAdded( arrow) ) + addItem( arrow ); + } } - } + } if( myDisplayAscendants ->isChecked() ) drawWardArrows( i->second.first ); if( myDisplayDescendants->isChecked() ) @@ -158,11 +160,13 @@ void DependencyTree_View::parseTree() for (i = myTreeModel.begin(); i != myTreeModel.end(); i++ ) { DependencyTree_Object* Main_object = myTreeMap[i->first]; - GEOMUtils::LevelInfo Levelup = i->second.first.at(0); - GEOMUtils::LevelInfo::const_iterator node; - for (node = Levelup.begin(); node != Levelup.end(); node++ ) { - DependencyTree_Object* object = myTreeMap[node->first]; - addArrow( Main_object, object ); + if( i->second.first.size() > 0 ) { + GEOMUtils::LevelInfo Levelup = i->second.first.at(0); + GEOMUtils::LevelInfo::const_iterator node; + for (node = Levelup.begin(); node != Levelup.end(); node++ ) { + DependencyTree_Object* object = myTreeMap[node->first]; + addArrow( Main_object, object ); + } } parseTreeWardArrow( i->second.first ); 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(app->activeStudy()); +// SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy( study->studyDS()); +// int StudyId = aStudyDS->StudyId(); +// for( initSelected(); moreSelected(); nextSelected() ) +// if( DependencyTree_Object* aDepObject = dynamic_cast( 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 ); +} + //================================================================================ //================================================================================ diff --git a/src/DependencyTree/DependencyTree_View.h b/src/DependencyTree/DependencyTree_View.h index 059770757..97d5811b5 100644 --- a/src/DependencyTree/DependencyTree_View.h +++ b/src/DependencyTree/DependencyTree_View.h @@ -74,6 +74,8 @@ public: void setHighlightArrowColor( const QColor& ); void setSelectArrowColor( const QColor& ); + virtual int select( const QRectF&, bool ); + // typedef QList NodeLinks; // typedef QMap LevelInfo; // typedef QList LevelsList;