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

Method OnMousePressed

Modules/Segmentation/src/Interactions/mitkContourTool.cpp:46–69  ·  view source on GitHub ↗

Just show the contour, insert the first point. */

Source from the content-addressed store, hash-verified

44 Just show the contour, insert the first point.
45*/
46void mitk::ContourTool::OnMousePressed(StateMachineAction *, InteractionEvent *interactionEvent)
47{
48 auto *positionEvent = dynamic_cast<mitk::InteractionPositionEvent *>(interactionEvent);
49 if (!positionEvent)
50 return;
51
52 m_LastEventSender = positionEvent->GetSender();
53 m_LastEventSlice = m_LastEventSender->GetSlice();
54
55 this->ClearsCurrentFeedbackContour(true);
56 mitk::Point3D point = positionEvent->GetPositionInWorld();
57 this->AddVertexToCurrentFeedbackContour(point);
58
59 FeedbackContourTool::SetFeedbackContourVisible(true);
60 auto renderWindow = positionEvent->GetSender()->GetRenderWindow();
61 assert(renderWindow);
62 auto renderManager = mitk::RenderingManager::GetInstance();
63 //This ensures that contour tools also make the renderwindow they interact with the focused
64 //window. For this tools it does not happen automatically as the mouse press event does not
65 //reach the RenderWindowManager. By Setting the focus it is possible to pass events like
66 //hot keys for time or slice cycling to the window
67 renderManager->SetRenderWindowFocus(renderWindow);
68 renderManager->RequestUpdate(renderWindow);
69}
70
71/**
72 Insert the point to the feedback contour.

Callers

nothing calls this directly

Calls 8

GetSenderMethod · 0.80
GetPositionInWorldMethod · 0.80
SetRenderWindowFocusMethod · 0.80
GetSliceMethod · 0.45
GetRenderWindowMethod · 0.45
RequestUpdateMethod · 0.45

Tested by

no test coverage detected