[vtk-developers] OSX Cocoa - vtkDistanceWidget issues

Costantino Pistagna costantino.pistagna at gmail.com
Wed Oct 3 12:00:47 EDT 2012


Hi,

I'm working on a software visualization tool here at INAF Catania. Currently, I'm developing an early beta of the product on Cocoa/C++.

For our tool we need to implement a vtkDistanceWidget, in order to evalute the distance between some points on a rendered polydata.

I've read some documents and sample code and I modified my code as follow:

- (void)addActor:(vtkActor *)anActor resetCamera:(BOOL)resetCamera {
    //the distance widget
    vtkSmartPointer<vtkDistanceWidget> distanceWidget = vtkSmartPointer<vtkDistanceWidget>::New();
    distanceWidget->SetInteractor([self getInteractor]);
    distanceWidget->CreateDefaultRepresentation();
    static_cast<vtkDistanceRepresentation *>(distanceWidget->GetRepresentation())->SetLabelFormat("%-#6.3g mm");
    
    [self getVTKRenderWindow]->Render();
    [self getInteractor]->Initialize();
    [self getVTKRenderWindow]->Render();
    distanceWidget->On();

    //add the actor to the current render window
    renderer->AddActor(anActor);
    if(resetCamera) renderer->ResetCamera();
    renderer->Render();
    distanceWidget->On();

    [self setNeedsDisplay:YES];
}

The documentation states that I will be able to use the default actions binded to the vtkWidget in order to add the two points required for the distance calculation. However, I can't find any way to interact with the widget. The mouse is always binded with the rotation default gesture.

I've tried to comment the addActor at all, without any success. Is there something that i'm missing? Have you some code to looking for? Is there any limitations with Cocoa implementation of VTK?


Many thanks,
--
c.




More information about the vtk-developers mailing list