]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
To improve highlight functionality (to use data from selector)
authorapo <apo@opencascade.com>
Mon, 3 Oct 2005 06:22:02 +0000 (06:22 +0000)
committerapo <apo@opencascade.com>
Mon, 3 Oct 2005 06:22:02 +0000 (06:22 +0000)
src/SVTK/SALOME_Actor.cxx
src/SVTK/SALOME_Actor.h
src/SVTK/SVTK_View.cxx

index d06d6e9c8ee8f9727b862a5fc1fb24cf07919b06..16ea3da801bc223e6c3bf9859d252ba274a264d7 100644 (file)
@@ -258,7 +258,7 @@ void
 SALOME_Actor
 ::highlight(bool theHighlight) 
 { 
-  highlight(theHighlight,ActorSelection); 
+  highlight(theHighlight,mySelectionMode); 
 }  
 
 bool
@@ -867,7 +867,7 @@ SALOME_Actor
 
   vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
   //
-  int aSelectionMode = theSelectionEvent->mySelectionMode;
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
   float x1 = theSelectionEvent->myX;
   float y1 = theSelectionEvent->myY;
   float z1 = 0.0;
@@ -1052,10 +1052,22 @@ SALOME_Actor
     }
   }
 
+  mySelectionMode = aSelectionMode;
+
+  highlight(theIsHighlight,theSelector);
+
+  return true;
+}
+
+void
+SALOME_Actor
+::highlight(bool theIsHighlight, 
+           SVTK_Selector* theSelector)
+{
   TColStd_IndexedMapOfInteger aMapIndex;
   theSelector->GetIndex( getIO(), aMapIndex );
 
-  switch( aSelectionMode )
+  switch( mySelectionMode )
   {
     case NodeSelection:
       myHighlightProperty->SetRepresentationToPoints();
@@ -1076,11 +1088,10 @@ SALOME_Actor
       break;
   }
 
-  highlight( theIsHighlight, aSelectionMode );
-
-  return true;
+  highlight( theIsHighlight, mySelectionMode );
 }
 
+
 //----------------------------------------------------------------------------
 void
 SALOME_Actor
index bfe943b62182b249ddcab6e6607c5f795837346a..870f327a1dabd606b86d698c8b3b890cfd12623a 100644 (file)
@@ -109,6 +109,11 @@ class SVTK_EXPORT SALOME_Actor : public VTKViewer_Actor
   highlight(bool theHighlight, 
            Selection_Mode theSelectionMode);
 
+  virtual
+  void
+  highlight(bool theHighlight, 
+           SVTK_Selector* theSelector);
+
   virtual
   void
   highlight(bool theHighlight);  
index f20f1c0ef0ee1cbe414572603a47853e7359a821..98d158291043dc0974028dee678caf686d1159b6 100644 (file)
@@ -141,6 +141,25 @@ struct THighlightAction
   }
 };
 
+struct TSelectionAction
+{
+  bool myIsHighlight;
+  SVTK_Selector* mySelector;
+  TSelectionAction( bool theIsHighlight, 
+                   SVTK_Selector* theSelector ):
+    myIsHighlight( theIsHighlight ),
+    mySelector( theSelector ) 
+  {}
+
+  void
+  operator()( SALOME_Actor* theActor) 
+  {
+    if(theActor->GetMapper()){
+      theActor->highlight( myIsHighlight, mySelector );
+    }
+  }
+};
+
 void
 SVTK_SignalHandler
 ::onSelectionChanged()
@@ -153,14 +172,13 @@ SVTK_SignalHandler
   SVTK_Selector* aSelector = myMainWindow->GetSelector();
   const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
   SALOME_ListIteratorOfListIO anIter(aListIO);
-  Selection_Mode aSelectionMode = aSelector->SelectionMode();
   for(; anIter.More(); anIter.Next()){
     ForEachIf<SALOME_Actor>(anActors,
                            TIsSameIObject<SALOME_Actor>(anIter.Value()),
-                           THighlightAction(true,aSelectionMode));
+                           TSelectionAction(true,aSelector));
   }
 
-  myMainWindow->Repaint();
+  myMainWindow->Repaint(false);
 }