[vtkusers] Create and place widgets programmatically

AGPX agpxnet at yahoo.it
Tue Feb 3 11:21:28 EST 2009


Hi,

I need to save and load some widgets (distance widget, angle widget, etc...). I cannot find a way to create and place these widgets programmatically. Look at that example (for distance widget):

vtkDistanceWidget *widget = vtkDistanceWidget::New();
widget->SetInteractor(Interactor);
vtkPointHandleRepresentation2D *handle = vtkPointHandleRepresentation2D::New();
handle->GetProperty()->SetColor(1, 0, 0);
vtkDistanceRepresentation2D *rep = vtkDistanceRepresentation2D::New();
rep->SetHandleRepresentation(handle);
rep->GetAxis()->SetNumberOfMinorTicks(4);
rep->GetAxis()->SetTickLength(9);
rep->GetAxis()->SetTitlePosition(0.2);
widget->SetRepresentation(rep);
widget->On();

I have tried to place the points manually with a code like the following:

double pos1[3] = { ......., 0 }, pos2[3] = { ......, 0 };
rep->SetPoint1DisplayPosition(pos1);
rep->SetPoint2DisplayPosition(pos2);

but nothing happen. What I have to do?

Many thanks in advance,

- AGPX



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090203/5ef5bac5/attachment.htm>


More information about the vtkusers mailing list