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 #include <mitkConferenceEventMapper.h>
00019 #include <mitkCameraController.h>
00020 #include <mitkBaseRenderer.h>
00021 #include <mitkPositionEvent.h>
00022 #include <mitkRenderingManager.h>
00023 #include <mitkGlobalInteraction.h>
00024
00025
00026 mitk::ConferenceEventMapper::ConferenceEventMapper(){}
00027
00028 mitk::ConferenceEventMapper::~ConferenceEventMapper(){}
00029
00030
00031 bool
00032 mitk::ConferenceEventMapper::MapEvent(signed int mitkEventID, const char* sender, int Etype, int Estate, int Ebuttonstate, int Ekey, float w1,float w2,float w3,float p1,float p2)
00033 {
00034
00035
00036 mitk::BaseRenderer *br = const_cast<mitk::BaseRenderer*>(mitk::BaseRenderer::GetByName( std::string(sender) ));
00037
00038 mitk::Point3D p3d;
00039 p3d[0] = (mitk::ScalarType) w1;
00040 p3d[1] = (mitk::ScalarType) w2;
00041 p3d[2] = (mitk::ScalarType) w3;
00042
00043
00044 mitk::Point2D p2d;
00045 p2d[0] = (mitk::ScalarType) p1 * br->GetSizeX();
00046 p2d[1] = (mitk::ScalarType) p2 * br->GetSizeX();
00047
00048
00049 mitk::PositionEvent *pe = new mitk::PositionEvent(br,Etype,Estate,Ebuttonstate,Ekey,p2d,p3d);
00050
00051
00052 mitk::Point2D p2d_mm, pos_unit;
00053
00054 if (br->GetDisplayGeometry()->Map( p3d, p2d_mm ) )
00055 {
00056
00057 br->GetDisplayGeometry()->WorldToDisplay( p2d_mm, pos_unit);
00058
00059 br->DrawOverlayMouse(pos_unit);
00060
00061 }
00062
00063
00064
00065
00066
00067 if( br->GetMapperID() == 2 )
00068 {
00069 mitk::CameraController* cc = br->GetCameraController();
00070
00071
00072 if (Etype == 6)
00073 {
00074
00075
00076 ;
00077 }
00078 else
00079 {
00080
00081 p2d[1] = (mitk::ScalarType) (br->GetSizeY() - p2) * br->GetSizeY();
00082 mitk::PositionEvent *peVTK = new mitk::PositionEvent(br,Etype,Estate,Ebuttonstate,Ekey,p2d,p3d);
00083
00084
00085
00086 if(Etype == 2)
00087 {
00088 cc->MousePressEvent( peVTK );
00089 }
00090 else if (Etype == 3 )
00091 {
00092
00093 cc->MouseReleaseEvent( peVTK );
00094 }
00095 else if (Etype == 5)
00096 {
00097
00098 cc->MouseMoveEvent( peVTK );
00099 }
00100 }
00101 }
00102
00103 bool ok = EventMapper::MapEvent( pe, mitk::GlobalInteraction::GetInstance(), mitkEventID );
00104
00105 return ok;
00106 }
00107
00108 bool
00109 mitk::ConferenceEventMapper::MapEvent(const char* sender, float w1, float w2, float w3)
00110 {
00111
00112
00113 mitk::BaseRenderer *br = const_cast<mitk::BaseRenderer*>(mitk::BaseRenderer::GetByName( std::string(sender) ));
00114
00115 mitk::Point3D p3d;
00116 p3d[0] = (mitk::ScalarType) w1;
00117 p3d[1] = (mitk::ScalarType) w2;
00118 p3d[2] = (mitk::ScalarType) w3;
00119
00120
00121 mitk::Point2D p2d_mm, pos_unit;
00122
00123 if (br->GetDisplayGeometry()->Map( p3d, p2d_mm ) )
00124 {
00125
00126 br->GetDisplayGeometry()->WorldToDisplay( p2d_mm, pos_unit);
00127
00128 br->DrawOverlayMouse(pos_unit);
00129
00130 }
00131
00132 return true;
00133 }
00134
00135