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 #include "mitkDisplayPointSetInteractor.h"
00020 #include "mitkInteractionConst.h"
00021 #include "mitkStateEvent.h"
00022 #include "mitkBaseRenderer.h"
00023 #include "mitkVector.h"
00024
00025
00026
00027 mitk::DisplayPointSetInteractor
00028 ::DisplayPointSetInteractor(const char * type, DataNode* dataNode, int n)
00029 :PointSetInteractor(type, dataNode, n)
00030 {
00031
00032
00033 }
00034
00035 mitk::DisplayPointSetInteractor::~DisplayPointSetInteractor()
00036 {
00037 }
00038
00039
00040 bool mitk::DisplayPointSetInteractor
00041 ::ExecuteAction( Action* action, mitk::StateEvent const* stateEvent )
00042 {
00043 bool ok = false;
00044
00045
00046
00047
00048
00049
00050 switch (action->GetActionId())
00051 {
00052 case AcADDPOINT:
00053 {
00054 mitk::DisplayPositionEvent const *posEvent =
00055 dynamic_cast < const mitk::DisplayPositionEvent * >
00056 (stateEvent->GetEvent());
00057 if ( posEvent == NULL )
00058 {
00059 return false;
00060 }
00061
00062 m_LastDisplayCoordinates = posEvent->GetDisplayPosition();
00063 m_LastRenderer = posEvent->GetSender();
00064
00065
00066 ok = Superclass::ExecuteAction( action, stateEvent );
00067 break;
00068 }
00069 case AcREMOVEPOINT:
00070 {
00071 mitk::DisplayPositionEvent const *posEvent =
00072 dynamic_cast < const mitk::DisplayPositionEvent * >
00073 (stateEvent->GetEvent());
00074 if ( posEvent == NULL )
00075 {
00076 return false;
00077 }
00078
00079 m_LastDisplayCoordinates = posEvent->GetDisplayPosition();
00080 m_LastRenderer = posEvent->GetSender();
00081
00082
00083 ok = Superclass::ExecuteAction( action, stateEvent );
00084 break;
00085 }
00086 case AcREMOVEALL:
00087 {
00088 mitk::DisplayPositionEvent const *posEvent =
00089 dynamic_cast < const mitk::DisplayPositionEvent * >
00090 (stateEvent->GetEvent());
00091 if ( posEvent == NULL )
00092 {
00093 return false;
00094 }
00095
00096 m_LastDisplayCoordinates = posEvent->GetDisplayPosition();
00097 m_LastRenderer = posEvent->GetSender();
00098
00099
00100 ok = Superclass::ExecuteAction( action, stateEvent );
00101 break;
00102 }
00103 case AcFINISHMOVEMENT:
00104 {
00105 mitk::DisplayPositionEvent const *posEvent =
00106 dynamic_cast < const mitk::DisplayPositionEvent * >
00107 (stateEvent->GetEvent());
00108 if ( posEvent == NULL )
00109 {
00110 return false;
00111 }
00112
00113 m_LastDisplayCoordinates = posEvent->GetDisplayPosition();
00114 m_LastRenderer = posEvent->GetSender();
00115
00116
00117 ok = Superclass::ExecuteAction( action, stateEvent );
00118 break;
00119 }
00120
00121 default:
00122 return Superclass::ExecuteAction( action, stateEvent );
00123 }
00124
00125 return ok;
00126 }
00127
00128 mitk::Point2D mitk::DisplayPointSetInteractor::GetLastDisplayCoordinates()
00129 {
00130 return m_LastDisplayCoordinates;
00131 }
00132
00133 mitk::BaseRenderer* mitk::DisplayPointSetInteractor::GetLastRenderer()
00134 {
00135 return m_LastRenderer;
00136 }