[vtkusers] Possible bug in vtkSeedWidget - please comment on suggested fix

Rahul Khare rahul.vedic at gmail.com
Fri May 16 13:54:01 EDT 2014


Hi,

I am new here. I have been trying to use the vtkSeedWidget. In my
application I want to use the widget only for moving seeds around and not
create any new seeds. I noticed that the seed would move even when it was
not selected just because of a mouse move. I made a small change to the
function MoveAction(vtkAbstractWidget *w) in vtkSeedWidget.cxx. By changing
the following:

if (state == vtkSeedRepresentation::NearSeed)
    {

    self->RequestCursorShape( VTK_CURSOR_HAND );
            vtkSeedRepresentation *rep = static_cast<
                vtkSeedRepresentation * >(self->WidgetRep);
        int seedIdx = rep->GetActiveHandle();
        self->InvokeEvent( vtkCommand::InteractionEvent, &seedIdx );

        self->EventCallbackCommand->SetAbortFlag(1);

    }

to

if (state == vtkSeedRepresentation::NearSeed)
    {

    self->RequestCursorShape( VTK_CURSOR_HAND );
    if(self->WidgetState == CustomSeedWidget::MovingSeed)
    {
        vtkSeedRepresentation *rep = static_cast<
                vtkSeedRepresentation * >(self->WidgetRep);
        int seedIdx = rep->GetActiveHandle();
        self->InvokeEvent( vtkCommand::InteractionEvent, &seedIdx );

        self->EventCallbackCommand->SetAbortFlag(1);
    }
    }

This fixed the problem. Please comment and let me know if there is any
problem with this fix.

Thank you.
Rahul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140516/8f70d380/attachment.html>


More information about the vtkusers mailing list