Salome HOME
Merge remote branch 'origin/V8_5_asterstudy'
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_VTKUtils.cxx
index eac67620e4a542e269441013450f698dad1d8e94..b74d29e50b73237b8359e46843b9b364a6356a8d 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESHGUI_Utils.h"
 #include "SMDS_Mesh.hxx"
 #include "SMESH_Actor.h"
+#include "SMESH_ActorProps.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_CellLabelActor.h"
 #include "SMESH_ControlsDef.hxx"
@@ -774,12 +775,13 @@ namespace SMESH
     return false;
   }
 
-  void UpdateView(){
+  void UpdateView( bool withChildrenOfSelected )
+  {
     if ( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()) {
       LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
       SALOME_ListIO selected; mgr->selectedObjects( selected );
 
-      if( selected.Extent() == 0){
+      if ( selected.Extent() == 0 ) {
         vtkRenderer* aRenderer = aWnd->getRenderer();
         VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
         vtkActorCollection *aCollection = aCopy.GetActors();
@@ -788,15 +790,39 @@ namespace SMESH
           if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
             if(anActor->hasIO())
               if (!Update(anActor->getIO(),anActor->GetVisibility()))
-                break; // avoid multiple warinings if visu failed
+                break; // avoid multiple warnings if visu failed
           }
         }
-      }else{
+      }
+      else
+      {
         SALOME_ListIteratorOfListIO anIter( selected );
-        for( ; anIter.More(); anIter.Next()){
+        for( ; anIter.More(); anIter.Next())
+        {
           Handle(SALOME_InteractiveObject) anIO = anIter.Value();
-          if ( !Update(anIO,true) )
-            break; // avoid multiple warinings if visu failed
+          if ( !Update( anIO, true ))
+            break; // avoid multiple warnings if visu failed
+
+          if ( withChildrenOfSelected ) // update all visible children
+          {
+            QString aFatherID = anIO->getEntry();
+            vtkRenderer* aRenderer = aWnd->getRenderer();
+            VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+            vtkActorCollection *aCollection = aCopy.GetActors();
+            aCollection->InitTraversal();
+            while ( vtkActor *anAct = aCollection->GetNextActor() ) {
+              if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct )) {
+                if ( anActor->hasIO() && anActor->GetVisibility() )
+                {
+                  QString aChildID = anActor->getIO()->getEntry();
+                  if ( aChildID.size() > aFatherID.size() &&
+                       aChildID.startsWith( aFatherID ))
+                    if ( ! Update( anActor->getIO(), true ))
+                      break;
+                }
+              }
+            }
+          }
         }
       }
       RepaintCurrentView();
@@ -854,6 +880,8 @@ namespace SMESH
       return;
     }
 
+    SMESH_ActorProps::props()->reset();
+
     QColor
       aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
       aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
@@ -895,12 +923,7 @@ namespace SMESH
         aCollection->InitTraversal();
         while ( vtkActor *anAct = aCollection->GetNextActor() ) {
           if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct) ) {
-            anActor->SetHighlightColor(aHiColor.red()/255.,
-                                       aHiColor.green()/255.,
-                                       aHiColor.blue()/255.);
-            anActor->SetPreHighlightColor(aPreColor.red()/255.,
-                                          aPreColor.green()/255.,
-                                          aPreColor.blue()/255.);
+           anActor->UpdateSelectionProps();
           }
         }
       }
@@ -1397,7 +1420,7 @@ namespace SMESH
   //================================================================================
   /*!
    * \brief Find all SMESH_Actor's in the View Window.
-   * If actor constains Plot2d_Histogram object remove it from each Plot2d Viewer.
+   * If actor contains Plot2d_Histogram object remove it from each Plot2d Viewer.
    */
   //================================================================================