diff --git a/Core/Code/Interactions/mitkXML2EventParser.h b/Core/Code/Interactions/mitkXML2EventParser.h index fb241be1ac..9ef98d375f 100755 --- a/Core/Code/Interactions/mitkXML2EventParser.h +++ b/Core/Code/Interactions/mitkXML2EventParser.h @@ -1,102 +1,104 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkXML2EventParser_h #define mitkXML2EventParser_h #include #include "mitkPropertyList.h" #include +#include "mitkInteractionEvent.h" + namespace us { class Module; } namespace mitk { -class InteractionEvent; - /** * \class InteractionEventList * \brief Generates a list of InteractionEvents based on an XML file- * * @ingroup Interaction **/ class XML2EventParser : public vtkXMLParser { public: /** * @brief Construct an InteractionEventList object based on a XML configuration file. * * Uses the specified resource file containing an XML event configuration to * construct an EventConfig object. If the resource is invalid, the created * EventConfig object will also be invalid. * * @param filename The resource name relative to the Interactions resource folder. * @param module */ XML2EventParser(const std::string& filename, const us::Module* module = NULL); /** * @brief Construct an InteractionEventList object based on a XML configuration file. * * Uses the specified istream refering to a file containing an XML event configuration to * construct an EventConfig object. If the resource is invalid, the created * EventConfig object will also be invalid. * * @param inputStream std::ifstream to XML configuration file */ XML2EventParser(std::istream &inputStream); - std::vector GetInteractions() + typedef std::vector EventContainerType; + + EventContainerType GetInteractions() { return m_InteractionList; } ~XML2EventParser(){}; protected: /** * @brief Derived from XMLReader **/ void StartElement(const char* elementName, const char **atts); /** * @brief Derived from XMLReader **/ void EndElement(const char* elementName); std::string ReadXMLStringAttribute(const std::string& name, const char** atts); bool ReadXMLBooleanAttribute(const std::string& name, const char** atts); private: PropertyList::Pointer m_EventPropertyList; - std::vector m_InteractionList; + EventContainerType m_InteractionList; }; } // namespace mitk #endif /* mitkStateMachineConfig_h */ diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp b/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp index 4d5db1bc52..a34e1f3d2c 100644 --- a/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp +++ b/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp @@ -1,90 +1,90 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // Blueberry #include #include // Qmitk #include "InteractionEventRecorder.h" // Qt #include // us #include "usGetModuleContext.h" #include "usModuleContext.h" #include #include #include #include "QmitkRenderWindow.h" US_INITIALIZE_MODULE("InteractionEventRecorder","liborg_mitk_gui_qt_eventrecorder") const std::string InteractionEventRecorder::VIEW_ID = "org.mitk.views.interactioneventrecorder"; void InteractionEventRecorder::SetFocus() { m_Controls.textFileName->setFocus(); } void InteractionEventRecorder::StartRecording() { MITK_INFO << "Start Recording"; m_CurrentObserver->SetOutputFile(m_Controls.textFileName->text().toStdString()); m_CurrentObserver->StartRecording(); } void InteractionEventRecorder::Play() { std::ifstream xmlStream(m_Controls.textFileName->text().toStdString().c_str()); mitk::XML2EventParser parser(xmlStream); - std::vector events = parser.GetInteractions(); + mitk::XML2EventParser::EventContainerType events = parser.GetInteractions(); MITK_INFO << "parsed events"; for (int i=0; i < events.size(); ++i) this->GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetRenderer()->GetDispatcher()->ProcessEvent(events.at(i)); MITK_INFO << "DONE"; } void InteractionEventRecorder::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi( parent ); connect( m_Controls.btnStartRecording, SIGNAL(clicked()), this, SLOT(StartRecording()) ); connect( m_Controls.btnPlay, SIGNAL(clicked()), this, SLOT(Play()) ); m_CurrentObserver = new mitk::EventRecorder(); // Register as listener via micro services us::ServiceProperties props; props["name"] = std::string("EventRecorder"); m_ServiceRegistration = us::GetModuleContext()->RegisterService(m_CurrentObserver,props); /* delete m_CurrentObserverDEBUG; m_ServiceRegistrationDEBUG.Unregister(); */ }