ot::QtMouseEventSinkBase Class ReferenceBase class of MEMs sink nodes.
Inheritance diagram for ot::QtMouseEventSinkBase:
Detailed DescriptionBase class of MEMs sink nodes.
OTQt sinks are implemented as event generator nodes. Each sink node receives tracking events from its child nodes and passes the event to its parent nodes in the same cycle.
OTQt sinks basically store copies of incoming events (see onEventGenerated() method) and provide methods to retrieve them (see getCurrentEvent(), getPreviousEvent()). Different sinks provide useful methods which indicate changes in tracking event data. Most of the work is done in the module (MEM) itself: the application screen 3D location management, the mouse cursor placement and the generation of button and wheel events. There main reason for that design decision is simple: only in the module all information is available to decide wheater certain Qt mouse events should be generated or not.
The OTQt sinks store incoming events only if the pending event differs from the last event which was processed in the MEM. Each sink employs a two element event queue internally where current and previous events are stored. If the pending event differs from the current event, the event is copied and stored as new current event while the old current event becomes the previous event. The original event is passed unchanged to parent nodes of the sink. The intention of this early event filtering is the reduction of computational load. Only relevant events are processed afterwards in the module. Each sink indicates the arrival of a new event by setting the pending event flag, which can be retrieved with isEventPending() and reset with resetPendingEventBit() methods. Each sink's event acquisition can be suspended by enabling the
EVENT_LOCK state flag. Provides the enableState() method to switch states.
This class provides additional mechanisms such as position (see method isInsidePosThreshSphere()) and orientation (see method isInsideOrientThreshCone()) threshold filter. Derived sinks apply these methods in the acquisition of incoming tracking events where convenient. Desired position and orientation threshold values can be assigned over the sink's XML attributes. Assigning non-default values, the state flags
ORIENT_THRESH_FILTER are enabled automatically (see QtMouseEventSinkBase(StringTable &).
In order to finally ignore a tracking event, the event must be catched by ALL applied filters. Otherwise,
The corresponding XML attributes are:
PosThreshRadiusInMeterradius of threshold sphere, applied in position filter (optional; default value: "0.0" -> position filter disabled)
OrientThreshAngleradian angle used equally for all XYZ axes to describe an euler rotation, applied in orientation filter (optional; default value: "0.0" -> orientation filter disabled)
consume-eventsEither "true" (enabled) or "false" (disabled, default). If enabled, tracking events are not forwarded to their parent nodes within the OT node graph iff they are consumed within the OTQt MEM, that is, if a specific tracking event was used to generate Qt mouse events.
Configuration example (schema):
<NetworkSink target="3D-UI"> <QtMouseButtonSink consume-events="true"> <NetworkSource source="Tracking" /> </QtMouseButtonSink> </NetworkSink>
Tracking events are generated by some source (here "Tracking") and enter the node graph in the
NetworkSink node. The
QtMouseButtonSink is is connected to some 2D UI and configured to consume events. Forwarded tracking events leave the graph through a
NetworkSink which sends them to another host where the 3D UI application is assumed.
Only those tracking event pass the entire hierarchy, which are not consumed by the OTQt MEM, thus they where used to generate some mouse (button) event on the 2D application. Otherwise the tracking event was not destined for the 2D UI and is forwarded to the 3D UI.
Member Typedef Documentation
|typedef unsigned short ot::QtMouseEventSinkBase::state_t
Member Enumeration Documentation
Constructor & Destructor Documentation
Disables all state flags by default.
Sets current and previous event to State::null. Stores specified XML attribute map. Computes position and orientation threshold values from XML attributes, enabling the corresponding
ORIENT_THRESH_FILTER flags if appropriate.
xml_attrib_table XML attribute key/value map
References CONSUME_EVENTS, enableState(), ot::MathUtils::eulerToQuaternion(), ot::StringTable::get(), ORIENT_THRESH_FILTER, ORIENT_THRESH_QUAT, OTQT_DEBUG(), POS_THRESH_FILTER, POS_THRESH_RADIUS, state_, and ot::MathUtils::XYZ.
|ot::QtMouseEventSinkBase::QtMouseEventSinkBase||(||QtMouseEventSinkBase const &||ref||)||
Member Function Documentation
|void ot::QtMouseEventSinkBase::acquireEvent||(||Event const &||event||)||
Acquires the given tracking event as new current event.
Resets the old current event as new previous event. Discards the the old previous element. Enables the
EVENT_PENDING_SIGNAL state flag.
event pending tracking event
Referenced by ot::QtMouseWheelSink::onEventGenerated(), ot::QtMousePosSink::onEventGenerated(), ot::QtMouseButtonSink::onEventGenerated(), ot::QtAppScreenPosSink::onEventGenerated(), and ot::QtMouseEventModule::pullEvent().
|bool|| enable = |
Enables or disables the given state flag depending on the binary argument.
Enables flag if true (default), otherwise disables flag. Returns the state flag value after the update was performed.
flag state flag enable set true if state flag should be enabled (default), otherwise disables
- enable/disable (true/false) value of the state flag after update
|void ot::QtMouseEventSinkBase::forwardEvent||(||Event &||event||)|
Forwards the given tracking event to its parents if either
EVENT_CONSUME_SIGNAL are disabled.
If both are true the event is said to be locally consumed and thus NOT forwarded.
event tracking event to forward
|Event const& ot::QtMouseEventSinkBase::getCurrentEvent||(||)|| const
Returns the latest acquired tracking event (tracking node current event).
- current tracking event of node
Referenced by ot::QtMouseEventModule::pullEvent(), ot::OTQtMEMCalibProc::trackASCorner(), ot::OTQtMEMCalibProc::trackASPos(), ot::OTQtMEMCalibProc::trackMBDButtonOne(), and ot::OTQtMEMCalibProc::trackMPD().
|Event const& ot::QtMouseEventSinkBase::getPreviousEvent||(||)|| const
|virtual int ot::QtMouseEventSinkBase::isEventGenerator||(||)||
|bool ot::QtMouseEventSinkBase::isEventPending||(||)|| const
Returns true if a new tracking event was acquired (available as current event) indicated by the
EVENT_PENDING_SIGNAL state flag.
- true if new current event available
|bool ot::QtMouseEventSinkBase::isInsideOrientThreshCone||(||Event const &||event||)|| const
Performs a trivial orientation comparison test.
Computes the difference quaternion angle between the given tracking event and the current event. Verifies the resulting quaternion against some pre-defined threshold value (see ORIENT_THRESH_RADIUS) by comparing the quaternion vector elements. Returns true if each difference quaternion vector element absolute value is less or equal the corresponding absolute value of the threshold quaternion vector.
event tracking event
- true if orientation distance less or equal than threshold value
Referenced by ot::QtAppScreenPosSink::onEventGenerated().
|bool ot::QtMouseEventSinkBase::isInsidePosThreshSphere||(||Event const &||event||)|| const
Returns true if 3D position difference of given tracking event and current event does not exceed pre-defined threshold distance (see POS_THRESH_RADIUS).
event tracking event
- true if positional distance less or equal than threshold value
|virtual void ot::QtMouseEventSinkBase::onEventGenerated||(||Event &||event,|
OpenTracker tracking event push pattern callback method.
Basically stores a copy of the incoming event as new current event in the internal event queue and forwards the original event to parent nodes.
Applies a series of elimination checks on the incoming event. Ignores the event if any of these checks fail. Otherwise acquires the event, thus the incoming event becomes the new current event and the old current event becomes the new previous event. Enables the
EVENT_PENDING_SIGNAL flag to indicate an acquisition.
Applied checks in detail: Ignores the incoming tracking event if ..
EVENT_LOCKflag is enabled (currently only implemented in MBS!).
- it equals the current event (only modified events pass). Different relevant tracking data portions (position, orientation, button state) are compared, depending on the actual sink.
- position threshold check fails (optional, depending on actual sink,
- orientation threshold check fails (optional, depending on actual sink,
EVENT_CONSUME_SIGNALare disabled. If both are true the event is said to be locally consumed and thus NOT forwarded.
event tracking event generator event generating child node
Reimplemented from ot::Node.
|QtMouseEventSinkBase& ot::QtMouseEventSinkBase::operator=||(||QtMouseEventSinkBase const &||ref||)||
Friends And Related Function Documentation
|friend class QtMouseEventModule
Member Data Documentation
current tracking event of node
Referenced by acquireEvent(), ot::QtMouseButtonSink::buttonOn(), ot::QtMouseButtonSink::buttonPressed(), ot::QtMouseButtonSink::buttonReleased(), isInsideOrientThreshCone(), isInsidePosThreshSphere(), ot::QtMouseWheelSink::onEventGenerated(), ot::QtMousePosSink::onEventGenerated(), ot::QtMouseButtonSink::onEventGenerated(), ot::QtAppScreenPosSink::onEventGenerated(), ot::QtMouseWheelSink::wheelBackwardMove(), and ot::QtMouseWheelSink::wheelForwardMove().
predecessor of current (previous) tracking event of node
The documentation for this class was generated from the following files: