VTK
|
Synchronize a collection on vtkWidgets drawn on different renderwindows using the Callback - Dispatch Action mechanism. More...
#include <vtkWidgetSet.h>
Public Types | |
typedef std::vector < vtkAbstractWidget * > | WidgetContainerType |
typedef WidgetContainerType::iterator | WidgetIteratorType |
typedef WidgetContainerType::const_iterator | WidgetConstIteratorType |
Public Member Functions | |
void | AddWidget (vtkAbstractWidget *) |
void | RemoveWidget (vtkAbstractWidget *) |
unsigned int | GetNumberOfWidgets () |
vtkAbstractWidget * | GetNthWidget (unsigned int) |
virtual void | SetEnabled (int) |
virtual void | EnabledOn () |
virtual void | EnabledOff () |
Static Public Member Functions | |
static vtkWidgetSet * | New () |
Public Attributes | |
WidgetContainerType | Widget |
typedef vtkObject | Superclass |
static int | IsTypeOf (const char *type) |
static vtkWidgetSet * | SafeDownCast (vtkObjectBase *o) |
virtual int | IsA (const char *type) |
vtkWidgetSet * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual vtkObjectBase * | NewInstanceInternal () const |
template<class TWidget > | |
void | DispatchAction (TWidget *caller, typename ActionFunction< TWidget >::TActionFunctionPointer action) |
vtkWidgetSet () | |
~vtkWidgetSet () |
Synchronize a collection on vtkWidgets drawn on different renderwindows using the Callback - Dispatch Action mechanism.
The class synchronizes a set of vtkAbstractWidget(s). Widgets typically invoke "Actions" that drive the geometry/behaviour of their representations in response to interactor events. Interactor interactions on a render window are mapped into "Callbacks" by the widget, from which "Actions" are dispatched to the entire set. This architecture allows us to tie widgets existing in different render windows together. For instance a HandleWidget might exist on the sagittal view. Moving it around should update the representations of the corresponding handle widget that lies on the axial and coronal and volume views as well.
vtkWidgetSet *set = vtkWidgetSet::New(); vtkParallelopipedWidget *w1 = vtkParallelopipedWidget::New(); set->AddWidget(w1); w1->SetInteractor(axialRenderWindow->GetInteractor()); vtkParallelopipedWidget *w2 = vtkParallelopipedWidget::New(); set->AddWidget(w2); w2->SetInteractor(coronalRenderWindow->GetInteractor()); vtkParallelopipedWidget *w3 = vtkParallelopipedWidget::New(); set->AddWidget(w3); w3->SetInteractor(sagittalRenderWindow->GetInteractor()); set->SetEnabled(1);
this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent, vtkEvent::NoModifier, 0, 0, NULL, vtkPaintbrushWidget::BeginDrawStrokeEvent, this, vtkPaintbrushWidget::BeginDrawCallback);
void vtkPaintbrushWidget::BeginDrawCallback(vtkAbstractWidget *w) { vtkPaintbrushWidget *self = vtkPaintbrushWidget::SafeDownCast(w); self->WidgetSet->DispatchAction(self, &vtkPaintbrushWidget::BeginDrawAction); }
void vtkPaintbrushWidget::BeginDrawAction( vtkPaintbrushWidget *dispatcher) { // Do stuff to draw... // Here dispatcher is the widget that was interacted with, the one that // dispatched an action to all the other widgets in its group. You may, if // necessary find it helpful to get parameters from it. // For instance for a ResizeAction: // if (this != dispatcher) // { // double *newsize = dispatcher->GetRepresentation()->GetSize(); // this->WidgetRep->SetSize(newsize); // } // else // { // this->WidgetRep->IncrementSizeByDelta(); // } }
Definition at line 112 of file vtkWidgetSet.h.
typedef vtkObject vtkWidgetSet::Superclass |
Standard methods for a VTK class.
Reimplemented from vtkObject.
Definition at line 120 of file vtkWidgetSet.h.
typedef std::vector< vtkAbstractWidget * > vtkWidgetSet::WidgetContainerType |
Definition at line 145 of file vtkWidgetSet.h.
typedef WidgetContainerType::iterator vtkWidgetSet::WidgetIteratorType |
Definition at line 146 of file vtkWidgetSet.h.
typedef WidgetContainerType::const_iterator vtkWidgetSet::WidgetConstIteratorType |
Definition at line 147 of file vtkWidgetSet.h.
vtkWidgetSet::vtkWidgetSet | ( | ) | [protected] |
Dispatch an "Action" to every widget in this set. This is meant to be invoked from a "Callback" in a widget.
vtkWidgetSet::~vtkWidgetSet | ( | ) | [protected] |
Dispatch an "Action" to every widget in this set. This is meant to be invoked from a "Callback" in a widget.
static vtkWidgetSet* vtkWidgetSet::New | ( | ) | [static] |
Instantiate this class.
Reimplemented from vtkObject.
static int vtkWidgetSet::IsTypeOf | ( | const char * | type | ) | [static] |
Standard methods for a VTK class.
Reimplemented from vtkObject.
virtual int vtkWidgetSet::IsA | ( | const char * | type | ) | [virtual] |
Standard methods for a VTK class.
Reimplemented from vtkObject.
static vtkWidgetSet* vtkWidgetSet::SafeDownCast | ( | vtkObjectBase * | o | ) | [static] |
Standard methods for a VTK class.
Reimplemented from vtkObject.
virtual vtkObjectBase* vtkWidgetSet::NewInstanceInternal | ( | ) | const [protected, virtual] |
Standard methods for a VTK class.
Reimplemented from vtkObject.
vtkWidgetSet* vtkWidgetSet::NewInstance | ( | ) | const |
Standard methods for a VTK class.
Reimplemented from vtkObject.
void vtkWidgetSet::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) | [virtual] |
Standard methods for a VTK class.
Reimplemented from vtkObject.
virtual void vtkWidgetSet::SetEnabled | ( | int | ) | [virtual] |
Method for activating and deactivating all widgets in the group.
virtual void vtkWidgetSet::EnabledOn | ( | ) | [virtual] |
Method for activating and deactivating all widgets in the group.
virtual void vtkWidgetSet::EnabledOff | ( | ) | [virtual] |
Method for activating and deactivating all widgets in the group.
void vtkWidgetSet::AddWidget | ( | vtkAbstractWidget * | ) |
Add a widget to the set.
void vtkWidgetSet::RemoveWidget | ( | vtkAbstractWidget * | ) |
Remove a widget from the set
unsigned int vtkWidgetSet::GetNumberOfWidgets | ( | ) |
Get number of widgets in the set.
vtkAbstractWidget* vtkWidgetSet::GetNthWidget | ( | unsigned | int | ) |
Get the Nth widget in the set.
void vtkWidgetSet::DispatchAction | ( | TWidget * | caller, |
typename ActionFunction< TWidget >::TActionFunctionPointer | action | ||
) | [inline] |
Dispatch an "Action" to every widget in this set. This is meant to be invoked from a "Callback" in a widget.
Definition at line 154 of file vtkWidgetSet.h.
Definition at line 148 of file vtkWidgetSet.h.