00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #ifndef MITKCONNECTPOINTSINTERACTOR_H_HEADER_INCLUDED_C11202FF 00020 #define MITKCONNECTPOINTSINTERACTOR_H_HEADER_INCLUDED_C11202FF 00021 00022 #include "mitkCommon.h" 00023 #include "MitkExtExports.h" 00024 #include "mitkVector.h" 00025 #include <mitkInteractor.h> 00026 00027 namespace mitk 00028 { 00029 class DataNode; 00030 //##Documentation 00031 //## @brief Interaction for mitk::Mesh: Connect existing points to lines 00032 //## @ingroup Interaction 00033 class MitkExt_EXPORT ConnectPointsInteractor : public Interactor 00034 { 00035 public: 00036 mitkClassMacro(ConnectPointsInteractor, Interactor); 00037 mitkNewMacro3Param(Self, const char*, DataNode*, int); 00038 mitkNewMacro2Param(Self, const char*, DataNode*); 00039 00040 //##Documentation 00041 //## @brief Sets the amount of precision 00042 void SetPrecision( unsigned int precision ); 00043 00044 //##Documentation 00045 //## @brief calculates how good the data, this statemachine handles, is hit by the event. 00046 //## 00047 //## overwritten, cause we don't look at the boundingbox, we look at each point 00048 virtual float CanHandleEvent(StateEvent const* stateEvent) const; 00049 00050 00051 protected: 00052 //##Documentation 00053 //##@brief Constructor with Param n for limited Set of Points 00054 //## 00055 //## if no n is set, then the number of points is unlimited* 00056 ConnectPointsInteractor(const char * type, DataNode* dataNode, int n = -1); 00057 00058 virtual ~ConnectPointsInteractor(); 00059 00060 virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ); 00061 00062 //##Documentation 00063 //## @brief deselects the Points in the PointSet. 00064 //## supports Undo if enabled 00065 void UnselectAll(); 00066 00067 //##Documentation 00068 //## @brief Selects the point. 00069 //## supports Undo if enabled. 00070 //## @param position is the index of the point that has to be selected 00071 void SelectPoint( int position ); 00072 00073 private: 00074 00075 //##Documentation 00076 //## @brief the number of possible points in this object 00077 //## 00078 //## if -1, then no limit set 00079 int m_N; 00080 00081 //##Documentation 00082 //## @brief stores the current CellId this Statemachine works in 00083 unsigned int m_CurrentCellId; 00084 00085 //##Documentation 00086 //## @brief to calculate a direction vector from last point and actual point 00087 Point3D m_LastPoint; 00088 00089 //##Documentation 00090 //## @brief summ-vector for Movement 00091 Vector3D m_SumVec; 00092 00093 //##Documentation 00094 //## @brief to store the value of precision to pick a point 00095 unsigned int m_Precision; 00096 }; 00097 } 00098 #endif /* MITKCONNECTPOINTSINTERACTOR_H_HEADER_INCLUDED_C11202FF */