52 if (m_MaxNumberOfPoints > 1 && m_PointSet->GetSize(timeStep) >= m_MaxNumberOfPoints)
58 if (positionEvent != NULL)
62 this->UnselectAll(timeStep, timeInMs);
66 it = m_PointSet->Begin(timeStep);
67 end = m_PointSet->End(timeStep);
70 if (!m_PointSet->IndexExists(lastPosition, timeStep))
90 m_UndoController->SetOperationEvent(operationEvent);
94 m_PointSet->ExecuteOperation(doOp);
104 IsClosedContour(stateMachineAction, interactionEvent);
106 if (m_MaxNumberOfPoints > 0 && m_PointSet->GetSize(timeStep) >= m_MaxNumberOfPoints)
109 this->NotifyResultReady();
123 if (positionEvent != NULL)
127 int index = GetPointIndexByPosition(point, timeStep);
132 this->UnselectAll(timeStep, timeInMs);
145 m_PointSet->ExecuteOperation(doOp);
169 if (positionEvent != NULL)
174 int position = m_PointSet->SearchPoint(itkPoint, m_SelectionAccuracy, timeStep);
188 m_UndoController->SetOperationEvent(operationEvent);
191 m_PointSet->ExecuteOperation(doOp);
200 if (m_PointSet->GetSize(timeStep) > 0)
202 this->SelectPoint(m_PointSet->Begin(timeStep)->Index(), timeStep, timeInMs);
214 if (positionEvent != NULL)
218 if (GetPointIndexByPosition(point, timeStep) != -1 && m_PointSet->GetSize(timeStep) >= 3)
231 if (positionEvent != NULL)
233 IsClosedContour(stateMachineAction, interactionEvent);
247 m_SumVec = m_SumVec + dirVector;
250 it = m_PointSet->Begin(timeStep);
251 end = m_PointSet->End(timeStep);
254 int position = it->Index();
255 if (m_PointSet->GetSelectInfo(position, timeStep))
262 resultPoint = sumVec + dirVector;
267 m_PointSet->ExecuteOperation(doOp);
272 m_LastPoint = newPoint;
275 IsClosedContour(stateMachineAction, interactionEvent);
285 if (positionEvent != NULL)
289 int index = GetPointIndexByPosition(point, timeStep);
304 m_PointSet->ExecuteOperation(doOp);
318 if (positionEvent != NULL)
321 PointSet::PointsContainer::Iterator it, end;
325 end = itkPointSet->GetPoints()->End();
327 for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
329 int position = it->Index();
332 if (m_PointSet->GetSelectInfo(position, timeStep))
334 float distance = sqrt(positioninWorld.SquaredEuclideanDistanceTo(m_PointSet->GetPoint(position, timeStep)));
335 if (distance > m_SelectionAccuracy)
349 m_PointSet->ExecuteOperation(doOp);
359 this->UnselectAll(timeStep, timeInMs);
366 if (pointSet == NULL)
368 MITK_ERROR <<
"PointSetDataInteractor:: No valid point set .";
372 m_PointSet = pointSet;
386 if (GetDataNode() !=
nullptr)
392 GetDataNode()->SetData(m_PointSet);
400 std::string strNumber;
401 if (properties->GetStringProperty(
"MaxPoints", strNumber))
403 m_MaxNumberOfPoints = atoi(strNumber.c_str());
412 if (positionEvent == NULL)
433 if (positionEvent != NULL)
446 it = m_PointSet->Begin(timeStep);
447 end = m_PointSet->End(timeStep);
450 int position = it->Index();
451 if (m_PointSet->GetSelectInfo(position, timeStep))
468 m_UndoController->SetOperationEvent(operationEvent);
471 m_PointSet->ExecuteOperation(doOp);
486 this->NotifyResultReady();
491 m_SelectionAccuracy = accuracy;
496 m_MaxNumberOfPoints = maxNumber;
514 float minDistance = m_SelectionAccuracy;
516 minDistance = accuracy;
520 float distance = sqrt(position.SquaredEuclideanDistanceTo(points->
GetPoint(it->Index(), time)));
533 if (positionEvent != NULL)
538 int index = GetPointIndexByPosition(point, timeStep);
548 if (pointSet == NULL)
554 if (itkPointSet == NULL)
559 mitk::PointSet::PointsContainer::Iterator it, end;
560 end = itkPointSet->GetPoints()->End();
562 for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
564 int position = it->Index();
566 itkPointSet->GetPointData(position, &pointData);
598 if ((pointSet == NULL) || (pointSet->
GetSize(timeStep) <= 0))
void UnselectAll(unsigned int timeStep, ScalarType timeInMs)
DataType::PointsContainerIterator PointsIterator
Super class for all position events.
BaseRenderer * GetSender() const
virtual void InitMove(StateMachineAction *, InteractionEvent *interactionEvent)
virtual int GetSize(unsigned int t=0) const
returns the current size of the point-list
Point3D GetPositionInWorld() const
virtual void RemovePoint(StateMachineAction *, InteractionEvent *interactionEvent)
virtual void ExecuteOperation(Operation *operation) override
executes the given Operation
virtual void MovePoint(StateMachineAction *, InteractionEvent *)
ScalarType GetTime() const
Get the time in ms of the currently displayed content.
virtual void UpdatePointSet(StateMachineAction *stateMachineAction, InteractionEvent *)
UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the ...
struct for data of a point
void SetMaxPoints(unsigned int maxNumber=0)
SetMaxPoints Sets the maximal number of points for the pointset Default ist zero, which result in inf...
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
virtual void AddPoint(StateMachineAction *, InteractionEvent *event)
Constants for most interaction classes, due to the generic StateMachines.
virtual ~PointSetDataInteractor()
virtual bool CheckSelection(const InteractionEvent *interactionEvent)
virtual void Abort(StateMachineAction *, InteractionEvent *)
T::Pointer GetData(const std::string &name)
virtual void DataNodeChanged() override
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
virtual DataType::Pointer GetPointSet(int t=0) const
returns the pointset
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual int GetPointIndexByPosition(Point3D position, unsigned int time=0, float accuracy=-1)
Return index in PointSet of the point that is within given accuracy to the provided position...
virtual void UnSelectAll(StateMachineAction *, InteractionEvent *)
virtual void SelectPoint(StateMachineAction *, InteractionEvent *)
Operation that handles all actions on one Point.
Dispatcher::Pointer GetDispatcher() const
Returns the Dispatcher which handles Events for this BaseRenderer.
virtual void IsClosedContour(StateMachineAction *, InteractionEvent *)
virtual unsigned int GetTimeStep() const
DataType::PointsContainer PointsContainer
#define CONNECT_CONDITION(a, f)
virtual void UnSelectPointAtPosition(StateMachineAction *, InteractionEvent *)
virtual void FinishMove(StateMachineAction *, InteractionEvent *)
static Pointer New(BaseRenderer *_arga, DataInteractor *_argb, const std::string &_argc)
static void IncCurrObjectEventId()
Increases the current ObjectEventId For example if a button click generates operations the ObjectEven...
#define CONNECT_FUNCTION(a, f)
virtual void ConnectActionsAndFunctions() override
void SetAccuracy(float accuracy)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Represents a pair of operations: undo and the according redo.