]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Correction 2 of GUI part
authormpa <mpa@opencascade.com>
Fri, 23 May 2014 11:43:01 +0000 (15:43 +0400)
committermpa <mpa@opencascade.com>
Fri, 23 May 2014 11:43:01 +0000 (15:43 +0400)
src/DependencyTree/DependencyTree_Object.cxx
src/DependencyTree/DependencyTree_View.cxx
src/DependencyTree/DependencyTree_View.h

index 0f85a0405ccbd131f7b3a8ee7ede2272bc1f5bef..2f839df33183cb823c1098466f116fe396c3a1bb 100644 (file)
@@ -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<SalomeApp_Study*>(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 );
 
index 198a50bc6f500c8a28d4d7cb2b925fb3e49d9e95..9a3a50774e1fb4263e703b83da7125ebc68e9e74 100644 (file)
@@ -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<DependencyTree_Object*,DependencyTree_Object*>(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<DependencyTree_Object*,DependencyTree_Object*>(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<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 );
+}
+
 //================================================================================
 //================================================================================
 
index 05977075749669a2dda4691ef724de6e37458ab6..97d5811b5171c4434c4da1d11e7325e2ec5f1617 100644 (file)
@@ -74,6 +74,8 @@ public:
   void setHighlightArrowColor( const QColor& );
   void setSelectArrowColor( const QColor& );
 
+  virtual int select( const QRectF&, bool );
+
 //  typedef QList<QString> NodeLinks;
 //  typedef QMap<QString, NodeLinks> LevelInfo;
 //  typedef QList<LevelInfo> LevelsList;