1 #include "vtkInteractorStyleMPRView.h"
3 #include "wxVtkMPR2DView.h"
5 vtkInteractorStyleMPRView::vtkInteractorStyleMPRView()
7 _stateMoveAxisX = false;
8 _stateMoveAxisY = false;
9 _stateMoveAxisZ = false;
11 //---------------------------------------------------------------------------
12 vtkInteractorStyleMPRView::~vtkInteractorStyleMPRView()
17 //---------------------------------------------------------------------------
18 bool vtkInteractorStyleMPRView::OnLeftDClick () // virtual
20 wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
21 double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
22 double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[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);
35 //---------------------------------------------------------------------------
36 bool vtkInteractorStyleMPRView::OnLeftButtonDown ()
38 wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
39 double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
40 double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
42 //double xx = x; // JPRx
43 //double yy = y; // JPRx
44 _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
47 if ((_xBack==xx) && (_yBack==yy))
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);
62 _stateMoveAxisX = wxvtkmpr2Dview->IfMouseTouchX(x,y,z);
63 _stateMoveAxisY = wxvtkmpr2Dview->IfMouseTouchY(x,y,z);
64 _stateMoveAxisZ = wxvtkmpr2Dview->IfMouseTouchZ(x,y,z);
68 //---------------------------------------------------------------------------
69 bool vtkInteractorStyleMPRView::OnLeftButtonUp ()
71 if (_stateMoveAxisX==true)
73 _stateMoveAxisX=false;
75 if (_stateMoveAxisY==true)
77 _stateMoveAxisY=false;
79 if (_stateMoveAxisZ==true)
81 _stateMoveAxisZ=false;
85 //---------------------------------------------------------------------------
86 bool vtkInteractorStyleMPRView::OnMouseMove ()
88 double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
89 double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
92 _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
93 wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
94 // wxvtkmpr2Dview->TransfromCoordViewWorld(x,y,z);
96 wxvtkmpr2Dview->ChangeAxisColor(x,y,z);
98 if ((_stateMoveAxisX==true) || (_stateMoveAxisY==true) || (_stateMoveAxisZ==true) )
100 if (_stateMoveAxisX==true)
102 wxvtkmpr2Dview-> MoveX(x,y,z);
104 if (_stateMoveAxisY==true)
106 wxvtkmpr2Dview->MoveY(x,y,z);
108 if (_stateMoveAxisZ==true)
110 wxvtkmpr2Dview->MoveZ(x,y,z);
113 this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();