Commit e0d6fc17 authored by Ken Martin's avatar Ken Martin

add Button3D and Move3D support to InteractorStyle

also add some new states that subclasses can use
move PICK state into InteractorStyle from Image
subclass.
parent 104a38c8
......@@ -65,8 +65,7 @@
// Motion flags
#define VTKIS_WINDOW_LEVEL 1024
#define VTKIS_PICK 1025
#define VTKIS_SLICE 1026
#define VTKIS_SLICE 1025
// Style flags
......
......@@ -291,6 +291,13 @@ void vtkInteractorStyle::SetInteractor(vtkRenderWindowInteractor *i)
i->AddObserver(vtkCommand::FifthButtonReleaseEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::Move3DEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::Button3DEvent,
this->EventCallbackCommand,
this->Priority);
}
this->EventForwarder->SetTarget(this->Interactor);
......@@ -994,6 +1001,8 @@ void vtkInteractorStyle::ProcessEvents(vtkObject* vtkNotUsed(object),
vtkInteractorStyle* self
= reinterpret_cast<vtkInteractorStyle *>( clientdata );
bool aborted = false;
switch(event)
{
case vtkCommand::ExposeEvent:
......@@ -1336,5 +1345,28 @@ void vtkInteractorStyle::ProcessEvents(vtkObject* vtkNotUsed(object),
}
break;
case vtkCommand::Move3DEvent:
if (self->HandleObservers &&
self->HasObserver(vtkCommand::Move3DEvent))
{
aborted = (self->InvokeEvent(vtkCommand::Move3DEvent, calldata) == 1);
}
if (!aborted)
{
self->OnMove3D(static_cast<vtkEventData*>(calldata));
}
break;
case vtkCommand::Button3DEvent:
if (self->HandleObservers &&
self->HasObserver(vtkCommand::Button3DEvent))
{
aborted = (self->InvokeEvent(vtkCommand::Button3DEvent, calldata) == 1);
}
if (!aborted)
{
self->OnButton3D(static_cast<vtkEventData*>(calldata));
}
break;
}
}
......@@ -97,20 +97,26 @@
// Motion flags
#define VTKIS_START 0
#define VTKIS_NONE 0
#define VTKIS_ROTATE 1
#define VTKIS_PAN 2
#define VTKIS_SPIN 3
#define VTKIS_DOLLY 4
#define VTKIS_ZOOM 5
#define VTKIS_USCALE 6
#define VTKIS_TIMER 7
#define VTKIS_FORWARDFLY 8
#define VTKIS_REVERSEFLY 9
#define VTKIS_TWO_POINTER 10
#define VTKIS_CLIP 11
#define VTKIS_START 0
#define VTKIS_NONE 0
#define VTKIS_ROTATE 1
#define VTKIS_PAN 2
#define VTKIS_SPIN 3
#define VTKIS_DOLLY 4
#define VTKIS_ZOOM 5
#define VTKIS_USCALE 6
#define VTKIS_TIMER 7
#define VTKIS_FORWARDFLY 8
#define VTKIS_REVERSEFLY 9
#define VTKIS_TWO_POINTER 10
#define VTKIS_CLIP 11
#define VTKIS_PICK 12 // perform a pick at the last location
#define VTKIS_LOAD_CAMERA_POSE 13 // iterate through saved camera poses
#define VTKIS_POSITION_PROP 14 // adjust the position, orientation of a prop
#define VTKIS_EXIT 15 // call exit callback
#define VTKIS_TOGGLE_DRAW_CONTROLS 16 // draw device controls helpers
#define VTKIS_MENU 17 // invoke an application menu
#define VTKIS_ANIM_OFF 0
#define VTKIS_ANIM_ON 1
......@@ -118,6 +124,7 @@
class vtkActor2D;
class vtkActor;
class vtkCallbackCommand;
class vtkEventData;
class vtkEventForwarderCommand;
class vtkOutlineSource;
class vtkPolyDataMapper;
......@@ -227,6 +234,13 @@ public:
virtual void OnFifthButtonDown() {}
virtual void OnFifthButtonUp() {}
/**
* Generic 3D event bindings can be overridden in subclasses
*/
virtual void OnMove3D(vtkEventData *) {}
virtual void OnButton3D(vtkEventData *) {}
/**
* OnChar is triggered when an ASCII key is pressed. Some basic key presses
* are handled here ('q' for Quit, 'p' for Pick, etc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment