70 #include <vtkObjectFactory.h>
71 #include <vtkRenderWindowInteractor.h>
72 #include "vtkRenderer.h"
73 #include "vtkProperty.h"
79 #include "vtkAbstractPropPicker.h"
80 #include "vtkAssemblyPath.h"
103 switch ( this->State )
110 this->Superclass::OnMouseMove();
121 this->Superclass::OnRightButtonDown();
125 this->Superclass::OnMiddleButtonDown();
130 this->State = VTKIS_NONE;
131 this->Superclass::OnLeftButtonDown();
134 this->Superclass::OnLeftButtonDown();
146 this->Superclass::OnRightButtonUp();
149 this->Superclass::OnMiddleButtonUp();
152 this->State = VTKIS_NONE;
156 this->Superclass::OnLeftButtonUp();
168 this->Superclass::OnMiddleButtonDown();
171 this->State = VTKIS_NONE;
172 this->Superclass::OnRightButtonDown();
175 this->Superclass::OnRightButtonDown();
187 this->Superclass::OnMiddleButtonUp();
190 this->State = VTKIS_NONE;
194 this->Superclass::OnRightButtonUp();
206 this->Superclass::OnRightButtonDown();
209 this->State = VTKIS_NONE;
210 this->Superclass::OnMiddleButtonDown();
213 this->Superclass::OnMiddleButtonDown();
225 this->Superclass::OnRightButtonUp();
228 this->State = VTKIS_NONE;
232 this->Superclass::OnMiddleButtonUp();
240 vtkRenderWindowInteractor *rwi = this->Interactor;
242 if ( ( rwi->GetKeyCode() ==
'w' ) || ( rwi->GetKeyCode() ==
'W' ) )
244 vtkActorCollection *ac;
245 vtkActor *anActor, *aPart;
246 vtkAssemblyPath *path;
247 this->FindPokedRenderer(rwi->GetEventPosition()[0],
248 rwi->GetEventPosition()[1]);
249 if(this->CurrentRenderer!=0)
251 ac = this->CurrentRenderer->GetActors();
252 vtkCollectionSimpleIterator ait;
253 for (ac->InitTraversal(ait); (anActor = ac->GetNextActor(ait)); )
255 for (anActor->InitPathTraversal(); (path=anActor->GetNextPath()); )
261 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
264 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetLastNode()->GetViewProp())
275 aPart=
static_cast<vtkActor *
>(path->GetLastNode()->GetViewProp());
276 aPart->GetProperty()->SetRepresentationToWireframe();
283 vtkWarningMacro(<<
"no current renderer on the interactor style.");
288 else if ( ( rwi->GetKeyCode() ==
's' ) || ( rwi->GetKeyCode() ==
'S' ) )
290 vtkActorCollection *ac;
291 vtkActor *anActor, *aPart;
292 vtkAssemblyPath *path;
293 this->FindPokedRenderer(rwi->GetEventPosition()[0],
294 rwi->GetEventPosition()[1]);
295 if(this->CurrentRenderer!=0)
297 ac = this->CurrentRenderer->GetActors();
298 vtkCollectionSimpleIterator ait;
299 for (ac->InitTraversal(ait); (anActor = ac->GetNextActor(ait)); )
301 for (anActor->InitPathTraversal(); (path=anActor->GetNextPath()); )
307 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
310 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetLastNode()->GetViewProp())
321 aPart=
static_cast<vtkActor *
>(path->GetLastNode()->GetViewProp());
322 aPart->GetProperty()->SetRepresentationToSurface();
329 vtkWarningMacro(<<
"no current renderer on the interactor style.");
335 this->Superclass::OnChar();
370 if ( this->State != VTKIS_NONE )
375 this->InvokeEvent(vtkCommand::StartPickEvent,
this);
382 vtkRenderWindowInteractor *rwi = this->Interactor;
384 if ( this->CurrentRenderer != 0 )
386 vtkAssemblyPath *path = NULL;
387 int * eventPos = rwi->GetEventPosition();
388 this->FindPokedRenderer(eventPos[0], eventPos[1]);
389 rwi->StartPickCallback();
390 vtkAbstractPropPicker *picker =
391 vtkAbstractPropPicker::SafeDownCast( rwi->GetPicker() );
393 if ( picker != NULL )
395 picker->Pick(eventPos[0], eventPos[1],
396 0.0, this->CurrentRenderer);
397 path = picker->GetPath();
403 std::vector< vtkProp3D * >::iterator it2 =
m_PlanesActors.begin();
406 if(path && dynamic_cast<vtkProp*>(*it2) == path->GetFirstNode()->GetViewProp())
416 this->HighlightProp(NULL);
417 this->PropPicked = 0;
421 this->HighlightProp( path->GetFirstNode()->GetViewProp() );
422 this->PropPicked = 1;
424 rwi->EndPickCallback();
432 this->State = VTKIS_NONE;
441 this->State = VTKIS_NONE;
449 this->State = VTKIS_NONE;
457 this->State = VTKIS_NONE;
void EnableZoomMode()
Start the Zoom Mode.
vtkInteractorStyleImage3D()
void EnablePickMode()
Start the Pick Mode.
void EnableDefaultMode()
Start the Default Mode.
void SetCurrentProp(vtkProp *iCurrent)
Store the actor which is pointed by the cursor into "m_CurrentProp".
void SetPlanesActors(std::vector< vtkProp3D * > iBounds)
virtual void OnLeftButtonDown()
vtkStandardNewMacro(vtkInteractorStyleImage3D)
void SetCurrentState(bool iSate)
Store the actor which is pointed by the cursor into "m_CurrentProp".
virtual void OnRightButtonDown()
std::vector< vtkProp3D * > m_PlanesActors
bool GetCurrentState()
Store the actor which is pointed by the cursor into "m_CurrentProp".
void StartPick()
Start Pick Mode by updating the "State" and sending the "StartPickEvent".
vtkCxxRevisionMacro(vtkInteractorStyleImage3D,"$Revision: 1 $")
void HighlightCurrentActor()
Draw a bounding box around the "m_CurrentProp" (i.e. actor pointed by the mouse)
virtual void OnMouseMove()
void EnablePanMode()
Start the Pan Mode.
vtkProp * GetCurrentProp()
Return the actor which is pointed by the cursor.
Define the interactor behavior withing a vtkImage3D. 4 modes (Default, Zoom, Pan and Pick) ...
virtual void OnLeftButtonUp()
virtual void OnRightButtonUp()
virtual void OnMiddleButtonDown()
virtual void OnMiddleButtonUp()
~vtkInteractorStyleImage3D()