70 #include "vtkAbstractPropPicker.h"
71 #include "vtkAssemblyPath.h"
73 #include "vtkObjectFactory.h"
74 #include "vtkRenderWindowInteractor.h"
75 #include <vtkImageData.h>
76 #include <vtkRenderWindow.h>
77 #include <vtkCamera.h>
78 #include <vtkRenderer.h>
79 #include "vtkProperty.h"
118 switch ( this->State )
130 case VTKIS_FORWARDFLY:
131 case VTKIS_REVERSEFLY:
143 this->InvokeEvent(vtkViewImage2DCommand::InteractionEvent,
this);
150 int x = this->Interactor->GetEventPosition()[0];
151 int y = this->Interactor->GetEventPosition()[1];
155 this->FindPokedRenderer(x, y);
157 if ( this->Interactor->GetRepeatCount() )
212 int x = this->Interactor->GetEventPosition()[0];
213 int y = this->Interactor->GetEventPosition()[1];
215 this->FindPokedRenderer(x, y);
227 this->State = VTKIS_NONE;
247 this->State = VTKIS_NONE;
248 this->Superclass::StartPick();
273 this->State = VTKIS_NONE;
296 this->State = VTKIS_NONE;
297 this->Superclass::StartPick();
311 int x = this->Interactor->GetEventPosition()[0];
312 int y = this->Interactor->GetEventPosition()[1];
314 this->FindPokedRenderer(x, y);
315 if ( !this->CurrentRenderer )
324 this->
SliceStep =
static_cast< int >( this->MouseWheelMotionFactor );
330 this->
SliceStep =
static_cast< int >( this->MouseWheelMotionFactor );
343 int x = this->Interactor->GetEventPosition()[0];
344 int y = this->Interactor->GetEventPosition()[1];
346 this->FindPokedRenderer(x, y);
347 if ( !this->CurrentRenderer )
356 this->
SliceStep =
static_cast< int >( -this->MouseWheelMotionFactor );
362 this->
SliceStep =
static_cast< int >( -this->MouseWheelMotionFactor );
375 vtkRenderWindowInteractor *rwi = this->Interactor;
377 if ( !strcmp (rwi->GetKeySym(),
"Up") )
381 this->
SliceStep =
static_cast< int >( -this->MouseWheelMotionFactor );
385 else if ( !strcmp (rwi->GetKeySym(),
"Down") )
392 else if ( ( rwi->GetKeyCode() ==
'r' ) || ( rwi->GetKeyCode() ==
'R' ) )
394 this->InvokeEvent (vtkViewImage2DCommand::ResetWindowLevelEvent,
this);
396 else if ( ( rwi->GetKeyCode() ==
'o' ) || ( rwi->GetKeyCode() ==
'O' ) )
400 else if ( ( rwi->GetKeyCode() ==
'w' ) || ( rwi->GetKeyCode() ==
'W' ) )
402 vtkActorCollection *ac;
403 vtkActor *anActor, *aPart;
404 vtkAssemblyPath *path;
405 this->FindPokedRenderer(rwi->GetEventPosition()[0],
406 rwi->GetEventPosition()[1]);
407 if(this->CurrentRenderer!=0)
409 ac = this->CurrentRenderer->GetActors();
410 vtkCollectionSimpleIterator ait;
411 for (ac->InitTraversal(ait); (anActor = ac->GetNextActor(ait)); )
413 for (anActor->InitPathTraversal(); (path=anActor->GetNextPath()); )
419 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
422 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetLastNode()->GetViewProp())
433 aPart=
static_cast<vtkActor *
>(path->GetLastNode()->GetViewProp());
434 aPart->GetProperty()->SetRepresentationToWireframe();
441 vtkWarningMacro(<<
"no current renderer on the interactor style.");
446 else if ( ( rwi->GetKeyCode() ==
's' ) || ( rwi->GetKeyCode() ==
'S' ) )
448 vtkActorCollection *ac;
449 vtkActor *anActor, *aPart;
450 vtkAssemblyPath *path;
451 this->FindPokedRenderer(rwi->GetEventPosition()[0],
452 rwi->GetEventPosition()[1]);
453 if(this->CurrentRenderer!=0)
455 ac = this->CurrentRenderer->GetActors();
456 vtkCollectionSimpleIterator ait;
457 for (ac->InitTraversal(ait); (anActor = ac->GetNextActor(ait)); )
459 for (anActor->InitPathTraversal(); (path=anActor->GetNextPath()); )
465 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
468 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetLastNode()->GetViewProp())
479 aPart=
static_cast<vtkActor *
>(path->GetLastNode()->GetViewProp());
480 aPart->GetProperty()->SetRepresentationToSurface();
487 vtkWarningMacro(<<
"no current renderer on the interactor style.");
500 vtkRenderWindowInteractor *rwi = this->Interactor;
502 if ( !strcmp (rwi->GetKeySym(),
"Up") )
509 else if ( !strcmp (rwi->GetKeySym(),
"Down") )
516 else if ( !strcmp (rwi->GetKeySym(),
"o") )
520 else if ( !strcmp (rwi->GetKeySym(),
"r") )
522 this->InvokeEvent (vtkViewImage2DCommand::ResetWindowLevelEvent,
this);
546 if ( ( this->State != VTKIS_NONE ) && ( this->State != VTKIS_PICK ) )
610 return this->CurrentProp;
617 vtkRenderWindowInteractor *rwi = this->Interactor;
619 if ( this->CurrentRenderer != 0 )
621 vtkAssemblyPath *path = NULL;
622 int * eventPos = rwi->GetEventPosition();
623 this->FindPokedRenderer(eventPos[0], eventPos[1]);
624 rwi->StartPickCallback();
625 vtkAbstractPropPicker *picker =
626 vtkAbstractPropPicker::SafeDownCast( rwi->GetPicker() );
627 if ( picker != NULL )
629 picker->Pick(eventPos[0], eventPos[1],
630 0.0, this->CurrentRenderer);
631 path = picker->GetPath();
637 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
640 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetFirstNode()->GetViewProp())
650 this->HighlightProp(NULL);
651 this->PropPicked = 0;
655 this->HighlightProp( path->GetFirstNode()->GetViewProp() );
656 this->PropPicked = 1;
658 rwi->EndPickCallback();
666 this->State = VTKIS_NONE;
674 this->State = VTKIS_NONE;
682 this->State = VTKIS_NONE;
690 this->State = VTKIS_NONE;
692 this->Superclass::StartPick();