Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED
00020 #define MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED
00021
00022 #include "PlanarFigureExports.h"
00023
00024 #include "mitkCommon.h"
00025 #include "mitkVector.h"
00026 #include "mitkInteractor.h"
00027 #include "mitkBaseRenderer.h"
00028
00029 #include <itkEventObject.h>
00030
00031 namespace mitk
00032 {
00033
00034 class DataNode;
00035 class Geometry2D;
00036 class DisplayGeometry;
00037 class PlanarFigure;
00038
00039
00040
00041 itkEventMacro( PlanarFigureEvent, itk::AnyEvent );
00042 itkEventMacro( StartPlacementPlanarFigureEvent, PlanarFigureEvent );
00043 itkEventMacro( EndPlacementPlanarFigureEvent, PlanarFigureEvent );
00044 itkEventMacro( SelectPlanarFigureEvent, PlanarFigureEvent );
00045 itkEventMacro( StartInteractionPlanarFigureEvent, PlanarFigureEvent );
00046 itkEventMacro( EndInteractionPlanarFigureEvent, PlanarFigureEvent );
00047 itkEventMacro( StartHoverPlanarFigureEvent, PlanarFigureEvent );
00048 itkEventMacro( EndHoverPlanarFigureEvent, PlanarFigureEvent );
00049
00050
00051
00052
00058 class PlanarFigure_EXPORT PlanarFigureInteractor : public Interactor
00059 {
00060 public:
00061 mitkClassMacro(PlanarFigureInteractor, Interactor);
00062 mitkNewMacro3Param(Self, const char *, DataNode *, int);
00063 mitkNewMacro2Param(Self, const char *, DataNode *);
00064
00066 void SetPrecision( ScalarType precision );
00067
00074 virtual float CanHandleEvent(StateEvent const *stateEvent) const;
00075
00076
00077 protected:
00083 PlanarFigureInteractor(const char *type,
00084 DataNode *dataNode, int n = -1);
00085
00089 virtual ~PlanarFigureInteractor();
00090
00091 virtual bool ExecuteAction( Action *action,
00092 mitk::StateEvent const *stateEvent );
00093
00094 bool TransformPositionEventToPoint2D( const StateEvent *stateEvent,
00095 Point2D &point2D,
00096 const Geometry2D *planarFigureGeometry );
00097
00098 bool TransformObjectToDisplay( const mitk::Point2D &point2D,
00099 mitk::Point2D &displayPoint,
00100 const mitk::Geometry2D *objectGeometry,
00101 const mitk::Geometry2D *rendererGeometry,
00102 const mitk::DisplayGeometry *displayGeometry ) const;
00103
00109 bool IsPointNearLine( const mitk::Point2D& point,
00110 const mitk::Point2D& startPoint, const mitk::Point2D& endPoint ) const;
00111
00114 bool IsPositionOverFigure(
00115 const StateEvent *StateEvent, PlanarFigure *planarFigure,
00116 const Geometry2D *planarFigureGeometry,
00117 const Geometry2D *rendererGeometry,
00118 const DisplayGeometry *displayGeometry ) const;
00119
00123 int IsPositionInsideMarker(
00124 const StateEvent *StateEvent, const PlanarFigure *planarFigure,
00125 const Geometry2D *planarFigureGeometry,
00126 const Geometry2D *rendererGeometry,
00127 const DisplayGeometry *displayGeometry ) const;
00128
00129 void LogPrintPlanarFigureQuantities( const PlanarFigure *planarFigure );
00130
00131 private:
00132
00134 ScalarType m_Precision;
00135
00137 bool m_IsHovering;
00138 };
00139
00140 }
00141
00142 #endif // MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED