SoDataSensor Class Reference
[Sensors]

Abstract base class for sensors attached to parts of a scene. More...

#include <Inventor/sensors/SoDataSensor.h>

Inheritance diagram for SoDataSensor:
SoDelayQueueSensor SoSensor SoFieldSensor SoNodeSensor SoPathSensor

List of all members.

Classes

class  SoDataSensorData

Public Types

enum  ChangeType {
  UNSPECIFIED,
  GROUP_ADD_CHILD,
  GROUP_INSERT_CHILD,
  GROUP_REPLACE_CHILD,
  GROUP_REMOVE_CHILD,
  GROUP_REMOVE_ALL_CHILDREN,
  FIELD_MULTIVALUE
}

Public Member Functions

 SoDataSensor ()
 SoDataSensor (SoSensorCB *func, void *data)
void setDeleteCallback (SoSensorCB *f, void *data=NULL)
SoNodegetTriggerNode () const
SoFieldgetTriggerField () const
SoPathgetTriggerPath () const
void setTriggerPathFlag (SbBool flag)
void setTriggerFastEditInfoFlag (SbBool flag)
SbBool getTriggerPathFlag () const
SbBool getTriggerFastEditInfoFlag () const
ChangeType getTriggerType () const
SoNodegetTriggerChild () const
int getTriggerChildIndex () const
int getTriggerMFieldStartIndex () const
int getTriggerMFieldNumValues () const
int getTriggerFastEditInfo () const
virtual void unschedule ()

Detailed Description

Abstract base class for sensors attached to parts of a scene.

Data sensors detect changes to scene graph objects (paths, nodes, or fields) and trigger their callback when the object changes. The Open Inventor viewer classes, for example, attach an SoNodeSensor 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.

Data 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 object, there are multiple possible triggers and only some of the get trigger info methods will return useful information.

Priority zero data 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.

A data 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.

Data sensors provide a delete callback that is called just before the object the data sensor is attached to is destroyed. The callback should not attempt to modify the object in any way.

EXAMPLE

SEE ALSO

SoNodeSensor, SoPathSensor, SoFieldSensor, SoDelayQueueSensor


Member Enumeration Documentation

Change type.

Enumerator:
UNSPECIFIED 

Unspecified.

GROUP_ADD_CHILD 

Group add child.

GROUP_INSERT_CHILD 

Group insert child.

GROUP_REPLACE_CHILD 

Group replace child.

GROUP_REMOVE_CHILD 

Group remove child.

GROUP_REMOVE_ALL_CHILDREN 

Group remove all children.

FIELD_MULTIVALUE 

Field multivalue.


Constructor & Destructor Documentation

SoDataSensor::SoDataSensor (  ) 

Constructor.

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

Constructor that takes standard callback function and data.


Member Function Documentation

SoNode* SoDataSensor::getTriggerChild (  )  const

If this is a priority 0 data sensor, and a change to a group node's children caused this sensor to be triggered (getTriggerType returns GROUP_ADD_CHILD, GROUP_INSERT_CHILD, or GROUP_REPLACE_CHILD), returns the node that was added to the group, and NULL in all other cases.

int SoDataSensor::getTriggerChildIndex (  )  const

If this is a priority 0 data sensor, and a change to a group node's children caused this sensor to be triggered (getTriggerType returns GROUP_ADD_CHILD, GROUP_INSERT_CHILD, or GROUP_REPLACE_CHILD), returns the index of the node that was added or removed, and -1 in all other cases.

int SoDataSensor::getTriggerFastEditInfo (  )  const

Returns true if the triggered changes come from a field or node that was below a Separator with a fastEditPolicy field with a value different than OFF. Since Open Inventor 9.2.3

SbBool SoDataSensor::getTriggerFastEditInfoFlag (  )  const [inline]

Queries the flag that indicates whether the trigger path fastEdit info (see getTriggerFastEditInfo()) is available to callbacks . Since Open Inventor 9.2.3

SoField* SoDataSensor::getTriggerField (  )  const

If this is a priority 0 data sensor, returns the field that was modified that caused this sensor to trigger.

Returns NULL if the sensor was not triggered because a field changed (for example, if schedule() is called on the sensor) or if this sensor is not a priority 0 sensor. Note that because one change to the scene graph may cause multiple nodes or fields to be modified (because of field-to-field connections), the field returned may not be the only one that changed.

int SoDataSensor::getTriggerMFieldNumValues (  )  const

If this is a priority 0 data sensor, and a change in the data values of a multiple field (e.g., SoMFVec3f) caused this sensor to be triggered, returns the size of the range of the potentially changed values.

Otherwise, returns -1

int SoDataSensor::getTriggerMFieldStartIndex (  )  const

If this is a priority 0 data sensor, and a change in the data values of a multiple field (e.g., SoMFVec3f) caused this sensor to be triggered, returns the first index of the range of the potentially changed values.

Otherwise, returns -1

SoNode* SoDataSensor::getTriggerNode (  )  const

If this is a priority 0 data sensor, returns the node that was modified that caused this sensor to trigger.

Returns NULL if the sensor was not triggered because a node changed (for example, if schedule() is called on the sensor) or if this sensor is not a priority 0 sensor. Note that because one change to the scene graph may cause multiple nodes or fields to be modified (because of field-to-field connections), the node returned may not be the only one that changed.

SoPath* SoDataSensor::getTriggerPath (  )  const

If this is a priority 0 data sensor, returns a path to the node that caused this sensor to trigger.

Because recreating the path to the node that changed is relatively expensive, setTriggerPathFlag(TRUE) must be called before the sensor is scheduled. If it is not called, or if the sensor wasn't triggered because a node changed, this returns NULL. NULL is also returned if this is not a priority 0 sensor.

SbBool SoDataSensor::getTriggerPathFlag (  )  const [inline]

Queries the flag that indicates whether the trigger path (see getTriggerPath()) is available to callbacks .

ChangeType SoDataSensor::getTriggerType (  )  const

If this is a priority 0 data sensor, returns the type of change that occurred.

Returns UNSPECIFIED if the sensor was not triggered by a group children change or a multi-value field change or if this sensor is not a priority 0 sensor. A GROUP_* return value indicates that getTriggerChild and getTriggerChildIndex will return valid data. A FIELD_* return value indicates that the getTriggerMField* methods will return valid data.

void SoDataSensor::setDeleteCallback ( SoSensorCB f,
void *  data = NULL 
) [inline]

Sets a callback that will be called when the object the sensor is sensing is deleted.

void SoDataSensor::setTriggerFastEditInfoFlag ( SbBool  flag  )  [inline]

Sets the flag that indicates whether the trigger path fastEdit info (see getTriggerFastEditInfo()) is available to callback methods.

This is FALSE by default. Note that setting this to TRUE will add a little overhead when the sensor is notified. Since Open Inventor 9.2.3

void SoDataSensor::setTriggerPathFlag ( SbBool  flag  )  [inline]

Sets the flag that indicates whether the trigger path (see getTriggerPath()) is available to callback methods.

This is FALSE by default. Note that setting this to TRUE will add a little overhead when the sensor is notified.

virtual void SoDataSensor::unschedule (  )  [virtual]

If this sensor is scheduled, removes it from the delay queue so that it will not be triggered.

Reimplemented from SoDelayQueueSensor.


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

Open Inventor Toolkit reference manual, generated on 18 Apr 2021
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/