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

Method UnSelectAll

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

Source from the content-addressed store, hash-verified

347}
348
349void mitk::PointSetDataInteractor::UnSelectAll(mitk::StateMachineAction *, mitk::InteractionEvent *interactionEvent)
350{
351 unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData());
352 ScalarType timeInMs = interactionEvent->GetSender()->GetTime();
353
354 auto *positionEvent = dynamic_cast<InteractionPositionEvent *>(interactionEvent);
355 if (positionEvent != nullptr)
356 {
357 Point3D positioninWorld = positionEvent->GetPositionInWorld();
358 PointSet::PointsContainer::Iterator it, end;
359
360 PointSet::DataType *itkPointSet = m_PointSet->GetPointSet(timeStep);
361
362 end = itkPointSet->GetPoints()->End();
363
364 for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
365 {
366 int position = it->Index();
367 // then declare an operation which unselects this point;
368 // UndoOperation as well!
369 if (m_PointSet->GetSelectInfo(position, timeStep))
370 {
371 float distance = sqrt(positioninWorld.SquaredEuclideanDistanceTo(m_PointSet->GetPoint(position, timeStep)));
372 if (distance > m_SelectionAccuracy)
373 {
374 mitk::Point3D noPoint;
375 noPoint.Fill(0);
376 auto *doOp = new mitk::PointOperation(OpDESELECTPOINT, timeInMs, noPoint, position);
377
378 /*if ( m_UndoEnabled )
379 {
380 mitk::PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT, timeInMs, noPoint, position);
381 OperationEvent *operationEvent = new OperationEvent( m_PointSet, doOp, undoOp, "Unselect Point" );
382 OperationEvent::IncCurrObjectEventId();
383 m_UndoController->SetOperationEvent( operationEvent );
384 }*/
385
386 m_PointSet->ExecuteOperation(doOp);
387
388 if (!m_UndoEnabled)
389 delete doOp;
390 }
391 }
392 }
393 }
394 else
395 {
396 this->UnselectAll(timeStep, timeInMs);
397 }
398
399 RenderingManager::GetInstance()->RequestUpdateAll();
400}
401
402void mitk::PointSetDataInteractor::UpdatePointSet(mitk::StateMachineAction *, mitk::InteractionEvent *)
403{

Callers

nothing calls this directly

Calls 14

UnselectAllMethod · 0.95
GetSenderMethod · 0.80
GetTimeMethod · 0.80
GetPositionInWorldMethod · 0.80
GetSelectInfoMethod · 0.80
GetTimeStepMethod · 0.45
GetDataMethod · 0.45
GetPointSetMethod · 0.45
EndMethod · 0.45
BeginMethod · 0.45
GetPointMethod · 0.45
FillMethod · 0.45

Tested by

no test coverage detected