[vtkusers] Can we add a check to see if we have at least 2 nodes when vtkContourWidget is in Manipulate state?

Yumin Yuan yumin.yuan at kitware.com
Fri Jan 22 15:07:30 EST 2016


Hi Mengda,

I will suggest to figure out why it is crashing first. Even with only one
node, it should still work.

Also, assuming you are using this method vtkContourWidget::Initialize(
vtkPolyData * poly, int state = 1, vtkIdList *idList = NULL ), your input
poly doesn't have any points?

Yumin

On Fri, Jan 22, 2016 at 10:40 AM, Mengda Wu <wumengda at gmail.com> wrote:

> Hi all,
>
>    I would like to set the state of vtkContourWidget to Manipulate at
> initialize and add the nodes programmably instead of interactively.
> Everything is fine but I have to check the there are at least 2 nodes in
> the following, otherwise AddNodeOnContour will crash
>
> So I hope you can change the following function to
>
> void vtkContourWidget::SelectAction( vtkAbstractWidget *w )
> {
>
> ................
> ................
>
>   switch ( self->WidgetState )
>     {
>     case vtkContourWidget::Start:
>     case vtkContourWidget::Define:
> ................
> ................
>     case vtkContourWidget::Manipulate:
>       {
>       if ( rep->ActivateNode( X, Y ) )
>         {
> ................
> ................
>         }
>       else if ( rep->GetNumberOfNodes()>1 && rep->AddNodeOnContour( X, Y )
> )   //Ensure the number of nodes is at least 2
>         {
> ................
> ................
>         }
> ................
> ................
> }
>
>
>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160122/f329662e/attachment.html>


More information about the vtkusers mailing list