2 #include "vtkInteractorStyleSphere.h"
4 #include "wxSphereView.h"
6 vtkInteractorStyleSphere::vtkInteractorStyleSphere()
12 //---------------------------------------------------------------------------
14 vtkInteractorStyleSphere::~vtkInteractorStyleSphere()
19 //---------------------------------------------------------------------------
21 bool vtkInteractorStyleSphere::OnRightButtonDown()
23 if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) && (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
26 //_fordwareX = this->Interactor->GetEventPosition()[0];
27 _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
29 wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
31 _radio = wxsphereview->GetRadio();
37 //---------------------------------------------------------------------------
39 bool vtkInteractorStyleSphere::OnRightButtonUp()
41 if (_stateRadio==true)
43 wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
44 wxsphereview->SetDeltaVoxel(1);
45 double radio=wxsphereview->GetRadio();
46 wxsphereview->GetIdOfImage(radio+0.1);
47 wxsphereview->GetIdOfImage(radio+0.2);
48 wxsphereview->GetIdOfImage(radio-0.1);
49 wxsphereview->GetIdOfImage(radio-0.2);
51 wxsphereview->RefreshView();
57 //---------------------------------------------------------------------------
59 bool vtkInteractorStyleSphere::OnLeftButtonDown()
62 _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
63 _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
68 //---------------------------------------------------------------------------
70 bool vtkInteractorStyleSphere::OnLeftButtonUp()
72 wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
73 if (_stateRotate==true){
74 int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
75 int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
77 if ((_fordwareX==fx)&&(_fordwareY==fy)){
79 _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
80 wxsphereview->SetXYZtoParent(x,y);
81 wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
82 wxsphereview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
84 wxsphereview->RotationEnd();
86 wxsphereview->RefreshView();
94 //---------------------------------------------------------------------------
96 bool vtkInteractorStyleSphere::OnMouseMove ()
98 wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
99 if (_stateRotate==true)
104 if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
108 if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
112 int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
113 int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
114 wxsphereview->RotationStart( fx - _fordwareX , -(fy - _fordwareY) , ok_v, ok_ang);
115 wxsphereview->RefreshView();
117 if (_stateRadio==true)
119 //int fx = this->Interactor->GetEventPosition()[0];
120 int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
121 double dif=(fy-_fordwareY) / 10.0;
122 wxsphereview->SetRadio( _radio + dif );
123 wxsphereview->SetDeltaVoxel(3);
124 wxsphereview->RefreshView();