MCPcopy Create free account
hub / github.com/MITK/MITK / EventToXML

Method EventToXML

Modules/Core/src/Interactions/mitkEventFactory.cpp:469–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469std::string mitk::EventFactory::EventToXML(mitk::InteractionEvent *event)
470{
471 auto *ie = dynamic_cast<InternalEvent *>(event);
472 if (ie != nullptr)
473 return "";
474
475 std::string eventClass = event->GetNameOfClass();
476 std::string eventXML =
477 "<" + InteractionEventConst::xmlTagEventVariant() + " " + InteractionEventConst::xmlParameterEventClass() + "=\"";
478
479 std::transform(eventClass.cbegin(), eventClass.cend(), eventClass.begin(), ::toupper);
480
481 eventXML += eventClass + "\" >\n";
482 // here follow event specific attributes
483 if (eventClass == "MOUSEPRESSEVENT" || eventClass == "MOUSERELEASEEVENT" || eventClass == "MOUSEDOUBLECLICKEVENT" ||
484 eventClass == "MOUSEMOVEEVENT" || eventClass == "MOUSEWHEELEVENT")
485 {
486 if (!(eventClass == "MOUSEMOVEEVENT") && !(eventClass == "MOUSEWHEELEVENT"))
487 {
488 // EventButton
489 eventXML += " <" + InteractionEventConst::xmlTagAttribute() + " " + InteractionEventConst::xmlParameterName() +
490 "=\"" + InteractionEventConst::xmlEventPropertyEventButton() + "\" ";
491 eventXML += InteractionEventConst::xmlParameterValue() + "=\"";
492 eventXML += GetEventButton(event);
493 eventXML += "\"/>\n";
494 }
495 // ButtonState
496 if (GetButtonState(event) != "")
497 {
498 eventXML += " <" + InteractionEventConst::xmlTagAttribute() + " " + InteractionEventConst::xmlParameterName() +
499 "=\"" + InteractionEventConst::xmlEventPropertyButtonState() + "\" ";
500 eventXML += InteractionEventConst::xmlParameterValue() + "=\"";
501 eventXML += GetButtonState(event);
502 eventXML += "\"/>\n";
503 }
504
505 // Modifiers
506 if (GetModifierState(event) != "")
507 {
508 eventXML += " <" + InteractionEventConst::xmlTagAttribute() + " " + InteractionEventConst::xmlParameterName() +
509 "=\"" + InteractionEventConst::xmlEventPropertyModifier() + "\" ";
510 eventXML += InteractionEventConst::xmlParameterValue() + "=\"";
511 eventXML += GetModifierState(event);
512 eventXML += "\"/>\n";
513 }
514
515 // Position on Screen
516 eventXML += " <" + InteractionEventConst::xmlTagAttribute() + " " + InteractionEventConst::xmlParameterName() +
517 "=\"" + InteractionEventConst::xmlEventPropertyPositionOnScreen() + "\" ";
518 eventXML += InteractionEventConst::xmlParameterValue() + "=\"";
519 eventXML += GetPositionOnScreen(event);
520 eventXML += "\"/>\n";
521
522 // Position in World
523 eventXML += " <" + InteractionEventConst::xmlTagAttribute() + " " + InteractionEventConst::xmlParameterName() +
524 "=\"" + InteractionEventConst::xmlEventPropertyPositionInWorld() + "\" ";
525 eventXML += InteractionEventConst::xmlParameterValue() + "=\"";
526 eventXML += GetPositionInWorld(event);

Callers

nothing calls this directly

Calls 11

GetEventButtonFunction · 0.85
GetButtonStateFunction · 0.85
GetModifierStateFunction · 0.85
GetPositionOnScreenFunction · 0.85
GetPositionInWorldFunction · 0.85
GetWheelDeltaMethod · 0.80
GetSenderMethod · 0.80
GetNameOfClassMethod · 0.45
beginMethod · 0.45
GetKeyMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected