From: pkv Date: Mon, 19 Sep 2005 10:39:44 +0000 (+0000) Subject: adds method GetSelectionEventFlipY() that does not change Y-coordinate in SelectionEvent X-Git-Tag: BR-D5-38-2003_D2005-12-10~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be8036024fa0a31baaf0a12f3c17a1a73ce5d9a3;p=modules%2Fgui.git adds method GetSelectionEventFlipY() that does not change Y-coordinate in SelectionEvent --- diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index 704e8d907..8a1b758f6 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -171,7 +171,24 @@ SVTK_InteractorStyle return aSelectionEvent; } +//---------------------------------------------------------------------------- +SVTK_SelectionEvent +SVTK_InteractorStyle +::GetSelectionEventFlipY() +{ + SVTK_SelectionEvent aSelectionEvent; + int x, y; + //GetEventPosition( this->Interactor, x, y ); + Interactor->GetEventPosition(x, y); + aSelectionEvent.myX = x; + aSelectionEvent.myY = y; + aSelectionEvent.myIsCtrl = Interactor->GetControlKey(); + aSelectionEvent.myIsShift = Interactor->GetShiftKey(); + aSelectionEvent.mySelectionMode = GetSelector()->SelectionMode(); + + return aSelectionEvent; +} //---------------------------------------------------------------------------- void SVTK_InteractorStyle @@ -895,7 +912,7 @@ SVTK_InteractorStyle myPicker->Pick(x, y, 0.0, GetCurrentRenderer()); if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(myPicker->GetActor())){ - SVTK_SelectionEvent aSelectionEvent = GetSelectionEvent(); + SVTK_SelectionEvent aSelectionEvent = GetSelectionEventFlipY(); aSelectionEvent.mySelectionMode = aSelectionMode; aSelectionEvent.myIsRectangle = false; aSActor->Highlight( GetSelector(), this, aSelectionEvent, true ); @@ -929,13 +946,11 @@ SVTK_InteractorStyle myRectPicker->SetTolerance(0.001); myRectPicker->Pick(x1, y1, 0.0, x2, y2, 0.0, GetCurrentRenderer()); - - SVTK_SelectionEvent aSelectionEvent = GetSelectionEvent(); + SVTK_SelectionEvent aSelectionEvent = GetSelectionEventFlipY(); aSelectionEvent.mySelectionMode = aSelectionMode; aSelectionEvent.myIsRectangle = true; aSelectionEvent.myLastX = x1; aSelectionEvent.myLastY = y1; - vtkActorCollection* aListActors = myRectPicker->GetActors(); aListActors->InitTraversal(); while(vtkActor* aActor = aListActors->GetNextActor()){ diff --git a/src/SVTK/SVTK_InteractorStyle.h b/src/SVTK/SVTK_InteractorStyle.h index a1e5158f9..6f98dd48c 100644 --- a/src/SVTK/SVTK_InteractorStyle.h +++ b/src/SVTK/SVTK_InteractorStyle.h @@ -70,7 +70,7 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle virtual int GetState(); SVTK_SelectionEvent GetSelectionEvent(); - + SVTK_SelectionEvent GetSelectionEventFlipY(); // redefined in order to add an observer (callback) for custorm event (space mouse event) virtual void SetInteractor( vtkRenderWindowInteractor* ); @@ -180,7 +180,6 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle // [5] Dominant Combined Switch QWidget* myRenderWidget; - vtkSmartPointer mySelector; vtkSmartPointer myInteractor; vtkSmartPointer myPicker;