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

Method SelectPoint

Modules/Core/src/Interactions/mitkPointSetDataInteractor.cpp:120–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void mitk::PointSetDataInteractor::SelectPoint(StateMachineAction *, InteractionEvent *interactionEvent)
121{
122 unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData());
123 ScalarType timeInMs = interactionEvent->GetSender()->GetTime();
124
125 auto *positionEvent = dynamic_cast<InteractionPositionEvent *>(interactionEvent);
126 if (positionEvent != nullptr)
127 {
128 Point3D point = positionEvent->GetPositionInWorld();
129 // iterate over point set and check if it contains a point close enough to the pointer to be selected
130 int index = GetPointIndexByPosition(point, timeStep);
131 if (index != -1)
132 {
133 // first deselect the other points
134 // undoable deselect of all points in the DataList
135 this->UnselectAll(timeStep, timeInMs);
136
137 auto *doOp = new mitk::PointOperation(OpSELECTPOINT, timeInMs, point, index);
138
139 /*if (m_UndoEnabled)
140 {
141 PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMs,point, index);
142 OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Select Point");
143 OperationEvent::IncCurrObjectEventId();
144 m_UndoController->SetOperationEvent(operationEvent);
145 }*/
146
147 // execute the Operation
148 m_PointSet->ExecuteOperation(doOp);
149
150 if (!m_UndoEnabled)
151 delete doOp;
152
153 RenderingManager::GetInstance()->RequestUpdateAll();
154 }
155 }
156}
157
158mitk::PointSetDataInteractor::PointSetDataInteractor()
159 : m_MaxNumberOfPoints(0),

Callers 1

RemovePointMethod · 0.95

Calls 11

UnselectAllMethod · 0.95
GetSenderMethod · 0.80
GetTimeMethod · 0.80
GetPositionInWorldMethod · 0.80
GetTimeStepMethod · 0.45
GetDataMethod · 0.45
ExecuteOperationMethod · 0.45
RequestUpdateAllMethod · 0.45
GetDataNodeMethod · 0.45
GetSizeMethod · 0.45
FillMethod · 0.45

Tested by

no test coverage detected