Home | Download | Screen shots | Discussion | Documentation
--- | --- | --- | --- | ---

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

# openvrml::node Class Reference
[Nodes]

Inheritance diagram for openvrml::node:

[legend]
List of all members.

## Detailed Description

A node in the scene graph.

## Public Member Functions
virtual | ~node ()=0 throw ()
| Destructor.
const node_type & | type () const throw ()
| The type information object for the node.
const std::string & | id () const throw ()
| Retrieve the name of this node.
void | id (const std::string &node_id) throw (std::bad_alloc)
| Set the name of the node.
const boost::shared_ptr< openvrml::scope > & | scope () const throw ()
| Get the scope to which the node belongs.
openvrml::scene * | scene () const throw ()
| Get the scene with which the node is associated.
std::ostream & | print (std::ostream &out, size_t indent) const
| Pretty print.
void | initialize (openvrml::scene &scene, double timestamp) throw (std::bad_alloc)
| Initialize the node.
const field_value & | field (const std::string &id) const throw (unsupported_interface)
| Generalized field accessor.
openvrml::event_listener & | event_listener (const std::string &id) throw (unsupported_interface)
| Get an event listener.
openvrml::event_emitter & | event_emitter (const std::string &id) throw (unsupported_interface)
| Get an event emitter.
void | shutdown (double timestamp) throw ()
| Shut down the node.
virtual vrml97_node::anchor_node * | to_anchor () const
| Cast to an anchor_node.
virtual vrml97_node::audio_clip_node * | to_audio_clip () const
| Cast to an audio_clip_node.
virtual vrml97_node::cylinder_sensor_node * | to_cylinder_sensor () const
| Cast to a cylinder_sensor_node.
virtual vrml97_node::abstract_light_node * | to_light () const
| Cast to an abstract_light_node.
virtual vrml97_node::movie_texture_node * | to_movie_texture () const
| Cast to a movie_texture_node.
virtual vrml97_node::navigation_info_node * | to_navigation_info () const
| Cast to a navigation_info_node.
virtual vrml97_node::plane_sensor_node * | to_plane_sensor () const
| Cast to a plane_sensor_node.
virtual vrml97_node::point_light_node * | to_point_light () const
| Cast to a point_light_node.
virtual vrml97_node::sphere_sensor_node * | to_sphere_sensor () const
| Cast to a sphere_sensor_node.
virtual vrml97_node::spot_light_node * | to_spot_light () const
| Cast to a spot_light_node.
virtual vrml97_node::time_sensor_node * | to_time_sensor () const
| Cast to a time_sensor_node.
virtual vrml97_node::touch_sensor_node * | to_touch_sensor () const
| Cast to a touch_sensor_node.
virtual bool | modified () const
| Determine whether the node has been modified.
void | modified (bool value)
| Set the modified flag.
virtual void | bounding_volume (const openvrml::bounding_volume &v)
virtual const openvrml::bounding_volume & | bounding_volume () const
| Get this node's bounding volume.
virtual void | bounding_volume_dirty (bool f)
virtual bool | bounding_volume_dirty () const
## Protected Member Functions
| node (const node_type &type, const boost::shared_ptr< openvrml::scope > &scope) throw ()
| Construct.
## Static Protected Member Functions
static void | emit_event (openvrml::event_emitter &emitter, double timestamp) throw (std::bad_alloc)
| Emit an event.
## Private Member Functions
virtual void | do_initialize (double timestamp) throw (std::bad_alloc)
| node subclass-specific initialization.
virtual const field_value & | do_field (const std::string &id) const =0 throw (unsupported_interface)
| Called by node::field to get a field.
virtual openvrml::event_listener & | do_event_listener (const std::string &id)=0 throw (unsupported_interface)
| Get an event listener.
virtual openvrml::event_emitter & | do_event_emitter (const std::string &id)=0 throw (unsupported_interface)
| Get an event emitter.
virtual void | do_shutdown (double timestamp) throw ()
| node subclass-specific shut down.
virtual script_node * | to_script () throw ()
| Cast to a script_node.
virtual appearance_node * | to_appearance () throw ()
| Cast to an appearance_node.
virtual child_node * | to_child () throw ()
| Cast to a child_node.
virtual color_node * | to_color () throw ()
| Cast to a color_node.
virtual coordinate_node * | to_coordinate () throw ()
| Cast to a coordinate_node.
virtual font_style_node * | to_font_style () throw ()
| Cast to a font_style_node.
virtual geometry_node * | to_geometry () throw ()
| Cast to a geometry_node.
virtual grouping_node * | to_grouping () throw ()
| Cast to a grouping_node.
virtual material_node * | to_material () throw ()
| Cast to a material_node.
virtual normal_node * | to_normal () throw ()
| Cast to a normal_node.
virtual sound_source_node * | to_sound_source () throw ()
| Cast to a sound_source_node.
virtual texture_node * | to_texture () throw ()
| Cast to a texture_node.
virtual texture_coordinate_node * | to_texture_coordinate () throw ()
| Cast to a texture_coordinate_node.
virtual texture_transform_node * | to_texture_transform () throw ()
| Cast to a texture_transform_node.
virtual transform_node * | to_transform () throw ()
| Cast to a transform_node.
virtual viewpoint_node * | to_viewpoint () throw ()
| Cast to a viewpoint_node.
## Private Attributes
const node_type & | type_
| The type information object for the node.
boost::shared_ptr< openvrml::scope > | scope_
| The scope to which the node belongs.
openvrml::scene * | scene_
| The scene with which the node is associated.
bool | modified_
| Indicate whether the node has been modified.
bool | bounding_volume_dirty_
| Indicate whether the node's cached bounding volume needs updating.
## Friends
class | exposedfield< sfbool >
class | exposedfield< sfcolor >
class | exposedfield< sffloat >
class | exposedfield< sfimage >
class | exposedfield< sfint32 >
class | exposedfield< sfnode >
class | exposedfield< sfrotation >
class | exposedfield< sfstring >
class | exposedfield< sftime >
class | exposedfield< sfvec2f >
class | exposedfield< sfvec3f >
class | exposedfield< mfcolor >
class | exposedfield< mffloat >
class | exposedfield< mfint32 >
class | exposedfield< mfnode >
class | exposedfield< mfrotation >
class | exposedfield< mfstring >
class | exposedfield< mftime >
class | exposedfield< mfvec2f >
class | exposedfield< mfvec3f >
std::ostream & | operator<< (std::ostream &out, const node &n)
| Stream output.
script_node * | node_cast (node *n) throw ()
| Cast to a `viewpoint_node`.
appearance_node * | node_cast (node *n) throw ()
child_node * | node_cast (node *n) throw ()
color_node * | node_cast (node *n) throw ()
coordinate_node * | node_cast (node *n) throw ()
font_style_node * | node_cast (node *n) throw ()
geometry_node * | node_cast (node *n) throw ()
grouping_node * | node_cast (node *n) throw ()
material_node * | node_cast (node *n) throw ()
normal_node * | node_cast (node *n) throw ()
sound_source_node * | node_cast (node *n) throw ()
texture_node * | node_cast (node *n) throw ()
texture_coordinate_node * | node_cast (node *n) throw ()
texture_transform_node * | node_cast (node *n) throw ()
transform_node * | node_cast (node *n) throw ()
viewpoint_node * | node_cast (node *n) throw ()

## Constructor & Destructor Documentation

openvrml::node::~node | ( |  | ) | throw ()`[pure virtual]`

| Destructor. Remove node name (if any) from the scope.

openvrml::node::node | ( | const node_type & | type,
|  | const boost::shared_ptr< openvrml::scope > & | scope
| ) | throw ()`[protected]`

  | Construct. Parameters:
  | type | the node_type associated with the instance.
  | scope | the Scope associated with the instance.

## Member Function Documentation

const node_type & openvrml::node::type | ( |  | ) | const throw ()

| The type information object for the node. Returns: the type information object for the node.

const std::string & openvrml::node::id | ( |  | ) | const throw ()

| Retrieve the name of this node. Returns: the node name.

void openvrml::node::id | ( | const std::string & | node_id | ) | throw (std::bad_alloc)

  | Set the name of the node. Parameters:
  | node_id | the name for the node.
  Exceptions:
  | std::bad_alloc | if memory allocation fails.

const boost::shared_ptr< scope > & openvrml::node::scope | ( |  | ) | const throw ()`[inline]`

| Get the scope to which the node belongs. Returns: the scope to which the node belongs.

openvrml::scene * openvrml::node::scene | ( |  | ) | const throw ()`[inline]`

| Get the scene with which the node is associated. Returns: the scene with which the node is associated.

std::ostream & openvrml::node::print | ( | std::ostream & | out,
|  | size_t | indent
| ) | const

  | Pretty print. Parameters:
  | out | output stream.
  | indent | number of spaces per indentation level.
Returns: `out`.

void openvrml::node::initialize | ( | openvrml::scene & | scene,
|  | double | timestamp
| ) | throw (std::bad_alloc)

  | Initialize the node. This method works recursively, initializing any child nodes to the same `scene` and `timestamp`. If the node has already been initialized, this method has no effect. Parameters:
  | scene | the Scene to which the node will belong.
  | timestamp | the current time.
  Exceptions:
  | std::bad_alloc | if memory allocation fails.
Postcondition: scene points to `scene`.

const field_value & openvrml::node::field | ( | const std::string & | id | ) | const throw (unsupported_interface)

  | Generalized field accessor. Parameters:
  | id | the name of the field.
  Returns: the field value. Exceptions:
  | unsupported_interface | if the node has no field named `id`.

event_listener & openvrml::node::event_listener | ( | const std::string & | id | ) | throw (unsupported_interface)

  | Get an event listener. Parameters:
  | id | an eventIn identifier.
  Exceptions:
  | unsupported_interface | if the node has no eventIn `id`.

event_emitter & openvrml::node::event_emitter | ( | const std::string & | id | ) | throw (unsupported_interface)

  | Get an event emitter. Parameters:
  | id | an eventOut identifier.
  Exceptions:
  | unsupported_interface | if the node has no eventOut `id`.

void openvrml::node::shutdown | ( | double | timestamp | ) | throw ()

  | Shut down the node. This method works recursively, shutting down any child nodes. If the node has already been shut down, this method has no effect. Parameters:
  | timestamp | the current time.
Postcondition: scene is 0.

vrml97_node::anchor_node * openvrml::node::to_anchor | ( |  | ) | const`[virtual]`

| Cast to an anchor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::anchor_node.

vrml97_node::audio_clip_node * openvrml::node::to_audio_clip | ( |  | ) | const`[virtual]`

| Cast to an audio_clip_node. Returns: 0. Reimplemented in openvrml::vrml97_node::audio_clip_node.

vrml97_node::cylinder_sensor_node * openvrml::node::to_cylinder_sensor | ( |  | ) | const`[virtual]`

| Cast to a cylinder_sensor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::cylinder_sensor_node.

vrml97_node::abstract_light_node * openvrml::node::to_light | ( |  | ) | const`[virtual]`

| Cast to an abstract_light_node. Returns: 0. Reimplemented in openvrml::vrml97_node::abstract_light_node.

vrml97_node::movie_texture_node * openvrml::node::to_movie_texture | ( |  | ) | const`[virtual]`

| Cast to a movie_texture_node. Returns: 0. Reimplemented in openvrml::vrml97_node::movie_texture_node.

vrml97_node::navigation_info_node * openvrml::node::to_navigation_info | ( |  | ) | const`[virtual]`

| Cast to a navigation_info_node. Returns: 0. Reimplemented in openvrml::vrml97_node::navigation_info_node.

vrml97_node::plane_sensor_node * openvrml::node::to_plane_sensor | ( |  | ) | const`[virtual]`

| Cast to a plane_sensor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::plane_sensor_node.

vrml97_node::point_light_node * openvrml::node::to_point_light | ( |  | ) | const`[virtual]`

| Cast to a point_light_node. Returns: 0. Reimplemented in openvrml::vrml97_node::point_light_node.

vrml97_node::sphere_sensor_node * openvrml::node::to_sphere_sensor | ( |  | ) | const`[virtual]`

| Cast to a sphere_sensor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::sphere_sensor_node.

vrml97_node::spot_light_node * openvrml::node::to_spot_light | ( |  | ) | const`[virtual]`

| Cast to a spot_light_node. Returns: 0. Reimplemented in openvrml::vrml97_node::spot_light_node.

vrml97_node::time_sensor_node * openvrml::node::to_time_sensor | ( |  | ) | const`[virtual]`

| Cast to a time_sensor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::time_sensor_node.

vrml97_node::touch_sensor_node * openvrml::node::to_touch_sensor | ( |  | ) | const`[virtual]`

| Cast to a touch_sensor_node. Returns: 0. Reimplemented in openvrml::vrml97_node::touch_sensor_node.

bool openvrml::node::modified | ( |  | ) | const`[virtual]`

| Determine whether the node has been modified. The default implementation returns whether this node has been modified. Subclasses that can have child nodes should override this method and return `true` if any of their children have been modified. Returns: `true` if the node has been modified; `false` otherwise. Reimplemented in openvrml::vrml97_node::abstract_indexed_set_node, openvrml::vrml97_node::group_node, openvrml::vrml97_node::appearance_node, openvrml::vrml97_node::collision_node, openvrml::vrml97_node::elevation_grid_node, openvrml::vrml97_node::indexed_face_set_node, openvrml::vrml97_node::lod_node, openvrml::vrml97_node::point_set_node, openvrml::vrml97_node::shape_node, openvrml::vrml97_node::switch_node, and openvrml::vrml97_node::text_node.

void openvrml::node::modified | ( | bool | value | ) |

  | Set the modified flag. Indicates the node needs to be revisited for rendering. Parameters:
  | value |

void openvrml::node::bounding_volume | ( | const openvrml::bounding_volume & | v | ) | `[virtual]`

| Override a node's calculated bounding volume. Not implemented. Todo: Implement me!

const bounding_volume & openvrml::node::bounding_volume | ( |  | ) | const`[virtual]`

| Get this node's bounding volume. Nodes that have no bounding volume, or have a difficult to calculate bvolume (like, say, Extrusion or Billboard) can just return an infinite bsphere. Note that returning an infinite bvolume means that all the node's ancestors will also end up with an infinite bvolume, and will never be culled. Returns: a maximized bounding volume. Reimplemented in openvrml::vrml97_node::group_node, openvrml::vrml97_node::anchor_node, openvrml::vrml97_node::box_node, openvrml::vrml97_node::indexed_face_set_node, openvrml::vrml97_node::lod_node, openvrml::vrml97_node::point_set_node, openvrml::vrml97_node::shape_node, openvrml::vrml97_node::sphere_node, openvrml::vrml97_node::switch_node, and openvrml::vrml97_node::transform_node.

void openvrml::node::bounding_volume_dirty | ( | bool | f | ) | `[virtual]`

| Indicate that a node's bounding volume needs to be recalculated (or not). If a node's bvolume is invalid, then the bvolumes of all that node's ancestors are also invalid. Normally, the node itself will determine when its bvolume needs updating.

bool openvrml::node::bounding_volume_dirty | ( |  | ) | const`[virtual]`

| Return true if the node's bounding volume needs to be recalculated.

void openvrml::node::emit_event | ( | openvrml::event_emitter & | emitter,
|  | double | timestamp
| ) | throw (std::bad_alloc)`[static, protected]`

  | Emit an event. Parameters:
  | emitter | an event_emitter.
  | timestamp | the current time.
  Exceptions:
  | std::bad_alloc | if memory allocation fails.

void openvrml::node::do_initialize | ( | double | timestamp | ) | throw (std::bad_alloc)`[private, virtual]`

  | node subclass-specific initialization. This method is called by node::initialize. Subclasses of node should override this method for any subclass-specific initialization. The default implementation of this method does nothing. Parameters:
  | timestamp | the current time.
  Exceptions:
  | std::bad_alloc | if memory allocation fails.
Reimplemented in openvrml::script_node, openvrml::vrml97_node::audio_clip_node, openvrml::vrml97_node::background_node, openvrml::vrml97_node::fog_node, openvrml::vrml97_node::movie_texture_node, openvrml::vrml97_node::navigation_info_node, openvrml::vrml97_node::point_light_node, openvrml::vrml97_node::spot_light_node, openvrml::vrml97_node::text_node, openvrml::vrml97_node::time_sensor_node, and openvrml::vrml97_node::viewpoint_node.

const field_value & openvrml::node::do_field | ( | const std::string & | id | ) | const throw (unsupported_interface)`[private, pure virtual]`

  | Called by node::field to get a field. Parameters:
  | id | field identifier.
  Returns: the field value. Exceptions:
  | unsupported_interface | if the node has no field `id`.
Implemented in openvrml::script_node, and openvrml::vrml97_node::abstract_base.

event_listener & openvrml::node::do_event_listener | ( | const std::string & | id | ) | throw (unsupported_interface)`[private, pure virtual]`

  | Get an event listener. This method is called by node::event_listener. Subclasses must implement this method. Parameters:
  | id | eventIn identifier.
  Returns: the event listener. Exceptions:
  | unsupported_interface | if the node has no eventIn `id`.
Implemented in openvrml::script_node, and openvrml::vrml97_node::abstract_base.

event_emitter & openvrml::node::do_event_emitter | ( | const std::string & | id | ) | throw (unsupported_interface)`[private, pure virtual]`

  | Get an event emitter. This method is called by node::event_emitter. Subclasses must implement this method. Parameters:
  | id | eventOut identifier.
  Returns: the event emitter. Exceptions:
  | unsupported_interface | if the node has no eventOut `id`.
Implemented in openvrml::script_node, and openvrml::vrml97_node::abstract_base.

void openvrml::node::do_shutdown | ( | double | timestamp | ) | throw ()`[private, virtual]`

  | node subclass-specific shut down. Parameters:
  | timestamp | the current time.
Reimplemented in openvrml::script_node, openvrml::vrml97_node::audio_clip_node, openvrml::vrml97_node::background_node, openvrml::vrml97_node::fog_node, openvrml::vrml97_node::movie_texture_node, openvrml::vrml97_node::navigation_info_node, openvrml::vrml97_node::point_light_node, openvrml::vrml97_node::spot_light_node, openvrml::vrml97_node::text_node, openvrml::vrml97_node::time_sensor_node, and openvrml::vrml97_node::viewpoint_node.

script_node * openvrml::node::to_script | ( |  | ) | throw ()`[private, virtual]`

| Cast to a script_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::script_node.

appearance_node * openvrml::node::to_appearance | ( |  | ) | throw ()`[private, virtual]`

| Cast to an appearance_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::appearance_node.

child_node * openvrml::node::to_child | ( |  | ) | throw ()`[private, virtual]`

| Cast to a child_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::child_node.

color_node * openvrml::node::to_color | ( |  | ) | throw ()`[private, virtual]`

| Cast to a color_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::color_node.

coordinate_node * openvrml::node::to_coordinate | ( |  | ) | throw ()`[private, virtual]`

| Cast to a coordinate_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::coordinate_node.

font_style_node * openvrml::node::to_font_style | ( |  | ) | throw ()`[private, virtual]`

| Cast to a font_style_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::font_style_node.

geometry_node * openvrml::node::to_geometry | ( |  | ) | throw ()`[private, virtual]`

| Cast to a geometry_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::geometry_node.

grouping_node * openvrml::node::to_grouping | ( |  | ) | throw ()`[private, virtual]`

| Cast to a grouping_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::grouping_node.

material_node * openvrml::node::to_material | ( |  | ) | throw ()`[private, virtual]`

| Cast to a material_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::material_node.

normal_node * openvrml::node::to_normal | ( |  | ) | throw ()`[private, virtual]`

| Cast to a normal_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::normal_node.

sound_source_node * openvrml::node::to_sound_source | ( |  | ) | throw ()`[private, virtual]`

| Cast to a sound_source_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::sound_source_node.

texture_node * openvrml::node::to_texture | ( |  | ) | throw ()`[private, virtual]`

| Cast to a texture_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::texture_node.

texture_coordinate_node * openvrml::node::to_texture_coordinate | ( |  | ) | throw ()`[private, virtual]`

| Cast to a texture_coordinate_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::texture_coordinate_node.

texture_transform_node * openvrml::node::to_texture_transform | ( |  | ) | throw ()`[private, virtual]`

| Cast to a texture_transform_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::texture_transform_node.

transform_node * openvrml::node::to_transform | ( |  | ) | throw ()`[private, virtual]`

| Cast to a transform_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::transform_node.

viewpoint_node * openvrml::node::to_viewpoint | ( |  | ) | throw ()`[private, virtual]`

| Cast to a viewpoint_node. For internal use only. Default implementation returns 0. Returns: 0 Reimplemented in openvrml::viewpoint_node.

## Friends And Related Function Documentation

std::ostream & openvrml::node::operator<< | ( | std::ostream & | out,
|  | const node & | n
| ) | `[friend]`

  | Stream output. Parameters:
  | out | output stream.
  | n | a node.
Returns: `out`.

## Member Data Documentation

openvrml::node::type_`[private]`

| The type information object for the node. For internal use only. Reimplemented in openvrml::vrml97_node::navigation_info_node.

scope_ptr openvrml::node::scope_`[private]`

| The scope to which the node belongs. For internal use only.

scene * openvrml::node::scene_`[private]`

| The scene with which the node is associated. For internal use only.

bool openvrml::node::modified_`[private]`

| Indicate whether the node has been modified. For internal use only. See also: node::modified

bool openvrml::node::bounding_volume_dirty_`[private]`

| Indicate whether the node's cached bounding volume needs updating. For internal use only. See also: node::bounding_volume_dirty