bool mitk::PointSetDataInteractor::AddPoint(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent) { // Find the position, the point is to be added to: first entry with // empty index. If the Set is empty, then start with 0. if not empty, // then take the first index which is not occupied int lastPosition = 0; PointSet::PointsContainer* pointsContainer = m_PointSet->GetPointSet(0)->GetPoints(); if (!pointsContainer->empty()) { mitk::PointSet::PointsIterator it, end; it = pointsContainer->Begin(); end = pointsContainer->End(); while (it != end) { if (!pointsContainer->IndexExists(lastPosition)) break; ++it; ++lastPosition; } } InteractionPositionEvent* positionEvent = dynamic_cast<InteractionPositionEvent*>(interactionEvent); if (positionEvent != NULL) { IsClosedContour(stateMachineAction, interactionEvent); // Get time step from BaseRenderer int timeStep = positionEvent->GetSender()->GetTimeStep(); mitk::Point3D point = positionEvent->GetPositionInWorld(); m_PointSet->InsertPoint(lastPosition, point, timeStep); m_NumberOfPoints++; GetDataNode()->SetData(m_PointSet); GetDataNode()->Modified(); if (m_MaxNumberOfPoints != 0 && m_NumberOfPoints >= m_MaxNumberOfPoints) { InternalEvent::Pointer event = InternalEvent::New(NULL, this, "MaxNumberOfPoints"); positionEvent->GetSender()->GetDispatcher()->QueueEvent(event.GetPointer()); } mitk::RenderingManager::GetInstance()->RequestUpdateAll(); return true; } else { return false; } }