[vtkusers] How to catch events from vtkContourWidget?
Alex Malyushytskyy
alexmalvtk at gmail.com
Fri Dec 7 17:28:20 EST 2012
all events vtkContourWidget handles can be found in the source code constructor
You can see related vtkCommand and vtkWidgetEvent below.
// These are the event callbacks supported by this widget
this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent,
vtkWidgetEvent::Select,
this, vtkContourWidget::SelectAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::RightButtonPressEvent,
vtkWidgetEvent::AddFinalPoint,
this,
vtkContourWidget::AddFinalPointAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::MouseMoveEvent,
vtkWidgetEvent::Move,
this, vtkContourWidget::MoveAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonReleaseEvent,
vtkWidgetEvent::EndSelect,
this,
vtkContourWidget::EndSelectAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,
vtkEvent::NoModifier, 127,
1, "Delete",
vtkWidgetEvent::Delete,
this, vtkContourWidget::DeleteAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,
vtkEvent::ShiftModifier,
127, 1, "Delete",
vtkWidgetEvent::Reset,
this, vtkContourWidget::ResetAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::MiddleButtonPressEvent,
vtkWidgetEvent::Translate,
this,
vtkContourWidget::TranslateContourAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::MiddleButtonReleaseEvent,
vtkWidgetEvent::EndTranslate,
this,
vtkContourWidget::EndSelectAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::RightButtonPressEvent,
vtkWidgetEvent::Scale,
this,
vtkContourWidget::ScaleContourAction);
this->CallbackMapper->SetCallbackMethod(vtkCommand::RightButtonReleaseEvent,
vtkWidgetEvent::EndScale,
this,
vtkContourWidget::EndSelectAction);
I have not done this, so it might be better ways, but
I would probably just subclass and add my own even handler doing extra
things you need to be done and call original vtkContourWidget
static class methods if necessary.
In constructor:
this->CallbackMapper->SetCallbackMethod(vtkCommand::LeftButtonPressEvent,
vtkWidgetEvent::Select,
this,
myVtkContourWidget::MySelectAction);
void myVtkContourWidgetSelectAction( vtkAbstractWidget *w )
{
.... doo smth
vtkContourWidget::SelectAction( w );
.... doo smth
}
On Fri, Dec 7, 2012 at 8:35 AM, Massimo Bortolato
<massimo.bortolato at gmail.com> wrote:
> Hi all,
>
> I need to dynamically compute (and display) the perimeter of a
> vtkContourWidget, basically the same way as vtkDistanceWidget works.
> So I’d like to sniff the events generated by the widget, but it seems that
> there aren’t specific events associated with vtkContourWidget, or
> vtkContourRepresentation.
>
> Does anyones of you know how I can do?
>
> Thanks in advance
> Massimo
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list