[vtkusers] vtkDistanceWidget and vtkCanvas

Marco Sambin m.sambin at gmail.com
Tue Jan 17 13:10:43 EST 2012


Hi all.
I am trying to use a vtkDistanceWidget in my vtkCanvas-derived class.

In the constructor of my vtkCanvas-derived class, I have the following code:

[...]
    // Initialize the measurements widget
    vtkDistanceWidget distWidget = new vtkDistanceWidget();
    distWidget.SetInteractor(iren);
    vtkPointHandleRepresentation2D handle = new
vtkPointHandleRepresentation2D();
    handle.GetProperty().SetColor(1, 0, 0);
    vtkDistanceRepresentation2D rep = new vtkDistanceRepresentation2D();
    rep.SetHandleRepresentation(handle);
    rep.GetAxis().SetNumberOfMinorTicks(4);
    rep.GetAxis().SetTickLength(9);
    rep.GetAxis().SetTitlePosition(0.2);
    distWidget.SetRepresentation(rep);
    distWidget.On();
[...]

For now, my vtkCanvas is empty, and there is no other relevant code in
the constructor.

I cannot get the vtkDistanceWidget to work. Nothing appears on screen
when I left-press on my vtkCanvas.

Am I missing something fundamental in order to have the
vtkDistanceWidget to work?

Thanks in advance for any hint.

Best regards,

Marco



More information about the vtkusers mailing list