Class SoEvent
- Direct Known Subclasses:
SoButtonEvent
,SoGestureEvent
,SoLocation2Event
,SoMotion3Event
,SoMouseWheelEvent
,SoTouchEvent
,SoTrackerEvent
SoEvent
is the base class for events in the Open Inventor event model. An event typically represents a user action, such as a mouse button being pressed or a keyboard key being released. SoEvent
contains general information found in all Open Inventor events, including the time the event occurred, the position of the locater when the event occurred, and the state of the modifier keys when the event occurred.
The virtual method SoEvent.getTrackerInfo() can be used to determine if an event object has associated 3D tracker information. Traditional 2D events like SoMouseButtonEvent
and SoLocation2Event
return NULL. 3D events like SoTrackerEvent
and SoControllerButtonEvent
return their associated tracker information (SbTrackerInfo
).
Add an SoEventCallback
node to the scene graph to handle Open Inventor events.
Events are delivered to the scene graph using an SoHandleEventAction
.
The Open Inventor viewer classes automatically convert system events to Open Inventor event objects and send those event objects to the scene graph using an instance of SoSceneManager
. SoSceneManager
automatically creates and applies an SoHandleEventAction
.
Similarly, the RemoteViz RenderArea class converts events coming from the RemoteViz client to Open Inventor event objects and sends those events to the scene graph using an instance of SoSceneManager
.
Applications may create synthetic events and send them to the scene graph. Get the SoSceneManager
object from the render area and call processEvent().
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the normalized location of the cursor when the event occurred, relative to the specified viewport region.Returns the window pixel location of the cursor when the event occurred as integer values.getPosition
(SbViewportRegion vpRgn) Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values.Returns the window pixel location of the cursor when the event occurred as float values.getPositionFloat
(SbViewportRegion vpRgn) Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values.getTime()
Gets the time at which the event occurred.void
setAltDown
(boolean isDown) Sets whether the ALT key was down when the event occurred.void
setButton1Down
(boolean isDown) Sets whether mouse Button 1 was down when the event occurred.void
setCtrlDown
(boolean isDown) Sets whether the CTRL key was down when the event occurred.void
Float version ofsetPosition(const SbVec2s &p)
.void
Sets the window pixel location of the cursor when the event occurred.void
setShiftDown
(boolean isDown) Sets whether the shift key was down when the event occurred.void
Sets the time at which the event occurred.boolean
Returns true if the ALT key was down when the event occurred.boolean
Returns true if mouse button 1 was down when the event occurred.boolean
Returns true if the CTRL key was down when the event occurred.boolean
Returns true if the shift key was down when the event occurred.Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoEvent
public SoEvent()Constructor.
-
-
Method Details
-
setShiftDown
public void setShiftDown(boolean isDown) Sets whether the shift key was down when the event occurred. -
wasAltDown
public boolean wasAltDown()Returns true if the ALT key was down when the event occurred. -
wasButton1Down
public boolean wasButton1Down()Returns true if mouse button 1 was down when the event occurred. -
getPosition
Returns the window pixel location of the cursor when the event occurred as integer values. The position is relative to the lower left corner of the window in which the event occurred.Position should be set for all events, but that may not be possible for some events in some display environments. If position was not available, the method returns 0,0.
-
setPosition
Float version ofsetPosition(const SbVec2s &p)
. It can be used when a desktop is magnified on a wall of screens using ScaleViz with a tracker device calibrated for this wall. -
setCtrlDown
public void setCtrlDown(boolean isDown) Sets whether the CTRL key was down when the event occurred. -
getPositionFloat
Returns the window pixel location of the cursor when the event occurred as float values. The position is relative to the lower left corner of the window in which the event occurred.Position should be set for all events, but that may not be possible for some events in some display environments. If position was not available, the method returns 0,0.
-
getPositionFloat
Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values. Position should be set for all events, but that may not be possible for some events in some display environments. If position was not available, the method returns the viewport origin. -
getPosition
Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values. Position should be set for all events, but that may not be possible for some events in some display environments. If position was not available, the method returns the viewport origin. -
getNormalizedPosition
Gets the normalized location of the cursor when the event occurred, relative to the specified viewport region. The returned value will lie between 0.0 and 1.0.Position should be set for all events, but that may not be possible for some events in some display environments. If position was not available, the method returns 0,0.
-
setTime
Sets the time at which the event occurred. -
wasShiftDown
public boolean wasShiftDown()Returns true if the shift key was down when the event occurred. -
wasCtrlDown
public boolean wasCtrlDown()Returns true if the CTRL key was down when the event occurred. -
setButton1Down
public void setButton1Down(boolean isDown) Sets whether mouse Button 1 was down when the event occurred. -
setPosition
Sets the window pixel location of the cursor when the event occurred. The position is relative to the lower left corner of the window in which the event occurred. -
setAltDown
public void setAltDown(boolean isDown) Sets whether the ALT key was down when the event occurred. -
getTime
Gets the time at which the event occurred.
-