class SG_EXPORT osg::Node: public Object

Base class for all internal nodes in the scene graph.

Inheritance:


Public Methods

[more] Node()
Construct a node.
[more]virtual Object* clone() const
return a shallow copy of a node, with Object* return type
[more]Node* cloneNode() const
return a shallow copy of a node, with Node* return type
[more]virtual bool isSameKindAs(Object* obj)
return true if this and obj are of the same kind of object
[more]virtual const char* className() const
return the name of the node's class type
[more]virtual void accept(NodeVisitor& nv)
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type
[more]virtual void ascend(NodeVisitor& nv)
Traverse upwards : calls parents' accept method with NodeVisitor
[more]virtual void traverse(NodeVisitor& )
Traverse downwards : calls children's accept method with NodeVisitor
[more]void setName( const std::string& name )
Set the name of node using C++ style string
[more]void setName( const char* name )
Set the name of node using a C style string
[more]const std::string& getName( void )
Get the name of node
[more]const ParentList& getParents() const
Get the parent list of node.
[more]Group* getParent(int i) const
Get a single parent of node.
[more]int getNumParents() const
Get the number of parents of node.
[more]void setUserData(void* data, MemoryAdapter* ma=0L)
Set user data.
[more]void* getUserData() const
Get user data
[more]MemoryAdapter* getMemoryAdapter() const
Get the memory adapter associated with _userData
[more]void setNodeMask(NodeMask nm)
Set the node mask.
[more]NodeMask getNodeMask()
Get the node Mask.
[more]const DescriptionList& getDescriptions() const
Get the description list of the const node
[more]DescriptionList& getDescriptions()
Get the description list of the const node
[more]const std::string& getDescription(int i) const
Get a single const description of the const node
[more]std::string& getDescription(int i)
Get a single description of the node
[more]int getNumDescriptions() const
Get the number of descriptions of the node
[more]void addDescription(const std::string& desc)
Add a description string to the node
[more]const BoundingSphere& getBound()
get the bounding sphere of node.
[more]void dirtyBound()
Mark this node's bounding sphere dirty.

Public

[more]typedef std::vector<Group*> ParentList
A vector of osg::Group pointers which is used to store the parent(s) of node
[more]typedef unsigned int NodeMask
[more]typedef std::vector<std::string> DescriptionList
A vector of std::string's which are used to describe the object

Protected Fields

[more]BoundingSphere _bsphere
[more]bool _bsphere_computed
[more]std::string _name
[more]ParentList _parents
[more]friend Group
[more]void* _userData
[more]ref_ptr<MemoryAdapter> _memoryAdapter
[more]NodeMask _nodeMask
[more]DescriptionList _descriptions

Protected Methods

[more]virtual ~Node()
Node destructor.
[more]virtual bool readLocalData(Input& fr)
Template Method Pattern : read local data from osg file.
[more]virtual bool writeLocalData(Output& fw)
Template Method Pattern : read local data from osg file.
[more]virtual bool computeBound( void )
Compute the bounding sphere around Node's geometry or children.


Inherited from Object:

Public Methods

ovirtual Object* readClone(Input& fr)
ovirtual bool write(Output& fw)


Inherited from Referenced:

Public Methods

oReferenced& operator = (Referenced&)
ovoid ref()
ovoid unref()
oint referenceCount()

Protected Fields

oint _refCount


Documentation

Base class for all internal nodes in the scene graph. Provides interface for most common node operations (Composite Pattern).
o Node()
Construct a node. Initialize the parent list to empty, node name to "" and bounding sphere dirty flag to true.

ovirtual Object* clone() const
return a shallow copy of a node, with Object* return type

oNode* cloneNode() const
return a shallow copy of a node, with Node* return type

ovirtual bool isSameKindAs(Object* obj)
return true if this and obj are of the same kind of object

ovirtual const char* className() const
return the name of the node's class type

ovirtual void accept(NodeVisitor& nv)
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type

ovirtual void ascend(NodeVisitor& nv)
Traverse upwards : calls parents' accept method with NodeVisitor

ovirtual void traverse(NodeVisitor& )
Traverse downwards : calls children's accept method with NodeVisitor

ovoid setName( const std::string& name )
Set the name of node using C++ style string

ovoid setName( const char* name )
Set the name of node using a C style string

oconst std::string& getName( void )
Get the name of node

otypedef std::vector<Group*> ParentList
A vector of osg::Group pointers which is used to store the parent(s) of node

oconst ParentList& getParents() const
Get the parent list of node.

oGroup* getParent(int i) const
Get a single parent of node.
Parameters:
i - index of the parent to get.
Returns:
the parent i.

oint getNumParents() const
Get the number of parents of node.
Returns:
the number of parents of this node.

ovoid setUserData(void* data, MemoryAdapter* ma=0L)
Set user data. See MemoryAdapter documention for details of how to specify memory managament of _userData.

ovoid* getUserData() const
Get user data

oMemoryAdapter* getMemoryAdapter() const
Get the memory adapter associated with _userData

otypedef unsigned int NodeMask

ovoid setNodeMask(NodeMask nm)
Set the node mask. Note, node mask is will be replaced by TraversalMask.

oNodeMask getNodeMask()
Get the node Mask. Note, node mask is will be replaced by TraversalMask.

otypedef std::vector<std::string> DescriptionList
A vector of std::string's which are used to describe the object

oconst DescriptionList& getDescriptions() const
Get the description list of the const node

oDescriptionList& getDescriptions()
Get the description list of the const node

oconst std::string& getDescription(int i) const
Get a single const description of the const node

ostd::string& getDescription(int i)
Get a single description of the node

oint getNumDescriptions() const
Get the number of descriptions of the node

ovoid addDescription(const std::string& desc)
Add a description string to the node

oconst BoundingSphere& getBound()
get the bounding sphere of node. Using lazy evaluation computes the bounding sphere if it is 'dirty'.

ovoid dirtyBound()
Mark this node's bounding sphere dirty. Forcing it to be computed on the next call to getBound().

ovirtual ~Node()
Node destructor. Note, is protected so that Nodes cannot be deleted other than by being dereferenced and the reference count being zero (see osg::Referenced), preventing the deletion of nodes which are still in use. This also means that Node's cannot be created on stack i.e Node node will not compile, forcing all nodes to be created on the heap i.e Node* node = new Node().

ovirtual bool readLocalData(Input& fr)
Template Method Pattern : read local data from osg file. Note should be implemented in derived classes, which call their parent class's readLocalData.
Returns:
true if the input iterator has been advanced, otherwise false.

ovirtual bool writeLocalData(Output& fw)
Template Method Pattern : read local data from osg file. Note should be implemented in derivied classes, which call their parent class's writeLocalData.
Returns:
true if data has been written out, otherwise false.

ovirtual bool computeBound( void )
Compute the bounding sphere around Node's geometry or children. This method is automatically called by getBound() when the bounding sphere has been marked dirty via dirtyBound().

oBoundingSphere _bsphere

obool _bsphere_computed

ostd::string _name

oParentList _parents

ofriend Group

ovoid* _userData

oref_ptr<MemoryAdapter> _memoryAdapter

oNodeMask _nodeMask

oDescriptionList _descriptions


Direct child classes:
LightSource
Group
Geode

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.