[vtk-developers] propsed mods to vtkContourWidget

Dean Inglis dean.inglis at camris.ca
Fri Mar 5 17:30:57 EST 2010

Hi all,

further to my brief vtkusers discussion with Karthik,
I would like to add a ContinuousMode bool ivar to vtkContourWidget
so that users can freehand draw on an image (for example).  Would
anyone prefer a different ivar name, e.g. "Continuous" :


Currently I have it working so that if the user left button clicks
the continuous drawing occurs and continues drawing whether or
not the left button is released until the right button is clicked to
terminate contour definition.

What I would like to see happen is that the
continuous mode only works if the left button is pressed and
held down.  If the left button is let up, the widget reverts back to
normal left click down and up to place nodes until right button
is clicked to terminate defining a contour.

I would also like to add functionality to the widget to respond
to a key press to delete the contour and hence reset the widget.
This would involve creating a static method

static void ResetAction(vtkAbstractWidget*);

void vtkContourWidget::EndSelectAction(vtkAbstractWidget *w)
  vtkContourWidget *self = reinterpret_cast<vtkContourWidget*>(w);

and creating a new event in vtkWidgetEvent:

so that in the widget's constructor we could have:

                                          vtkEvent::ShiftModifier, 127, 1, 

I would appreciate any comments or suggestions you may have.
Attached is the modified code that allows continuous drawing.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkContourWidget.cxx
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100305/e12dfe25/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtkContourWidget.h
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100305/e12dfe25/attachment.h>

More information about the vtk-developers mailing list