Using a subclass of vtkInteractorStyle, I am able to mouse click on all the actors in the renderer and get the actor with find FindPickedActor(x,y) except for any type of line including vtkPolyLine. I have no problem selecting a vtkStructuredGrid or vtkSphereSource, for example. This is independent of how thick I set the line width as seen in the attached screen grab.
Here is a code snippet from my vtkInteractorStyle:
void myInteractorStyle::OnLeftButtonDown() {
int x = this->Interactor->GetEventPosition()[0];
int y = this->Interactor->GetEventPosition()[1];
this->FindPokedRenderer(x, y);
this->FindPickedActor(x, y);
if(this->InteractionProp != nullptr) {
std::cout << this->InteractionProp->GetObjectName() << std::endl;
}
}
and for my vtkPolyLine and actor:
vtkNew<vtkPolyLine> polyline;
for(int i=0;i<block->IMAX;i++) {
points->InsertNextPoint(x[i], y[i], 0.);
}
polyline->GetPointIds()->SetNumberOfIds(IMAX);
for(auto i=0;i<IMAX;++i) {
polyline->GetPointIds()->SetId(i, i);
}
cellArray->InsertNextCell(polyline);
polyData->SetPoints(points);
polyData->SetLines(cellArray);
polyDataMapper->SetInputData(polyData);
actor->SetMapper(polyDataMapper);
actor->GetProperty()->SetLineWidth(12);
actor->GetProperty()->SetColor(1., 0.1, 0.5);
actor->SetObjectName("PolyLine")
Would be great if someone knows how to pick the PolyLine Actor using FindPickedActor(x,y). Thanks!