| 118 | } |
| 119 | |
| 120 | void 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 | |
| 158 | mitk::PointSetDataInteractor::PointSetDataInteractor() |
| 159 | : m_MaxNumberOfPoints(0), |
no test coverage detected