Index: mitk/Core/Code/CMakeLists.txt =================================================================== --- mitk/Core/Code/CMakeLists.txt (revision 24358) +++ mitk/Core/Code/CMakeLists.txt (working copy) @@ -19,7 +19,7 @@ INCLUDE_DIRS Algorithms DataManagement Controllers Interactions IO Rendering ${MITK_BINARY_DIR} INTERNAL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} ${IPSEGMENTATION_INCLUDE_DIR} ${ANN_INCLUDE_DIR} PROVIDES mitkCore - DEPENDS mitkIpPic mbilog tinyxml + DEPENDS mitkIpPic mbilog tinyxml DEPENDS_INTERNAL IIL4MITK pic2vtk PACKAGE_DEPENDS ITK VTK ) Index: mitk/Core/Code/files.cmake =================================================================== --- mitk/Core/Code/files.cmake (revision 24358) +++ mitk/Core/Code/files.cmake (working copy) @@ -1,8 +1,9 @@ SET(H_FILES - DataManagement/mitkCommon.h Algorithms/itkLocalVariationImageFilter.h Algorithms/itkTotalVariationDenoisingImageFilter.h Algorithms/itkTotalVariationSingleIterationImageFilter.h + DataManagement/mitkCommon.h + Interactions/mitkEventMapperAddOn.h ) SET(CPP_FILES Index: mitk/Core/Code/Interactions/mitkEventMapper.cpp =================================================================== --- mitk/Core/Code/Interactions/mitkEventMapper.cpp (revision 24358) +++ mitk/Core/Code/Interactions/mitkEventMapper.cpp (working copy) @@ -44,7 +44,10 @@ #include +#include +#include + namespace mitk { vtkStandardNewMacro(EventMapper); @@ -160,7 +163,8 @@ m_EventConstMap["Type_Style"] = 91; // internal style event m_EventConstMap["Type_TabletPress"] = 92; // tablet press m_EventConstMap["Type_TabletRelease"] = 93; // tablet release - m_EventConstMap["Type_TDMouseInput"] = mitk::Type_TDMouseInput; // 3D mouse input occured + // appearently not necessary, since the IDs can be assigned earlier (in the AddOns after they are generated in the driver) + //m_EventConstMap["Type_TDMouseInput"] = mitk::Type_TDMouseInput; // 3D mouse input occured m_EventConstMap["Type_User"] = 1000; // first user event id m_EventConstMap["Type_MaxUser"] = 65535; // last user event id @@ -433,6 +437,7 @@ mitk::EventMapper::~EventMapper() { + } //##Documentation @@ -645,3 +650,34 @@ return stateEvent; } +void mitk::EventMapper::AddEventMapperAddOn(mitk::EventMapperAddOn* newAddOn) +{ + bool addOnAlreadyAdded = false; + + for(AddOnVectorType::const_iterator it = this->m_AddOnVector.begin();it != m_AddOnVector.end();it++) + { + if(*it == newAddOn) + { + addOnAlreadyAdded = true; + break; + } + } + + if(!addOnAlreadyAdded) + { + m_AddOnVector.push_back(newAddOn); + std::cout << "AddOnCount: " << m_AddOnVector.size() << std::endl; + } +} + +void mitk::EventMapper::RemoveEventMapperAddOn(mitk::EventMapperAddOn* unusedAddOn) +{ + for(AddOnVectorType::const_iterator it = this->m_AddOnVector.begin();it != m_AddOnVector.end();it++) + { + if(*it == unusedAddOn) + { + m_AddOnVector.erase(it); + break; + } + } +} Index: mitk/Core/Code/Interactions/mitkEventMapper.h =================================================================== --- mitk/Core/Code/Interactions/mitkEventMapper.h (revision 24358) +++ mitk/Core/Code/Interactions/mitkEventMapper.h (working copy) @@ -19,11 +19,12 @@ #ifndef EVENTMAPPER_H_HEADER_INCLUDED #define EVENTMAPPER_H_HEADER_INCLUDED -#include "mitkEvent.h" -#include "mitkCommon.h" -#include "mitkEventDescription.h" +#include +#include +#include #include +#include namespace mitk { struct ltstr @@ -66,6 +67,8 @@ typedef std::map ConstMap; typedef std::map::iterator ConstMapIter; + typedef std::vector AddOnVectorType; + //##Documentation //## searches the Event in m_EventDescription //## and if included transmits the event to globalInteraction. @@ -110,6 +113,17 @@ //friendship because of SetStateEvent for computing WorldCoordinates friend class mitk::GlobalInteraction; + /** + * @brief adds a new EventMapper addon + */ + void AddEventMapperAddOn(mitk::EventMapperAddOn* newAddOn); + + /** + * @brief removes an EventMapper addon + */ + void RemoveEventMapperAddOn(mitk::EventMapperAddOn* unusedAddOn); + + protected: EventMapper(); ~EventMapper(); @@ -164,6 +178,11 @@ static const std::string EVENTS; static const std::string EVENT; + /** + * @brief all available EventMapper addons consisting of one or more input devices + */ + AddOnVectorType m_AddOnVector; + }; } // namespace mitk Index: mitk/Core/Code/Interactions/mitkGlobalInteraction.cpp =================================================================== --- mitk/Core/Code/Interactions/mitkGlobalInteraction.cpp (revision 24358) +++ mitk/Core/Code/Interactions/mitkGlobalInteraction.cpp (working copy) @@ -285,6 +285,17 @@ return m_FocusManager.GetPointer(); } +mitk::EventMapper* mitk::GlobalInteraction::GetEventMapper() +{ + if (!this->IsInitialized()) + { + MITK_FATAL <<"Global Interaction needs initialization!\n"; + return NULL; + } + return m_EventMapper; +} + + bool mitk::GlobalInteraction::ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) { bool ok = false; Index: mitk/Core/Code/Interactions/mitkGlobalInteraction.h =================================================================== --- mitk/Core/Code/Interactions/mitkGlobalInteraction.h (revision 24358) +++ mitk/Core/Code/Interactions/mitkGlobalInteraction.h (working copy) @@ -137,6 +137,12 @@ //## to add the observer for an event FocusManager* GetFocusManager(); + //##Documentation + //## @brief Returns the pointer to the EventMapper + //## + //## to add an addon + EventMapper* GetEventMapper(); + /** * @brief Return StateMachineFactory **/ Index: mitk/Core/Code/Interactions/mitkInteractionConst.h =================================================================== --- mitk/Core/Code/Interactions/mitkInteractionConst.h (revision 24358) +++ mitk/Core/Code/Interactions/mitkInteractionConst.h (working copy) @@ -80,8 +80,8 @@ EIDSHIFTANDMIDDLEMOUSEPRESS = 2003, EIDSHIFTANDMIDDLEMOUSEMOVE = 2004, EIDSHIFTANDMIDDLEMOUSERELEASE = 2005, - EIDTDMOUSEINPUT = 4001, // 3d Mouse, SpaceNavigator input - EIDTDMOUSEKEYDOWN = 4002, // 3d Mouse, KeyDown + EIDSPACENAVIGATORINPUT = 4001, // 3d Mouse, SpaceNavigator input + EIDSPACENAVIGATORKEYDOWN = 4002, // 3d Mouse, KeyDown EIDSTRGANDN = 10, EIDSTRGANDE = 11, EIDDELETE = 12, @@ -358,8 +358,8 @@ AcDISPLAYOPTIONS = 49009, AcCYCLE = 49010, AcACCEPT = 49011, - AcONTDMOUSEINPUT = 4001, // On input of 3D Mouse - AcONTDMOUSEKEYDOWN = 4002, // On input of 3D Mouse + AcONSPACENAVIGATORMOUSEINPUT = 4001, // On input of 3D Mouse + AcONPACENAVIGATORKEYDOWN = 4002, // On input of 3D Mouse AcCHECKPOSITION = 5000, AcINITIALIZECONTOUR = 5001, AcCALCULATENEWSEGMENTATION_SP= 5002, @@ -450,8 +450,8 @@ Type_TabletPress = 92, // tablet press Type_TabletRelease = 93, // tablet release Type_User = 1000, // first user event id - Type_TDMouseInput = 1094, // 3D mouse input occured - Type_TDMouseKeyDown = 1095, // 3D mouse input occured + Type_SpaceNavigatorInput = 1094, // 3D mouse input occured + Type_SpaceNavigatorKeyDown = 1095, // 3D mouse input occured Type_MaxUser = 65535 };