SoNodeSensor Class Reference
[Sensors]

Sensor class that can be attached to Open Inventor nodes. More...

#include <Inventor/sensors/SoNodeSensor.h>

Inheritance diagram for SoNodeSensor:
SoDataSensor SoDelayQueueSensor SoSensor

List of all members.

Public Member Functions

 SoNodeSensor ()
 SoNodeSensor (SoSensorCB *func, void *data)
virtual ~SoNodeSensor ()
void attach (SoNode *node)
void detach ()
SoNodegetAttachedNode () const

Detailed Description

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 or SoAlarmSensor.

Node sensors provide a delete callback 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

See related examples:

MedicalDentalCurveUnfolding


Constructor & Destructor Documentation

SoNodeSensor::SoNodeSensor (  ) 

Default constructor.

SoNodeSensor::SoNodeSensor ( SoSensorCB func,
void *  data 
)

Constructor that takes the callback function and data to be called when the sensor is triggered.

virtual SoNodeSensor::~SoNodeSensor (  )  [virtual]

Destroys the sensor, freeing up any memory associated with it after unscheduling it.


Member Function Documentation

void SoNodeSensor::attach ( SoNode node  ) 

Makes this sensor detect changes to the given node.

void SoNodeSensor::detach (  ) 

Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph.

SoNode* SoNodeSensor::getAttachedNode (  )  const [inline]

Returns the node that this sensor is sensing, or NULL if it is not attached to any node.


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 4 Sep 2023
Copyright © Thermo Fisher Scientific All rights reserved.
https://www.openinventor.com/