KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SGCOORDINDEX Class Reference

An object to maintain a coordinate index list. More...

#include <sg_coordindex.h>

Inheritance diagram for SGCOORDINDEX:
SGINDEX SGNODE

Public Member Functions

 SGCOORDINDEX (SGNODE *aParent)
 
virtual ~SGCOORDINDEX ()
 
void GatherCoordIndices (std::vector< int > &aIndexList)
 Add all coordinate indices to the given list in preparation for a normals calculation.
 
virtual bool SetParent (SGNODE *aParent, bool notify=true) override
 Set the parent SGNODE of this object.
 
SGNODEFindNode (const char *aNodeName, const SGNODE *aCaller) noexcept override
 Search the tree of linked nodes and return a reference to the first node found with the given name.
 
bool AddRefNode (SGNODE *aNode) noexcept override
 
bool AddChildNode (SGNODE *aNode) noexcept override
 
void unlinkChildNode (const SGNODE *aCaller) noexcept override
 Remove references to an owned child.
 
void unlinkRefNode (const SGNODE *aCaller) noexcept override
 Remove pointers to a referenced node.
 
bool GetIndices (size_t &nIndices, int *&aIndexList)
 Retrieve the number of indices and a pointer to the list.
 
void SetIndices (size_t nIndices, int *aIndexList)
 Set the number of indices and creates a copy of the given index data.
 
void AddIndex (int aIndex)
 Add a single index to the list.
 
void ReNameNodes (void) override
 Rename a node and all its child nodes in preparation for write operations.
 
bool WriteVRML (std::ostream &aFile, bool aReuseFlag) override
 Writes this node's data to a VRML file.
 
bool WriteCache (std::ostream &aFile, SGNODE *parentNode) override
 Write this node's data to a binary cache file.
 
bool ReadCache (std::istream &aFile, SGNODE *parentNode) override
 Reads binary format data from a cache file.
 
S3D::SGTYPES GetNodeType (void) const noexcept
 Return the type of this node instance.
 
SGNODEGetParent (void) const noexcept
 Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
 
bool SwapParent (SGNODE *aNewParent)
 Swap the ownership with the given parent.
 
const char * GetName (void)
 
void SetName (const char *aName)
 
const char * GetNodeTypeName (S3D::SGTYPES aNodeType) const noexcept
 
void AssociateWrapper (SGNODE **aWrapperRef) noexcept
 Associate this object with a handle to itself.
 
void DisassociateWrapper (SGNODE **aWrapperRef) noexcept
 Remove the association between an IFSG* wrapper object and this object.
 
void ResetNodeIndex (void) noexcept
 Reset the global SG* node indices in preparation for write operations.
 
void addNodeRef (SGNODE *aNode)
 Add a pointer to a node which references this node, but does not own.
 
void delNodeRef (const SGNODE *aNode)
 Remove a pointer to a node which references this node, but does not own.
 
bool isWritten (void) noexcept
 Return true if the object had already been written to a cache file or VRML file.
 

Public Attributes

std::vector< int > index
 

Protected Member Functions

bool writeCoordIndex (std::ostream &aFile)
 
bool writeColorIndex (std::ostream &aFile)
 
bool writeIndexList (std::ostream &aFile)
 

Protected Attributes

std::list< SGNODE * > m_BackPointers
 nodes which hold a reference to this.
 
SGNODEm_Parent
 Pointer to parent node; may be NULL for top level transform.
 
S3D::SGTYPES m_SGtype
 Type of Scene Graph node.
 
std::string m_Name
 name to use for referencing the entity by name.
 
bool m_written
 Set to true when the object has been written after a ReNameNodes().
 

Private Attributes

SGNODE ** m_Association
 Handle to the instance held by a wrapper.
 

Detailed Description

An object to maintain a coordinate index list.

Users must ensure that coordinate indices are specified as triplets (triangular faces) since no checking is performed. In instances where it is not possible to determine which side of the triangle is to be rendered (for example IGES entities) then the user must supply each triplet in both point orders.

Definition at line 42 of file sg_coordindex.h.

Constructor & Destructor Documentation

◆ SGCOORDINDEX()

SGCOORDINDEX::SGCOORDINDEX ( SGNODE aParent)

◆ ~SGCOORDINDEX()

SGCOORDINDEX::~SGCOORDINDEX ( )
virtual

Definition at line 39 of file sg_coordindex.cpp.

Member Function Documentation

◆ AddChildNode()

bool SGINDEX::AddChildNode ( SGNODE aNode)
overridevirtualnoexceptinherited

Implements SGNODE.

Definition at line 117 of file sg_index.cpp.

◆ AddIndex()

void SGINDEX::AddIndex ( int  aIndex)
inherited

Add a single index to the list.

Parameters
aIndexis the index to add.

Definition at line 155 of file sg_index.cpp.

References SGINDEX::index.

◆ addNodeRef()

void SGNODE::addNodeRef ( SGNODE aNode)
inherited

Add a pointer to a node which references this node, but does not own.

Such back-pointers are required to ensure that invalidated references are removed when a node is deleted.

Parameters
aNodeis the node holding a reference to this object.

Definition at line 170 of file sg_node.cpp.

References SGNODE::m_BackPointers.

Referenced by SGFACESET::addNode(), SGSHAPE::addNode(), SGFACESET::ReadCache(), and SGSHAPE::ReadCache().

◆ AddRefNode()

bool SGINDEX::AddRefNode ( SGNODE aNode)
overridevirtualnoexceptinherited

Implements SGNODE.

Definition at line 108 of file sg_index.cpp.

◆ AssociateWrapper()

void SGNODE::AssociateWrapper ( SGNODE **  aWrapperRef)
noexceptinherited

◆ delNodeRef()

void SGNODE::delNodeRef ( const SGNODE aNode)
inherited

Remove a pointer to a node which references this node, but does not own.

Parameters
aNodeis the node holding a reference to this object.

Definition at line 185 of file sg_node.cpp.

References SGNODE::GetNodeType(), SGNODE::m_BackPointers, and SGNODE::m_SGtype.

Referenced by SGFACESET::unlinkNode(), SGSHAPE::unlinkNode(), SGFACESET::~SGFACESET(), and SGSHAPE::~SGSHAPE().

◆ DisassociateWrapper()

◆ FindNode()

SGNODE * SGINDEX::FindNode ( const char *  aNodeName,
const SGNODE aCaller 
)
overridevirtualnoexceptinherited

Search the tree of linked nodes and return a reference to the first node found with the given name.

The reference is then typically added to another node via AddRefNode().

Parameters
aNodeNameis the name of the node to search for.
aCalleris a pointer to the node invoking this function.
Returns
is a valid node pointer on success, otherwise NULL.

Implements SGNODE.

Definition at line 82 of file sg_index.cpp.

Referenced by SGFACESET::FindNode().

◆ GatherCoordIndices()

void SGCOORDINDEX::GatherCoordIndices ( std::vector< int > &  aIndexList)

Add all coordinate indices to the given list in preparation for a normals calculation.

Definition at line 44 of file sg_coordindex.cpp.

References SGINDEX::index.

Referenced by SGFACESET::GatherCoordIndices().

◆ GetIndices()

bool SGINDEX::GetIndices ( size_t &  nIndices,
int *&  aIndexList 
)
inherited

Retrieve the number of indices and a pointer to the list.

Note
The returned pointer may be invalidated by future operations on the SGNODE. The caller must make immediate use of the data and must not rely on the pointer's validity in the future.
Parameters
nIndiceswill hold the number of indices in the list.
aIndexListwill store a pointer to the data.
Returns
true if there was available data (nIndices > 0) otherwise false.

Definition at line 126 of file sg_index.cpp.

References SGINDEX::index.

Referenced by SGSHAPE::Prepare(), and SGFACESET::validate().

◆ GetName()

◆ GetNodeType()

◆ GetNodeTypeName()

◆ GetParent()

◆ isWritten()

bool SGNODE::isWritten ( void  )
inlinenoexceptinherited

Return true if the object had already been written to a cache file or VRML file.

For internal use only.

Definition at line 220 of file sg_node.h.

References SGNODE::m_written.

Referenced by SCENEGRAPH::WriteCache(), SGFACESET::WriteCache(), and SGSHAPE::WriteCache().

◆ ReadCache()

bool SGINDEX::ReadCache ( std::istream &  aFile,
SGNODE parentNode 
)
overridevirtualinherited

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.

Implements SGNODE.

Definition at line 307 of file sg_index.cpp.

References SGINDEX::index.

Referenced by SGFACESET::ReadCache().

◆ ReNameNodes()

void SGINDEX::ReNameNodes ( void  )
overridevirtualinherited

Rename a node and all its child nodes in preparation for write operations.

Implements SGNODE.

Definition at line 161 of file sg_index.cpp.

References SGNODE::GetName(), SGNODE::m_Name, and SGNODE::m_written.

Referenced by SGFACESET::ReNameNodes().

◆ ResetNodeIndex()

void SGNODE::ResetNodeIndex ( void  )
noexceptinherited

Reset the global SG* node indices in preparation for write operations.

Definition at line 238 of file sg_node.cpp.

References node_counts, and S3D::SGTYPE_END.

Referenced by S3D::ResetNodeIndex(), SCENEGRAPH::WriteCache(), and S3D::WriteVRML().

◆ SetIndices()

void SGINDEX::SetIndices ( size_t  nIndices,
int *  aIndexList 
)
inherited

Set the number of indices and creates a copy of the given index data.

Parameters
nIndicesthe number of indices to be stored.
aIndexListthe index data.

Definition at line 141 of file sg_index.cpp.

References SGINDEX::index.

◆ SetName()

void SGNODE::SetName ( const char *  aName)
inherited

◆ SetParent()

bool SGINDEX::SetParent ( SGNODE aParent,
bool  notify = true 
)
overridevirtualinherited

Set the parent SGNODE of this object.

Parameters
aParent[in] is the desired parent node
Returns
true if the operation succeeds; false if the given node is not allowed to be a parent to the derived object.

Implements SGNODE.

Definition at line 52 of file sg_index.cpp.

References SGNODE::AddChildNode(), SGNODE::GetNodeType(), SGNODE::m_Parent, S3D::SGTYPE_FACESET, and SGNODE::unlinkChildNode().

Referenced by SGFACESET::addNode(), and SGFACESET::~SGFACESET().

◆ SwapParent()

bool SGNODE::SwapParent ( SGNODE aNewParent)
inherited

Swap the ownership with the given parent.

This operation may be required when reordering nodes for optimization.

Parameters
aNewParentwill become the new parent to the object; it must be the same type as the parent of this instance.

Definition at line 116 of file sg_node.cpp.

References SGNODE::AddChildNode(), SGNODE::AddRefNode(), SGNODE::GetNodeType(), SGNODE::m_Parent, SGNODE::unlinkChildNode(), and SGNODE::unlinkRefNode().

Referenced by SGFACESET::WriteCache(), and SGSHAPE::WriteCache().

◆ unlinkChildNode()

void SGINDEX::unlinkChildNode ( const SGNODE aNode)
overridevirtualnoexceptinherited

Remove references to an owned child.

This is invoked by the child upon destruction to ensure that the parent has no invalid references.

Parameters
aNodeis the child which is being deleted.

Implements SGNODE.

Definition at line 94 of file sg_index.cpp.

◆ unlinkRefNode()

void SGINDEX::unlinkRefNode ( const SGNODE aNode)
overridevirtualnoexceptinherited

Remove pointers to a referenced node.

This is invoked by the referenced node upon destruction to ensure that the referring node has no invalid references.

Parameters
aNodeis the node which is being deleted.

Implements SGNODE.

Definition at line 101 of file sg_index.cpp.

◆ WriteCache()

bool SGINDEX::WriteCache ( std::ostream &  aFile,
SGNODE parentNode 
)
overridevirtualinherited

Write 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.

Implements SGNODE.

Definition at line 262 of file sg_index.cpp.

References SGNODE::GetName(), SGNODE::GetParent(), SGINDEX::index, SGNODE::m_Parent, SGNODE::m_written, and SGNODE::WriteCache().

Referenced by SGFACESET::WriteCache().

◆ writeColorIndex()

bool SGINDEX::writeColorIndex ( std::ostream &  aFile)
protectedinherited

Definition at line 226 of file sg_index.cpp.

References SGINDEX::writeIndexList().

Referenced by SGINDEX::WriteVRML().

◆ writeCoordIndex()

bool SGINDEX::writeCoordIndex ( std::ostream &  aFile)
protectedinherited

Definition at line 183 of file sg_index.cpp.

References SGINDEX::index.

Referenced by SGINDEX::WriteVRML().

◆ writeIndexList()

bool SGINDEX::writeIndexList ( std::ostream &  aFile)
protectedinherited

Definition at line 233 of file sg_index.cpp.

References SGINDEX::index.

Referenced by SGINDEX::writeColorIndex().

◆ WriteVRML()

bool SGINDEX::WriteVRML ( std::ostream &  aFile,
bool  aReuseFlag 
)
overridevirtualinherited

Writes this node's data to a VRML file.

This includes all data of child and referenced nodes.

Implements SGNODE.

Definition at line 171 of file sg_index.cpp.

References SGINDEX::index, SGNODE::m_SGtype, S3D::SGTYPE_COORDINDEX, SGINDEX::writeColorIndex(), and SGINDEX::writeCoordIndex().

Referenced by SGFACESET::WriteVRML().

Member Data Documentation

◆ index

◆ m_Association

SGNODE** SGNODE::m_Association
privateinherited

Handle to the instance held by a wrapper.

Definition at line 233 of file sg_node.h.

Referenced by SGNODE::SGNODE(), and SGNODE::~SGNODE().

◆ m_BackPointers

std::list< SGNODE* > SGNODE::m_BackPointers
protectedinherited

nodes which hold a reference to this.

Definition at line 226 of file sg_node.h.

Referenced by SGNODE::addNodeRef(), SGCOORDS::CalcNormals(), SGNODE::delNodeRef(), and SGNODE::~SGNODE().

◆ m_Name

◆ m_Parent

◆ m_SGtype

◆ m_written


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