]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStylePlane2D.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInteractorStylePlane2D.cxx
1
2
3 #include "vtkInteractorStylePlane2D.h"
4 #include "vtkPlane2DView.h"
5
6 vtkInteractorStylePlane2D::vtkInteractorStylePlane2D()
7 {
8         _stateRotate=false;
9 }
10 //---------------------------------------------------------------------------
11 vtkInteractorStylePlane2D::~vtkInteractorStylePlane2D()
12 {
13 }
14
15 //---------------------------------------------------------------------------
16 bool vtkInteractorStylePlane2D::GetStateRotate()
17 {
18         return _stateRotate;
19 }
20
21 //---------------------------------------------------------------------------
22 bool  vtkInteractorStylePlane2D::OnLeftButtonDown()  // vitual
23 {
24         _stateRotate = true;
25         _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
26         _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
27         vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
28         vtkplane2Dview->RotationStart();
29
30         return true;
31 }
32
33 //---------------------------------------------------------------------------
34 bool vtkInteractorStylePlane2D::OnLeftButtonUp() // virtual
35 {
36         if (_stateRotate==true)
37         {
38                 _stateRotate = false;
39                 vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
40                 vtkplane2Dview->ResetBack();
41 //              this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
42         }
43
44         return true;
45 }
46
47 //---------------------------------------------------------------------------
48 bool  vtkInteractorStylePlane2D::OnRightButtonUp()  // virtual
49 {
50         if (_stateRotate==true){
51                 //vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); // JPRx
52
53 // EED Borrame
54 //              vtkplane2Dview->RotationEnd();
55
56                 _stateRotate = false;
57         }
58
59         return true;
60 }
61 //---------------------------------------------------------------------------
62 bool  vtkInteractorStylePlane2D::OnMouseMove () // virtual 
63 {
64         bool ok_v, ok_ang;
65         if (_stateRotate==true){
66                 ok_v=false;
67                 ok_ang=false;
68                 if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
69                 {
70                         ok_v=true;
71                 }
72                 if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
73                 {
74                         ok_ang=true;
75                 }
76             int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
77         int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
78                 vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
79                 vtkplane2Dview->RotationDrag( fx - _fordwareX , fy - _fordwareY , ok_v , ok_ang);
80                 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
81         } 
82         return true;
83 }
84 //-------------------------------------------------------------------
85 bool vtkInteractorStylePlane2D::OnLeftDClick() // virtual
86 {
87         int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
88         int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
89         double xx=fx;
90         double yy=fy;
91         double zz=0;
92
93         vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
94         vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
95
96         vtkplane2Dview->TransfromCoordViewWorld2(xx,yy,zz);
97
98         vtkmprbasedata->SetX( xx );
99         vtkmprbasedata->SetY( yy );
100         vtkmprbasedata->SetZ( zz );
101         this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
102
103         return true;
104 }
105