1 #include "wxVTKRenderWindowInteractorEditContour.h"
3 //---------------------------------------------------------------------------
4 vtkInteractorStyle3DMaracas::vtkInteractorStyle3DMaracas(){
6 //---------------------------------------------------------------------------
7 vtkInteractorStyle3DMaracas::~vtkInteractorStyle3DMaracas(){
9 //---------------------------------------------------------------------------
10 void vtkInteractorStyle3DMaracas::OnRightButtonDown (){
12 if (GetInteractor()->GetControlKey()==1 ){
13 this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
16 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
17 this->Interactor->GetEventPosition()[1]);
19 if (this->CurrentRenderer == NULL)
24 if (this->Interactor->GetControlKey()) {
29 //---------------------------------------------------------------------------
30 void vtkInteractorStyle3DMaracas::OnRightButtonUp () {
32 if (GetInteractor()->GetControlKey()==1 ){
33 this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
45 //---------------------------------------------------------------------------
46 void vtkInteractorStyle3DMaracas::OnMouseMove () {
48 // this->vtkInteractorStyleTrackballCamera::OnMouseMove();
50 int x = this->Interactor->GetEventPosition()[0];
51 int y = this->Interactor->GetEventPosition()[1];
54 vtkRenderWindowInteractor *rwi = this->Interactor;
56 int lx = rwi->GetLastEventPosition()[0];
57 int ly = rwi->GetLastEventPosition()[1];
58 int dx = rwi->GetEventPosition()[0] ;
59 int dy = rwi->GetEventPosition()[1] ;
65 // this->FindPokedRenderer(x, y);
67 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
71 // this->FindPokedRenderer(x, y);
73 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
77 // this->FindPokedRenderer(x, y);
79 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
83 // this->FindPokedRenderer(x, y);
85 // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
92 //---------------------------------------------------------------------------
93 void vtkInteractorStyle3DMaracas::OnLeftButtonDown (){
95 if (GetInteractor()->GetControlKey()==1 ){
96 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
98 this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
103 this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
104 this->Interactor->GetEventPosition()[1]);
105 if (this->CurrentRenderer == NULL)
110 if (this->Interactor->GetControlKey()) {
117 if (this->Interactor->GetShiftKey())
119 if (this->Interactor->GetControlKey())
130 if (this->Interactor->GetControlKey())
143 //---------------------------------------------------------------------------
144 void vtkInteractorStyle3DMaracas::OnLeftButtonUp () {
146 if (GetInteractor()->GetControlKey()==1 ){
147 this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
149 this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
164 //---------------------------------------------------------------------------
165 void vtkInteractorStyle3DMaracas::OnMiddleButtonDown () {
166 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
168 //---------------------------------------------------------------------------
169 void vtkInteractorStyle3DMaracas::OnMiddleButtonUp () {
170 // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
174 //---------------------------------------------------------------------------
175 //---------------------------------------------------------------------------
176 //---------------------------------------------------------------------------
179 //---------------------------------------------------------------------------
180 vtkInteractorStyle2DMaracas::vtkInteractorStyle2DMaracas(){
183 //---------------------------------------------------------------------------
184 vtkInteractorStyle2DMaracas::~vtkInteractorStyle2DMaracas(){
186 //---------------------------------------------------------------------------
187 void vtkInteractorStyle2DMaracas::OnRightButtonDown (){
188 if (GetInteractor()->GetControlKey()==1 ){
189 this->vtkInteractorStyleImage::OnRightButtonDown();
192 //---------------------------------------------------------------------------
193 void vtkInteractorStyle2DMaracas::OnRightButtonUp () {
194 if (GetInteractor()->GetControlKey()==1 ){
195 this->vtkInteractorStyleImage::OnRightButtonUp();
198 //---------------------------------------------------------------------------
199 void vtkInteractorStyle2DMaracas::OnMouseMove () {
200 this->vtkInteractorStyleImage::OnMouseMove();
202 //---------------------------------------------------------------------------
203 void vtkInteractorStyle2DMaracas::OnLeftButtonDown (){
204 if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) ){
205 this->vtkInteractorStyleImage::OnMiddleButtonDown();
206 } else if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) ){
208 _obs->Execute( NULL , vtkCommand::LeftButtonPressEvent , NULL ) ;
211 this->vtkInteractorStyleImage::OnLeftButtonDown();
215 //---------------------------------------------------------------------------
216 void vtkInteractorStyle2DMaracas::OnLeftButtonUp () {
217 if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) ){
218 this->vtkInteractorStyleImage::OnMiddleButtonUp();
219 } else if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) ){
221 _obs->Execute( NULL , vtkCommand::LeftButtonReleaseEvent , NULL );
224 this->vtkInteractorStyleImage::OnLeftButtonUp();
227 //---------------------------------------------------------------------------
228 void vtkInteractorStyle2DMaracas::OnMiddleButtonDown () {
230 //---------------------------------------------------------------------------
231 void vtkInteractorStyle2DMaracas::OnMiddleButtonUp () {
234 //---------------------------------------------------------------------------
235 void vtkInteractorStyle2DMaracas::SetObserver(vtkCommand* obs){
239 //---------------------------------------------------------------------------
240 //---------------------------------------------------------------------------
241 //---------------------------------------------------------------------------
243 wxVTKRenderWindowInteractorEditContour::wxVTKRenderWindowInteractorEditContour(wxWindow *parent,wxWindowID id)
244 :wxVTKRenderWindowInteractor(parent,id){
247 //---------------------------------------------------------------------------
248 wxVTKRenderWindowInteractorEditContour::~wxVTKRenderWindowInteractorEditContour(){
250 //---------------------------------------------------------------------------
251 void wxVTKRenderWindowInteractorEditContour::OnButtonDown(wxMouseEvent &event){
252 if (this->_state==1){
253 wxVTKRenderWindowInteractor::OnButtonDown(event);
255 if (this->_state==2){
256 if(event.LeftDown()==true){
257 SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
258 _obs->Execute( NULL , wxEVT_LEFT_DOWN , NULL ) ;
260 if(event.RightDown()==true){
261 wxVTKRenderWindowInteractor::OnButtonDown(event);
262 SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
263 _obs->Execute( NULL , wxEVT_RIGHT_DOWN , NULL ) ;
267 //---------------------------------------------------------------------------
268 void wxVTKRenderWindowInteractorEditContour::OnButtonUp(wxMouseEvent &event){
269 if (this->_state==1){
270 wxVTKRenderWindowInteractor::OnButtonUp(event);
272 if (this->_state==2){
273 if(event.LeftUp()==true){
274 SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
275 _obs->Execute( NULL , wxEVT_LEFT_UP , NULL ) ;
277 if(event.RightUp()==true){
278 wxVTKRenderWindowInteractor::OnButtonUp(event);
282 //---------------------------------------------------------------------------
283 void wxVTKRenderWindowInteractorEditContour::OnButtonDouble(wxMouseEvent &event){
284 if (this->_state==1){
285 // EED 22 dec 2007 : SIL que tengo que hacer aqui ..?? Esto creo que lo quito silvia y como se
287 // wxVTKRenderWindowInteractor::OnButtonDouble(event);
289 if (this->_state==2){
290 if(event.LeftDClick()==true){
291 SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
292 _obs->Execute( NULL , wxEVT_LEFT_DCLICK , NULL ) ;
296 //---------------------------------------------------------------------------
297 void wxVTKRenderWindowInteractorEditContour::OnMotion(wxMouseEvent &event){
298 if (this->_state==1){
299 wxVTKRenderWindowInteractor::OnMotion(event);
301 if (this->_state==2){
302 wxVTKRenderWindowInteractor::OnMotion(event);
303 if(event.Moving()==true){
304 SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
305 _obs->Execute( NULL , wxEVT_MOTION , NULL ) ;
309 //---------------------------------------------------------------------------
310 void wxVTKRenderWindowInteractorEditContour::OnKeyDown(wxKeyEvent &event){
311 wxVTKRenderWindowInteractor::OnKeyDown(event);
312 if (( event.GetKeyCode()==WXK_BACK ) || ( event.GetKeyCode()==WXK_DELETE) ){
313 _obs->Execute( NULL , WXK_CLEAR , NULL ) ;
316 //---------------------------------------------------------------------------
317 void wxVTKRenderWindowInteractorEditContour::SetState(int state){
320 //---------------------------------------------------------------------------
321 int wxVTKRenderWindowInteractorEditContour::GetState(){
324 //---------------------------------------------------------------------------
325 void wxVTKRenderWindowInteractorEditContour::SetObserver(vtkCommand* obs){