![]() |
KiCad PCB EDA Suite
|
Class SGNODE represents the base class of all Scene Graph nodes. More...
#include <sg_node.h>
Public Member Functions | |
virtual void | unlinkChildNode (const SGNODE *aNode)=0 |
Function unlinkChild removes references to an owned child; it is invoked by the child upon destruction to ensure that the parent has no invalid references. More... | |
virtual void | unlinkRefNode (const SGNODE *aNode)=0 |
Function unlinkRef removes pointers to a referenced node; it is invoked by the referenced node upon destruction to ensure that the referring node has no invalid references. More... | |
void | addNodeRef (SGNODE *aNode) |
Function addNodeRef adds a pointer to a node which references, but does not own, this node. More... | |
void | delNodeRef (const SGNODE *aNode) |
Function delNodeRef removes a pointer to a node which references, but does not own, this node. More... | |
bool | isWritten (void) |
Function IsWritten returns true if the object had already been written to a cache file or VRML file; for internal use only. More... | |
SGNODE (SGNODE *aParent) | |
virtual | ~SGNODE () |
S3D::SGTYPES | GetNodeType (void) const |
Function GetNodeType returns the type of this node instance. More... | |
SGNODE * | GetParent (void) const |
Function GetParent returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie. More... | |
virtual bool | SetParent (SGNODE *aParent, bool notify=true)=0 |
Function SetParent sets the parent SGNODE of this object. More... | |
bool | SwapParent (SGNODE *aNewParent) |
Function SwapParent swaps the ownership with the given parent. More... | |
const char * | GetName (void) |
void | SetName (const char *aName) |
const char * | GetNodeTypeName (S3D::SGTYPES aNodeType) const |
virtual SGNODE * | FindNode (const char *aNodeName, const SGNODE *aCaller)=0 |
Function FindNode searches the tree of linked nodes and returns a reference to the first node found with the given name. More... | |
virtual bool | AddRefNode (SGNODE *aNode)=0 |
virtual bool | AddChildNode (SGNODE *aNode)=0 |
void | AssociateWrapper (SGNODE **aWrapperRef) |
Function AssociateWrapper associates this object with a handle to itself; this handle is typically held by an IFSG* wrapper and the pointer which it refers to is set to NULL upon destruction of this object. More... | |
void | DisassociateWrapper (SGNODE **aWrapperRef) |
Function DisassociateWrapper removes the association between an IFSG* wrapper object and this object. More... | |
void | ResetNodeIndex (void) |
Function ResetNodeIndex resets the global SG* node indices in preparation for Write() operations. More... | |
virtual void | ReNameNodes (void)=0 |
Function ReNameNodes renames a node and all its child nodes in preparation for Write() operations. More... | |
virtual bool | WriteVRML (std::ostream &aFile, bool aReuseFlag)=0 |
Function WriteVRML writes this node's data to a VRML file; this includes all data of child and referenced nodes. More... | |
virtual bool | WriteCache (std::ostream &aFile, SGNODE *parentNode)=0 |
Function WriteCache write's this node's data to a binary cache file; the data includes all data of children and references to children. More... | |
virtual bool | ReadCache (std::istream &aFile, SGNODE *parentNode)=0 |
Function ReadCache Reads binary format data from a cache file. More... | |
Protected Attributes | |
std::list< SGNODE * > | m_BackPointers |
SGNODE * | m_Parent |
S3D::SGTYPES | m_SGtype |
std::string | m_Name |
bool | m_written |
Private Attributes | |
SGNODE ** | m_Association |
Class SGNODE represents the base class of all Scene Graph nodes.
SGNODE::SGNODE | ( | SGNODE * | aParent | ) |
Definition at line 76 of file sg_node.cpp.
References m_Association, m_Parent, m_SGtype, m_written, and S3D::SGTYPE_END.
|
virtual |
Definition at line 87 of file sg_node.cpp.
References m_Association, m_BackPointers, m_Parent, and unlinkChildNode().
|
pure virtual |
Implemented in SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGSHAPE, SGINDEX, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by IFSG_NODE::AddChildNode(), S3D::AddSGNodeChild(), SCENEGRAPH::SCENEGRAPH(), SGCOLORS::SetParent(), SGNORMALS::SetParent(), SGCOORDS::SetParent(), SGAPPEARANCE::SetParent(), SGINDEX::SetParent(), SGSHAPE::SetParent(), SGFACESET::SetParent(), SCENEGRAPH::SetParent(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), and SwapParent().
void SGNODE::addNodeRef | ( | SGNODE * | aNode | ) |
Function addNodeRef adds a pointer to a node which references, but does not own, this node.
Such back-pointers are required to ensure that invalidated references are removed when a node is deleted
aNode | is the node holding a reference to this object |
Definition at line 176 of file sg_node.cpp.
References m_BackPointers.
Referenced by SGSHAPE::addNode(), SGFACESET::addNode(), SGSHAPE::ReadCache(), and SGFACESET::ReadCache().
|
pure virtual |
Implemented in SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGSHAPE, SGINDEX, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by IFSG_NODE::AddRefNode(), S3D::AddSGNodeRef(), and SwapParent().
void SGNODE::AssociateWrapper | ( | SGNODE ** | aWrapperRef | ) |
Function AssociateWrapper associates this object with a handle to itself; this handle is typically held by an IFSG* wrapper and the pointer which it refers to is set to NULL upon destruction of this object.
This mechanism provides a scheme by which a wrapper can be notified of the destruction of the object which it wraps.
Definition at line 219 of file sg_node.cpp.
References m_Association.
Referenced by S3D::AssociateSGNodeWrapper(), IFSG_APPEARANCE::Attach(), IFSG_NORMALS::Attach(), IFSG_SHAPE::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COORDS::Attach(), IFSG_FACESET::Attach(), IFSG_COLORS::Attach(), IFSG_TRANSFORM::Attach(), IFSG_APPEARANCE::IFSG_APPEARANCE(), IFSG_COLORS::IFSG_COLORS(), IFSG_COORDINDEX::IFSG_COORDINDEX(), IFSG_COORDS::IFSG_COORDS(), IFSG_FACESET::IFSG_FACESET(), IFSG_NORMALS::IFSG_NORMALS(), IFSG_SHAPE::IFSG_SHAPE(), IFSG_TRANSFORM::IFSG_TRANSFORM(), IFSG_APPEARANCE::NewNode(), IFSG_NORMALS::NewNode(), IFSG_FACESET::NewNode(), IFSG_COORDS::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COLORS::NewNode(), and IFSG_TRANSFORM::NewNode().
void SGNODE::delNodeRef | ( | const SGNODE * | aNode | ) |
Function delNodeRef removes a pointer to a node which references, but does not own, this node.
aNode | is the node holding a reference to this object |
Definition at line 192 of file sg_node.cpp.
References GetNodeType(), m_BackPointers, and m_SGtype.
Referenced by SGSHAPE::unlinkNode(), SGFACESET::unlinkNode(), SGFACESET::~SGFACESET(), and SGSHAPE::~SGSHAPE().
void SGNODE::DisassociateWrapper | ( | SGNODE ** | aWrapperRef | ) |
Function DisassociateWrapper removes the association between an IFSG* wrapper object and this object.
Definition at line 264 of file sg_node.cpp.
References GetName(), m_Association, m_SGtype, and node_names.
Referenced by IFSG_APPEARANCE::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COORDS::Attach(), IFSG_NORMALS::Attach(), IFSG_FACESET::Attach(), IFSG_SHAPE::Attach(), IFSG_COLORS::Attach(), IFSG_TRANSFORM::Attach(), IFSG_NODE::Destroy(), IFSG_APPEARANCE::NewNode(), IFSG_COORDS::NewNode(), IFSG_SHAPE::NewNode(), IFSG_FACESET::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_NORMALS::NewNode(), IFSG_COLORS::NewNode(), IFSG_TRANSFORM::NewNode(), and IFSG_NODE::~IFSG_NODE().
Function FindNode searches the tree of linked nodes and returns a reference to the first node found with the given name.
The reference is then typically added to another node via AddRefNode().
aNodeName | is the name of the node to search for |
aCaller | is a pointer to the node invoking this function |
Implemented in SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGSHAPE, SGINDEX, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by SGSHAPE::FindNode(), SGFACESET::FindNode(), SCENEGRAPH::FindNode(), and IFSG_NODE::FindNode().
const char * SGNODE::GetName | ( | void | ) |
Definition at line 150 of file sg_node.cpp.
References getNodeName(), m_Name, and m_SGtype.
Referenced by SGSHAPE::addNode(), SGFACESET::addNode(), SCENEGRAPH::addNode(), DisassociateWrapper(), IFSG_NODE::GetName(), SGCOLORS::ReNameNodes(), SGNORMALS::ReNameNodes(), SGSHAPE::ReNameNodes(), SGCOORDS::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGFACESET::ReNameNodes(), SCENEGRAPH::ReNameNodes(), SGINDEX::ReNameNodes(), SGNORMALS::WriteCache(), SGCOLORS::WriteCache(), SGSHAPE::WriteCache(), SGCOORDS::WriteCache(), SGAPPEARANCE::WriteCache(), SGFACESET::WriteCache(), SCENEGRAPH::WriteCache(), SGINDEX::WriteCache(), SGCOLORS::WriteVRML(), SGNORMALS::WriteVRML(), SGCOORDS::WriteVRML(), SGSHAPE::WriteVRML(), SGAPPEARANCE::WriteVRML(), SGFACESET::WriteVRML(), and SCENEGRAPH::WriteVRML().
S3D::SGTYPES SGNODE::GetNodeType | ( | void | ) | const |
Function GetNodeType returns the type of this node instance.
Definition at line 108 of file sg_node.cpp.
References m_SGtype.
Referenced by SGSHAPE::addNode(), SGFACESET::addNode(), SCENEGRAPH::addNode(), IFSG_APPEARANCE::Attach(), IFSG_SHAPE::Attach(), IFSG_COORDS::Attach(), IFSG_FACESET::Attach(), IFSG_NORMALS::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COLORS::Attach(), IFSG_TRANSFORM::Attach(), delNodeRef(), S3D::GetMatIndex(), S3D::GetModel(), IFSG_NODE::GetNodeType(), S3D::GetSGNodeType(), IFSG_APPEARANCE::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_COLORS::NewNode(), IFSG_TRANSFORM::NewNode(), SGSHAPE::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), SCENEGRAPH::SCENEGRAPH(), SGCOLORS::SetParent(), SGNORMALS::SetParent(), SGCOORDS::SetParent(), SGAPPEARANCE::SetParent(), SGINDEX::SetParent(), SGSHAPE::SetParent(), SGFACESET::SetParent(), SCENEGRAPH::SetParent(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGINDEX::SGINDEX(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), SwapParent(), SCENEGRAPH::unlinkNode(), and S3D::WriteVRML().
const char * SGNODE::GetNodeTypeName | ( | S3D::SGTYPES | aNodeType | ) | const |
Definition at line 170 of file sg_node.cpp.
References node_names.
Referenced by IFSG_NODE::GetNodeTypeName(), IFSG_APPEARANCE::NewNode(), IFSG_NORMALS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COORDS::NewNode(), IFSG_COLORS::NewNode(), and IFSG_TRANSFORM::NewNode().
SGNODE * SGNODE::GetParent | ( | void | ) | const |
Function GetParent returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
top level transform)
Definition at line 114 of file sg_node.cpp.
References m_Parent.
Referenced by IFSG_NODE::GetParent(), S3D::GetSGNodeParent(), IFSG_APPEARANCE::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_COLORS::NewNode(), IFSG_TRANSFORM::NewNode(), SGNORMALS::WriteCache(), SGCOLORS::WriteCache(), SGSHAPE::WriteCache(), SGCOORDS::WriteCache(), SGAPPEARANCE::WriteCache(), SGFACESET::WriteCache(), SCENEGRAPH::WriteCache(), and SGINDEX::WriteCache().
|
inline |
Function IsWritten returns true if the object had already been written to a cache file or VRML file; for internal use only.
Definition at line 130 of file sg_node.h.
References m_written.
Referenced by SGSHAPE::WriteCache(), SGFACESET::WriteCache(), and SCENEGRAPH::WriteCache().
|
pure virtual |
Function ReadCache Reads binary format data from a cache file.
To read a cache file, open the file for reading and invoke this function from a new SCENEGRAPH node.
Implemented in SGINDEX, SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGCOORDS, SGSHAPE, SGCOLORS, and SGNORMALS.
Referenced by S3D::ReadCache().
|
pure virtual |
Function ReNameNodes renames a node and all its child nodes in preparation for Write() operations.
Implemented in SGINDEX, SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGCOORDS, SGSHAPE, SGCOLORS, and SGNORMALS.
Referenced by S3D::RenameNodes(), and S3D::WriteVRML().
void SGNODE::ResetNodeIndex | ( | void | ) |
Function ResetNodeIndex resets the global SG* node indices in preparation for Write() operations.
Definition at line 304 of file sg_node.cpp.
References i, node_counts, and S3D::SGTYPE_END.
Referenced by S3D::ResetNodeIndex(), SCENEGRAPH::WriteCache(), and S3D::WriteVRML().
void SGNODE::SetName | ( | const char * | aName | ) |
Definition at line 159 of file sg_node.cpp.
References getNodeName(), m_Name, and m_SGtype.
Referenced by SGSHAPE::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), and IFSG_NODE::SetName().
|
pure virtual |
Function SetParent sets the parent SGNODE of this object.
aParent | [in] is the desired parent node |
Implemented in SCENEGRAPH, SGFACESET, SGSHAPE, SGINDEX, SGAPPEARANCE, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by IFSG_APPEARANCE::IFSG_APPEARANCE(), IFSG_COLORS::IFSG_COLORS(), IFSG_COORDINDEX::IFSG_COORDINDEX(), IFSG_COORDS::IFSG_COORDS(), IFSG_FACESET::IFSG_FACESET(), IFSG_NORMALS::IFSG_NORMALS(), IFSG_SHAPE::IFSG_SHAPE(), IFSG_TRANSFORM::IFSG_TRANSFORM(), and IFSG_NODE::SetParent().
bool SGNODE::SwapParent | ( | SGNODE * | aNewParent | ) |
Function SwapParent swaps the ownership with the given parent.
This operation may be required when reordering nodes for optimization.
aNewParent | [in] will become the new parent to the object; it must be the same type as the parent of this instance. |
Definition at line 120 of file sg_node.cpp.
References AddChildNode(), AddRefNode(), GetNodeType(), m_Parent, unlinkChildNode(), and unlinkRefNode().
Referenced by SGSHAPE::WriteCache(), and SGFACESET::WriteCache().
|
pure virtual |
Function unlinkChild removes references to an owned child; it is invoked by the child upon destruction to ensure that the parent has no invalid references.
aNode | is the child which is being deleted |
Implemented in SGFACESET, SCENEGRAPH, SGSHAPE, SGINDEX, SGAPPEARANCE, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by SGCOLORS::SetParent(), SGNORMALS::SetParent(), SGCOORDS::SetParent(), SGAPPEARANCE::SetParent(), SGINDEX::SetParent(), SGSHAPE::SetParent(), SGFACESET::SetParent(), SCENEGRAPH::SetParent(), SwapParent(), and ~SGNODE().
|
pure virtual |
Function unlinkRef removes pointers to a referenced node; it is invoked by the referenced node upon destruction to ensure that the referring node has no invalid references.
aNode | is the node which is being deleted |
Implemented in SGFACESET, SCENEGRAPH, SGSHAPE, SGINDEX, SGAPPEARANCE, SGCOORDS, SGCOLORS, and SGNORMALS.
Referenced by SwapParent().
|
pure virtual |
Function WriteCache write's this node's data to a binary cache file; the data includes all data of children and references to children.
If this function is invoked by the user, parentNode must be set to NULL in order to ensure coherent data.
Implemented in SGINDEX, SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGCOORDS, SGSHAPE, SGCOLORS, and SGNORMALS.
Referenced by SGCOLORS::WriteCache(), SGNORMALS::WriteCache(), SGSHAPE::WriteCache(), SGCOORDS::WriteCache(), S3D::WriteCache(), SGAPPEARANCE::WriteCache(), SGFACESET::WriteCache(), SCENEGRAPH::WriteCache(), and SGINDEX::WriteCache().
|
pure virtual |
Function WriteVRML writes this node's data to a VRML file; this includes all data of child and referenced nodes.
Implemented in SGINDEX, SCENEGRAPH, SGFACESET, SGAPPEARANCE, SGCOORDS, SGSHAPE, SGCOLORS, and SGNORMALS.
Referenced by S3D::WriteVRML().
|
private |
Definition at line 79 of file sg_node.h.
Referenced by AssociateWrapper(), DisassociateWrapper(), SGNODE(), and ~SGNODE().
|
protected |
Definition at line 82 of file sg_node.h.
Referenced by addNodeRef(), SGCOORDS::CalcNormals(), delNodeRef(), and ~SGNODE().
|
protected |
Definition at line 85 of file sg_node.h.
Referenced by SGCOLORS::FindNode(), SGNORMALS::FindNode(), SGCOORDS::FindNode(), SGINDEX::FindNode(), SGSHAPE::FindNode(), SGAPPEARANCE::FindNode(), SGFACESET::FindNode(), SCENEGRAPH::FindNode(), GetName(), SCENEGRAPH::ReadCache(), SGNORMALS::ReNameNodes(), SGCOLORS::ReNameNodes(), SGSHAPE::ReNameNodes(), SGCOORDS::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGFACESET::ReNameNodes(), SCENEGRAPH::ReNameNodes(), SGINDEX::ReNameNodes(), and SetName().
|
protected |
Definition at line 83 of file sg_node.h.
Referenced by SGCOORDS::CalcNormals(), SGSHAPE::FindNode(), SGFACESET::FindNode(), SCENEGRAPH::FindNode(), GetParent(), SCENEGRAPH::SCENEGRAPH(), SGNORMALS::SetParent(), SGCOLORS::SetParent(), SGCOORDS::SetParent(), SGAPPEARANCE::SetParent(), SGINDEX::SetParent(), SGSHAPE::SetParent(), SGFACESET::SetParent(), SCENEGRAPH::SetParent(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGINDEX::SGINDEX(), SGNODE(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), SwapParent(), SGNORMALS::WriteCache(), SGCOLORS::WriteCache(), SGSHAPE::WriteCache(), SGCOORDS::WriteCache(), SGAPPEARANCE::WriteCache(), SGFACESET::WriteCache(), SCENEGRAPH::WriteCache(), SGINDEX::WriteCache(), and ~SGNODE().
|
protected |
Definition at line 84 of file sg_node.h.
Referenced by delNodeRef(), DisassociateWrapper(), GetName(), GetNodeType(), SCENEGRAPH::SCENEGRAPH(), SetName(), SGAPPEARANCE::SGAPPEARANCE(), SGCOLORS::SGCOLORS(), SGCOORDINDEX::SGCOORDINDEX(), SGCOORDS::SGCOORDS(), SGFACESET::SGFACESET(), SGNODE(), SGNORMALS::SGNORMALS(), SGSHAPE::SGSHAPE(), and SGINDEX::WriteVRML().
|
protected |
Definition at line 86 of file sg_node.h.
Referenced by isWritten(), SGCOLORS::ReNameNodes(), SGNORMALS::ReNameNodes(), SGCOORDS::ReNameNodes(), SGSHAPE::ReNameNodes(), SGAPPEARANCE::ReNameNodes(), SGFACESET::ReNameNodes(), SCENEGRAPH::ReNameNodes(), SGINDEX::ReNameNodes(), SGNODE(), SGCOLORS::WriteCache(), SGNORMALS::WriteCache(), SGSHAPE::WriteCache(), SGCOORDS::WriteCache(), SGAPPEARANCE::WriteCache(), SGFACESET::WriteCache(), SCENEGRAPH::WriteCache(), SGINDEX::WriteCache(), SGNORMALS::WriteVRML(), SGCOLORS::WriteVRML(), SGCOORDS::WriteVRML(), SGSHAPE::WriteVRML(), SGAPPEARANCE::WriteVRML(), SGFACESET::WriteVRML(), and SCENEGRAPH::WriteVRML().