MCPcopy Create free account
hub / github.com/MITK/MITK / PickFrom3D

Method PickFrom3D

Modules/Gizmo/src/mitkGizmoInteractor.cpp:397–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397mitk::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
427void mitk::GizmoInteractor::UpdateHandleHighlight()
428{

Callers

nothing calls this directly

Calls 7

GetSenderMethod · 0.80
GetMapperMethod · 0.80
GetHandleFromPointIDMethod · 0.80
NewFunction · 0.50
GetVtkPropMethod · 0.45
GetVtkRendererMethod · 0.45

Tested by

no test coverage detected