00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2010-07-22 16:45:18 +0200 (Do, 04 Mai 2006) $ 00006 Version: $Revision: 6790 $ 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 VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 00020 #define VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 00021 00022 #include "mitkCommon.h" 00023 #include "mitkRenderWindow.h" 00024 00025 #include "vtkInteractorObserver.h" 00026 00027 namespace mitk 00028 { 00029 00030 00036 class MITK_CORE_EXPORT vtkEventProvider : public vtkInteractorObserver 00037 { 00038 public: 00039 static vtkEventProvider *New(); 00040 vtkTypeRevisionMacro(vtkEventProvider,vtkInteractorObserver); 00041 00042 // Satisfy the superclass API. Enable/disable listening for events. 00043 virtual void SetEnabled(int); 00044 virtual void SetInteractor(vtkRenderWindowInteractor* iren); 00045 00046 // Interface to MITK 00047 virtual void SetMitkRenderWindow(mitk::RenderWindow* renWin); 00048 mitk::RenderWindow* GetRenderWindow(); 00049 00050 protected: 00051 vtkEventProvider(); 00052 ~vtkEventProvider(); 00053 00054 //methods for processing events - callback for the observer/command pattern of vtkCommand 00055 static void ProcessEvents(vtkObject* object, unsigned long event, 00056 void* clientdata, void* calldata); 00057 00058 mitk::RenderWindow* m_RenderWindow; 00059 00060 // adds the MITK interaction event types to the VTK observer/command pattern 00061 void AddInteractionEvent(unsigned long ievent); 00062 // removes the MITK interaction event types 00063 void RemoveInteractionEvent(unsigned long ievent); 00064 typedef std::vector<unsigned long> InteractionEventsVectorType; 00065 InteractionEventsVectorType m_InteractionEventsVector; 00066 00067 00068 private: 00069 vtkEventProvider(const vtkEventProvider&); // Not implemented. 00070 void operator=(const vtkEventProvider&); // Not implemented. 00071 00072 00073 }; 00074 00075 } 00076 #endif /* VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723 */ 00077 00078