| 395 | } |
| 396 | |
| 397 | mitk::Gizmo::HandleType mitk::GizmoInteractor::PickFrom3D(const InteractionPositionEvent *positionEvent) |
| 398 | { |
| 399 | BaseRenderer *renderer = positionEvent->GetSender(); |
| 400 | auto &picker = m_Picker[renderer]; |
| 401 | if (picker == nullptr) |
| 402 | { |
| 403 | picker = vtkSmartPointer<vtkCellPicker>::New(); |
| 404 | picker->SetTolerance(0.005); |
| 405 | auto mapper = GetDataNode()->GetMapper(BaseRenderer::Standard3D); |
| 406 | auto vtk_mapper = dynamic_cast<VtkMapper *>(mapper); |
| 407 | if (vtk_mapper) |
| 408 | { // doing this each time is bizarre |
| 409 | picker->AddPickList(vtk_mapper->GetVtkProp(renderer)); |
| 410 | picker->PickFromListOn(); |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | auto displayPosition = positionEvent->GetPointerPositionOnScreen(); |
| 415 | picker->Pick(displayPosition[0], displayPosition[1], 0, positionEvent->GetSender()->GetVtkRenderer()); |
| 416 | |
| 417 | vtkIdType pickedPointID = picker->GetPointId(); |
| 418 | if (pickedPointID == -1) |
| 419 | { |
| 420 | return Gizmo::NoHandle; |
| 421 | } |
| 422 | |
| 423 | // _something_ picked |
| 424 | return m_Gizmo->GetHandleFromPointID(pickedPointID); |
| 425 | } |
| 426 | |
| 427 | void mitk::GizmoInteractor::UpdateHandleHighlight() |
| 428 | { |
nothing calls this directly
no test coverage detected