Hi Sajith,
mitkConferenceEventMapper was designed (in 2006) to implement a 
teleconferencing system using MITK as a plugin within a PACS solution (CHILI).
We had a diploma thesis and a conference publication on this, but unfortunately 
it is written in German.
[Hasselberg M,  Wolf I, Nolden M, Seitel M, Meinzer HP, Engelmann U. MITK als 
telekonferenzfähiges PlugIn in der CHILI-Workstation. In Horsch A, Deserno TM, 
Handels H, Meinzer HP, Tolxdorf T (eds). Bildverarbeitung für die Medizin 2007. 
Heidelberg: Springer (2007) 197-201.]
The mitkConferenceEventMapper acts as a wrapper and catches events before 
mitkEventMapper gets them. But for teleconferencing you would need more, like 
tokens and so on, which is not contained within MITK. As far as I see in the 
code, the class is not enabled anymore but as far as I understand what you want 
to do, your changes below should do the trick. I had to do some changes for the 
VS9 compiler to build (dynamic_cast).

#include "mitkPositionEvent.h"
...
/**test**/
  mitk::BaseRenderer * c_Sender = event->GetSender();
      int c_Type = event->GetType();
      int c_Button = event->GetButton();
      int c_ButtonState = event->GetButtonState();
      int c_Key = event->GetKey();

  mitk::Point2D pos2D;
  mitk::Point3D pos3D;
  const mitk::PositionEvent* posEv = dynamic_cast<const 
mitk::PositionEvent*>(event);
  if (posEv)
  {
    pos2D = posEv->GetDisplayPosition();
    pos3D = posEv->GetWorldPosition();
  }

  std::ofstream eventfile;
  
eventfile.open("C:\\home\\Ingmar\\mitk\\QT4\\bin\\mitk\\bin\\Debug\\eventua.txt");
  eventfile.fill
  eventfile<<
    //c_Sender<<" "<< //address, doesn't make sense to store!
    c_Type<<" "<<
    c_Button<<" "<<
    c_ButtonState<<" "<<
    c_Key<<" "<<
    pos2D<<" "<<
    pos3D<<" "<<
    eventID<<std::endl;

    eventfile.close(); //that way you will overwrite the added line the next 
iteration
/**test**/

You could though use the new logging mechanism using the  MITK logging 
mechanism (see mitk\Core\Code\IO\mitkLog.h).
Best Regards,
Ingmar

Von: Sajith Rabel [mailto:[email protected]]
Gesendet: Samstag, 22. Mai 2010 07:47
An: [email protected]
Betreff: [mitk-users] Need Help on mitkEventMapper.cpp

Hello,

I'm pretty new to MITK and and for a project i'm involved i need to capture the 
mouse events and key events perfomed in gui. For this purpose i modified the 
mapEvent function of mitkEventMapper.cpp as following.

bool mitk::EventMapper::MapEvent(Event* event, int mitkPostedEventID )
{
  int eventID = mitkPostedEventID;

  if( mitkPostedEventID == 0 )
  {
    //search the event in the list of event descriptions, if found, then take 
the number and produce a stateevent
    EventDescriptionVecIter iter;
    for (iter = m_EventDescriptions.begin(); 
iter!=m_EventDescriptions.end();iter++)
    {
      if (*iter == *event)
        break;
    }

    if (iter == m_EventDescriptions.end())//not found
      return false;
    eventID = (*iter).GetId();
  }

//***************************************** the edited code 
************************************

              mitk::BaseRenderer * c_Sender = event->GetSender();
  int c_Type = event->GetType();
  int c_Button = event->GetButton();
  int c_ButtonState = event->GetButtonState();
  int c_Key = event->GetKey();

  mitk::Point2D c_DisplayPosition = dynamic_cast<const 
mitk::PositionEvent*>(event) ->GetDisplayPosition() ;
  mitk::Point3D c_WorldPosition = dynamic_cast<const 
mitk::PositionEvent*>(event) ->GetWorldPosition() ;



    std::ofstream eventfile;
    eventfile.open("eventua.txt");
    eventfile << eventID;
    eventfile.close();
//*****************************************************************************


  //set the Menger_Var m_StateEvent and send to StateMachine, which does 
everything further!
  m_StateEvent.Set( eventID, event );
  /*
  Group and Object EventId:
  then EventMapper has the power to decide which operations hang together;
  each event causes n (n e N) operations (e.g. StateChanges, 
data-operations...).
  Undo must recall all these coherent operations, so all of the same objectId.
  But Undo has also the power to recall more operationsets, for example a set 
for building up a new object,
  so that a newly build up object is deleted after a Undo and not only the 
latest set point.
  The StateMachines::ExecuteAction have the power to descide weather a new 
GroupID has to be calculated
  (by example after the editing of a new object)

  A user interaction with the mouse is started by a mousePressEvent, continues 
with a MouseMove and finishes with a MouseReleaseEvent
  */
  switch (event->GetType())
  {
  case mitk::Type_MouseButtonPress://Increase
    mitk::OperationEvent::IncCurrObjectEventId();
    break;
  case mitk::Type_MouseMove://same
    break;
  case mitk::Type_MouseButtonRelease://same
    break;
  case mitk::Type_User://same
    break;
  case mitk::Type_KeyPress://Increase
    mitk::OperationEvent::IncCurrObjectEventId();
    break;
  default://increase
    mitk::OperationEvent::IncCurrObjectEventId();
  }

#ifdef MBI_INTERNAL_CONFERENCE
  //Conference - pass local events through
  if ( mitkPostedEventID == 0 )
  {
    mitk::CoreObjectFactory::GetInstance()->MapEvent(event,eventID);
  }
#endif //MBI_INTERNAL_CONFERENCE

  mitk::OperationEvent::ExecuteIncrement();

  return mitk::GlobalInteraction::GetInstance()->HandleEvent(&m_StateEvent);
}


when i add the lines the project builds without errors.
mitk::Point2D c_DisplayPosition = dynamic_cast<const 
mitk::PositionEvent*>(event) ->GetDisplayPosition() ;
mitk::Point3D c_WorldPosition = dynamic_cast<const mitk::PositionEvent*>(event) 
->GetWorldPosition() ;

i get a runtime error when running step5. (step5.exe crashes.)

what i need to do in my project is capture mouse events from one machine and 
make them happen in a remote computer. (using a log of captured events)
I'm hoping to use mitkconferenceeventmapper.cpp to achieve this.

I would be very grateful if anyone could tell me wats wrong with the above 
lines.

Any alternatives to get my task done would be very helpful.

Thanks in advance.

Best Regards,

--
Sajith Rabel

------------------------------------------------------------------------------

_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to