Added asSwitch and asGeode convinience methods to Node
This commit is contained in:
@@ -29,6 +29,8 @@ class NodeVisitor;
|
||||
class Group;
|
||||
class Transform;
|
||||
class Node;
|
||||
class Switch;
|
||||
class Geode;
|
||||
|
||||
/** A vector of Nodes pointers which is used to describe the path from a root node to a descendant.*/
|
||||
typedef std::vector< Node* > NodePath;
|
||||
@@ -96,6 +98,22 @@ class OSG_EXPORT Node : public Object
|
||||
* Equivalent to dynamic_cast<const Transform*>(this).*/
|
||||
virtual const Transform* asTransform() const { return 0; }
|
||||
|
||||
/** Convert 'this' into a Switch pointer if Node is a Switch, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<Switch*>(this).*/
|
||||
virtual Switch* asSwitch() { return 0; }
|
||||
|
||||
/** convert 'const this' into a const Switch pointer if Node is a Switch, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<const Switch*>(this).*/
|
||||
virtual const Switch* asSwitch() const { return 0; }
|
||||
|
||||
/** Convert 'this' into a Geode pointer if Node is a Geode, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<Geode*>(this).*/
|
||||
virtual Geode* asGeode() { return 0; }
|
||||
|
||||
/** convert 'const this' into a const Geode pointer if Node is a Geode, otherwise return 0.
|
||||
* Equivalent to dynamic_cast<const Geode*>(this).*/
|
||||
virtual const Geode* asGeode() const { return 0; }
|
||||
|
||||
/** Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.*/
|
||||
virtual void accept(NodeVisitor& nv);
|
||||
/** Traverse upwards : calls parents' accept method with NodeVisitor.*/
|
||||
|
||||
Reference in New Issue
Block a user