From 209357b22c486d894384bff00e7ff7a024b80d4c Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 17 Aug 2005 10:49:19 +0000 Subject: [PATCH] To improve rectangle selection --- src/SVTK/SVTK_InteractorStyle.cxx | 57 ++++++------------------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index a46435af1..25e0216a1 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -1002,8 +1002,6 @@ SVTK_InteractorStyle this->HighlightProp( NULL ); GetSelector()->ClearIObjects(); } - - Interactor->EndPickCallback(); } else { //processing rectangle selection if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return; @@ -1033,52 +1031,19 @@ SVTK_InteractorStyle aSelectionEvent.LastX = x1; aSelectionEvent.LastY = y1; - switch (aSelectionMode) { - case NodeSelection: { - //if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(Interactor->GetPicker()) ) { - vtkActorCollection* aListActors = this->CurrentRenderer->GetActors(); - aListActors->InitTraversal(); - while (vtkActor* aActor = aListActors->GetNextActor()) { - if (!aActor->GetVisibility()) - continue; - if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) - aSActor->Highlight( this, GetSelector(), this->CurrentRenderer, aSelectionEvent, true ); - } - //} - break; - } - case CellSelection: - case EdgeOfCellSelection: - case EdgeSelection: - case FaceSelection: - case VolumeSelection: - { - vtkSmartPointer picker = VTKViewer_CellRectPicker::New(); - picker->SetTolerance(0.001); - picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer); - - vtkActorCollection* aListActors = picker->GetActors(); - aListActors->InitTraversal(); - while(vtkActor* aActor = aListActors->GetNextActor()) - if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) - aSActor->Highlight( this, GetSelector(), this->CurrentRenderer, aSelectionEvent, true ); + vtkSmartPointer aPicker = VTKViewer_RectPicker::New(); + aPicker->SetTolerance(0.001); + aPicker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer); + + vtkActorCollection* aListActors = aPicker->GetActors(); + aListActors->InitTraversal(); + while(vtkActor* aActor = aListActors->GetNextActor()){ + if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)){ + aSActor->Highlight( this, GetSelector(), this->CurrentRenderer, aSelectionEvent, true ); } - break; - case ActorSelection: // objects selection - { - vtkSmartPointer picker = VTKViewer_RectPicker::New(); - picker->SetTolerance(0.001); - picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer); - - vtkActorCollection* aListActors = picker->GetActors(); - aListActors->InitTraversal(); - while(vtkActor* aActor = aListActors->GetNextActor()) - if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) - aSActor->Highlight( this, GetSelector(), this->CurrentRenderer, aSelectionEvent, true ); - } // end case 4 - } //end switch - Interactor->EndPickCallback(); + } } + Interactor->EndPickCallback(); myViewWindow->onSelectionChanged(); } } -- 2.39.2