Class SoNodeSensor
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.sensors.SoSensor
-
- com.openinventor.inventor.sensors.SoDelayQueueSensor
-
- com.openinventor.inventor.sensors.SoDataSensor
-
- com.openinventor.inventor.sensors.SoNodeSensor
-
public class SoNodeSensor extends SoDataSensor
Sensor class that can be attached to Open Inventor nodes. Node sensors detect changes to nodes, calling a callback whenever any field of the node or, if the node is a group node, any children of the node change. The Open Inventor viewer classes, for example, attach a node sensor to the root of the application's scene graph in order to know when any part of the scene graph has been modified and a redraw is needed.Node sensors provide methods that can be called in the callback to determine exactly which node or field caused the sensor to be triggered. However these methods only return valid information if the sensor priority was explicitly set to zero (default is 100). Depending on the type of attached node, there are multiple possible triggers and only some of the get trigger info methods will return useful information.
Priority zero sensors are triggered immediately after the change. Normal priority sensors are not triggered until the next time the "delay queue" is processed. Normally this happens when the viewer / renderArea is not rendering and there are no input events to be processed.
The node sensor will be triggered if its schedule() method is called. But the trigger node, trigger field, etc. queries will return null. Generally this method is only useful for "at some future time" sensors like
SoIdleSensor
orSoAlarmSensor
.Node sensors provide a "final" task that is called when the object the data sensor is attached to is finalized. This task should not attempt to modify the object in any way. (see setFinalTask(Runnable)) that is called just before the object the data sensor is attached to is deleted. The callback should not attempt to modify the object in any way.
See
SoDataSensor
for general information and code example.- See Also:
SoFieldSensor
,SoPathSensor
,SoDataSensor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.sensors.SoDataSensor
SoDataSensor.ChangeTypes
-
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 Constructor Description SoNodeSensor()
Default constructor.SoNodeSensor(java.lang.Runnable task)
Builds a new node sensor with the task to be executed when the sensor is triggered.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attach(SoNode node)
Makes this sensor detect changes to the given node.void
detach()
Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph.SoNode
getAttachedNode()
Returns the node that this sensor is sensing, or NULL if it is not attached to any node.-
Methods inherited from class com.openinventor.inventor.sensors.SoDataSensor
getTriggerChild, getTriggerChildIndex, getTriggerFastEditInfo, getTriggerFastEditInfoFlag, getTriggerField, getTriggerMFieldNumValues, getTriggerMFieldStartIndex, getTriggerNode, getTriggerPath, getTriggerPathFlag, getTriggerType, setFinalTask, setTriggerFastEditInfoFlag, setTriggerPathFlag
-
Methods inherited from class com.openinventor.inventor.sensors.SoDelayQueueSensor
getDefaultPriority, getPriority, isIdleOnly, setPriority
-
Methods inherited from class com.openinventor.inventor.sensors.SoSensor
isScheduled, schedule, setTask, unschedule
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
detach
public void detach()
Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph.
-
getAttachedNode
public SoNode getAttachedNode()
Returns the node that this sensor is sensing, or NULL if it is not attached to any node.
-
attach
public void attach(SoNode node)
Makes this sensor detect changes to the given node.
-
-