]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
To improve selection management.
authorapo <apo@opencascade.com>
Mon, 17 Oct 2005 06:17:22 +0000 (06:17 +0000)
committerapo <apo@opencascade.com>
Mon, 17 Oct 2005 06:17:22 +0000 (06:17 +0000)
1. All SALOME_Actor share the same instances of pickers and highlight/prehighlight properties that is stored into SVTK_Renderer.
2. SVTK_Selector now invoke selection changed event on selection mode changing
3. Remove useless highlight calls and selection changed event invockation

src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_Selector.cxx
src/SVTK/SVTK_View.cxx

index 5781c993363b9cf655445d4217246ece1cb4a64d..b457ebb811eb5e9127c9a868d7e468209ed46905 100644 (file)
@@ -890,8 +890,6 @@ SVTK_InteractorStyle
         fitRect(x1, y1, x2, y2);
       }
       else {
-       VTK::ForEach<SALOME_Actor>(GetCurrentRenderer()->GetActors(),
-                                  VTK::THighlight<SALOME_Actor>(false));
         if (myPoint == myOtherPoint) {
          // process point selection
           this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
index 4d8fd1a7a3973c12713d982a91e8b4b916947f2e..90fa0b06f71f97a9a14b297942a32a51e9c5610f 100644 (file)
@@ -78,7 +78,11 @@ void
 SVTK_SelectorDef
 ::SetSelectionMode(Selection_Mode theMode)
 {
-  mySelectionMode = theMode;
+  if(mySelectionMode != theMode){
+    mySelectionMode = theMode;
+    myMapIOSubIndex.clear();
+    this->EndPickCallback();
+  }
 }
 
 void 
index ad1a00c24e96c66ef118050b1c4ea6b534aa651d..d7a91ca7d805285b65b510dc502dfd2ed3644b32 100644 (file)
@@ -202,12 +202,10 @@ void
 SVTK_View
 ::unHighlightAll() 
 {
-  if(SVTK_Selector* aSelector = myMainWindow->GetSelector()){
-    using namespace VTK;
-    ForEach<SALOME_Actor>(getRenderer()->GetActors(),
-                         THighlightAction( false ));
-    Repaint();
-  }
+  using namespace VTK;
+  ForEach<SALOME_Actor>(getRenderer()->GetActors(),
+                       THighlightAction( false ));
+  Repaint();
 }
 
 //----------------------------------------------------------------
@@ -221,7 +219,7 @@ SVTK_View
     using namespace VTK;
     ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
                            TIsSameIObject<SALOME_Actor>( theIO ),
-                           THighlightAction( theIsHighlight, aSelector->SelectionMode() ));
+                           TSelectionAction(theIsHighlight,aSelector));
     Repaint();
   }
 }
@@ -234,12 +232,7 @@ SVTK_View
                   const double& theBlue, 
                   const int& theWidth) 
 {
-  vtkActorCollection* anActors = getRenderer()->GetActors();
-  anActors->InitTraversal();
-  while(vtkActor* anActor = anActors->GetNextActor()){
-    if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(anActor))
-      aSActor->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
-  }
+  GetRenderer()->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
 }
 
 //----------------------------------------------------------------------------
@@ -250,12 +243,7 @@ SVTK_View
                      const double& theBlue, 
                      const int& theWidth) 
 {
-  vtkActorCollection* anActors = getRenderer()->GetActors();
-  anActors->InitTraversal();
-  while(vtkActor* anActor = anActors->GetNextActor()){
-    if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(anActor))
-      aSActor->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
-  }
+  GetRenderer()->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
 }
 
 //----------------------------------------------------------------------------
@@ -264,12 +252,7 @@ SVTK_View
 ::SetSelectionTolerance(const double& theTolNodes, 
                        const double& theTolCell)
 {
-  vtkActorCollection* anActors = getRenderer()->GetActors();
-  anActors->InitTraversal();
-  while(vtkActor* anActor = anActors->GetNextActor()){
-    if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(anActor))
-      aSActor->SetSelectionTolerance(theTolNodes,theTolCell);
-  }
+  GetRenderer()->SetSelectionTolerance(theTolNodes,theTolCell);
 }
 
 //----------------------------------------------------------------------------