How to delete all nodes in the vtkContourWidget without crashes?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to delete all nodes in the vtkContourWidget without crashes?

Mengda Wu-3
Hello all,

   I am trying to delete all nodes (user defined) in vtkContourWidget but the following code crashes when I call ClearAllNodes. Why is this? How to do it correctly?

vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRepresentation = vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();

drawWidget = vtkSmartPointer<vtkContourWidget>::New();
drawWidget ->SetRepresentation(contourRepresentation);
drawWidget ->SetInteractor(this->GetInteractor());
drawWidget->On();

   vtkOrientedGlyphContourRepresentation *contourRepresentation =    vtkOrientedGlyphContourRepresentation::SafeDownCast(vtkContourWidget->GetContourRepresentation());
   vtkContourWidget->GetContourRepresentation()->ClearAllNodes() //crash happens

Thanks,
Mengda

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to delete all nodes in the vtkContourWidget without crashes?

alican
Probably a late and an unnecessary answer, but I think you should turn the
widget off first:

drawWidget->Off();

and only then  to try and clear nodes.



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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:
https://vtk.org/mailman/listinfo/vtkusers