]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleMPRView.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkInteractorStyleMPRView.cxx
1 #include "vtkInteractorStyleMPRView.h"
2
3 #include "wxVtkMPR2DView.h"
4
5 vtkInteractorStyleMPRView::vtkInteractorStyleMPRView()
6 {
7         _stateMoveAxisX = false;
8         _stateMoveAxisY = false;
9         _stateMoveAxisZ = false;
10 }
11 //---------------------------------------------------------------------------
12 vtkInteractorStyleMPRView::~vtkInteractorStyleMPRView()
13 {
14 }
15
16
17 //---------------------------------------------------------------------------
18 bool  vtkInteractorStyleMPRView::OnLeftDClick () // virtual
19 {
20         wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
21         double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
22         double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
23         double z = 1;
24         _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);            
25         wxvtkmpr2Dview->MoveX(x,y,z);
26         wxvtkmpr2Dview->MoveY(x,y,z);
27         wxvtkmpr2Dview->MoveZ(x,y,z);
28         wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
29         wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
30         wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122);  // Doble click
31         wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
32
33         return true;
34 }
35 //---------------------------------------------------------------------------
36 bool  vtkInteractorStyleMPRView::OnLeftButtonDown () 
37 {
38         wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
39         double x        = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
40         double y        = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
41         double z        = 1;
42         //double xx     = x;  // JPRx
43         //double yy     = y;  // JPRx
44         _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);            
45
46 /*EED Borrame
47         if ((_xBack==xx) && (_yBack==yy))
48         {
49                 wxvtkmpr2Dview->MoveX(x,y,z);
50                 wxvtkmpr2Dview->MoveY(x,y,z);
51                 wxvtkmpr2Dview->MoveZ(x,y,z);
52                 wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121);  // Refresh
53                 wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
54                 wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122);  // Doble click
55                 wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
56         }
57
58         _xBack=xx;      
59         _yBack=yy;
60 */
61
62         _stateMoveAxisX = wxvtkmpr2Dview->IfMouseTouchX(x,y,z);
63         _stateMoveAxisY = wxvtkmpr2Dview->IfMouseTouchY(x,y,z);
64         _stateMoveAxisZ = wxvtkmpr2Dview->IfMouseTouchZ(x,y,z);
65
66         return true;
67 }
68 //---------------------------------------------------------------------------
69 bool  vtkInteractorStyleMPRView::OnLeftButtonUp () 
70 {
71         if (_stateMoveAxisX==true) 
72         {
73                 _stateMoveAxisX=false;
74         }
75         if (_stateMoveAxisY==true) 
76         {
77                 _stateMoveAxisY=false;
78         }
79         if (_stateMoveAxisZ==true) 
80         {
81                 _stateMoveAxisZ=false;
82         }
83         return true;
84 }
85 //---------------------------------------------------------------------------
86 bool  vtkInteractorStyleMPRView::OnMouseMove () 
87 {
88         double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
89         double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
90
91         double z=1;
92         _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);            
93         wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
94 //      wxvtkmpr2Dview->TransfromCoordViewWorld(x,y,z);     
95
96         wxvtkmpr2Dview->ChangeAxisColor(x,y,z);
97
98         if ((_stateMoveAxisX==true) || (_stateMoveAxisY==true)  || (_stateMoveAxisZ==true) )
99         {
100                 if (_stateMoveAxisX==true) 
101                 {
102                         wxvtkmpr2Dview-> MoveX(x,y,z);
103                 }
104                 if (_stateMoveAxisY==true) 
105                 {
106                         wxvtkmpr2Dview->MoveY(x,y,z);
107                 }
108                 if (_stateMoveAxisZ==true) 
109                 {
110                         wxvtkmpr2Dview->MoveZ(x,y,z);
111                 }
112
113                 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
114         }
115         return true;
116 }
117