KiCad PCB EDA Suite
SGINDEX Class Reference

Define a generic index interface for a scenegraph object. More...

#include <sg_index.h>

Inheritance diagram for SGINDEX:
SGNODE SGCOORDINDEX

Public Member Functions

 SGINDEX (SGNODE *aParent)
 
virtual ~SGINDEX ()
 
virtual bool SetParent (SGNODE *aParent, bool notify=true) override
 Set the parent SGNODE of this object. More...
 
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. More...
 
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. More...
 
void unlinkRefNode (const SGNODE *aCaller) noexcept override
 Remove pointers to a referenced node. More...
 
bool GetIndices (size_t &nIndices, int *&aIndexList)
 Retrieve the number of indices and a pointer to the list. More...
 
void SetIndices (size_t nIndices, int *aIndexList)
 Set the number of indices and creates a copy of the given index data. More...
 
void AddIndex (int aIndex)
 Add a single index to the list. More...
 
void ReNameNodes (void) override
 Rename a node and all its child nodes in preparation for write operations. More...
 
bool WriteVRML (std::ostream &aFile, bool aReuseFlag) override
 Writes this node's data to a VRML file. More...
 
bool WriteCache (std::ostream &aFile, SGNODE *parentNode) override
 Write this node's data to a binary cache file. More...
 
bool ReadCache (std::istream &aFile, SGNODE *parentNode) override
 Reads binary format data from a cache file. More...
 
S3D::SGTYPES GetNodeType (void) const noexcept
 Return the type of this node instance. More...
 
SGNODEGetParent (void) const noexcept
 Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie. More...
 
bool SwapParent (SGNODE *aNewParent)
 Swap the ownership with the given parent. More...
 
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. More...
 
void DisassociateWrapper (SGNODE **aWrapperRef) noexcept
 Remove the association between an IFSG* wrapper object and this object. More...
 
void ResetNodeIndex (void) noexcept
 Reset the global SG* node indices in preparation for write operations. More...
 
void addNodeRef (SGNODE *aNode)
 Add a pointer to a node which references this node, but does not own. More...
 
void delNodeRef (const SGNODE *aNode)
 Remove a pointer to a node which references this node, but does not own. More...
 
bool isWritten (void) noexcept
 Return true if the object had already been written to a cache file or VRML file. More...
 

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. More...
 
SGNODEm_Parent
 Pointer to parent node; may be NULL for top level transform. More...
 
S3D::SGTYPES m_SGtype
 Type of Scene Graph node. More...
 
std::string m_Name
 name to use for referencing the entity by name. More...
 
bool m_written
 Set to true when the object has been written after a ReNameNodes(). More...
 

Private Attributes

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

Detailed Description

Define a generic index interface for a scenegraph object.

Definition at line 38 of file sg_index.h.

Constructor & Destructor Documentation

◆ SGINDEX()

SGINDEX::SGINDEX ( SGNODE aParent)

Definition at line 32 of file sg_index.cpp.

32 : SGNODE( aParent )
33{
34 if( nullptr != aParent && S3D::SGTYPE_FACESET != aParent->GetNodeType() )
35 {
36 m_Parent = nullptr;
37
38 wxLogTrace( MASK_3D_SG, wxT( "%s:%s:%d * [BUG] inappropriate parent to SGINDEX (type "
39 "'%d')" ),
40 __FILE__, __FUNCTION__, __LINE__,
41 aParent->GetNodeType() );
42 }
43}
S3D::SGTYPES GetNodeType(void) const noexcept
Return the type of this node instance.
Definition: sg_node.cpp:104
SGNODE * m_Parent
Pointer to parent node; may be NULL for top level transform.
Definition: sg_node.h:227
SGNODE(SGNODE *aParent)
Definition: sg_node.cpp:76
@ SGTYPE_FACESET
Definition: sg_types.h:40

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

◆ ~SGINDEX()

SGINDEX::~SGINDEX ( )
virtual

Definition at line 46 of file sg_index.cpp.

47{
48 index.clear();
49}
std::vector< int > index
Definition: sg_index.h:95

References index.

Member Function Documentation

◆ AddChildNode()

bool SGINDEX::AddChildNode ( SGNODE aNode)
overridevirtualnoexcept

Implements SGNODE.

Definition at line 117 of file sg_index.cpp.

118{
119 // Node should have no children or refs.
120 wxCHECK( false, false );
121
122 return false;
123}

◆ AddIndex()

void SGINDEX::AddIndex ( int  aIndex)

Add a single index to the list.

Parameters
aIndexis the index to add.

Definition at line 155 of file sg_index.cpp.

156{
157 index.push_back( aIndex );
158}

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

171{
172 if( nullptr == aNode )
173 return;
174
175 std::list< SGNODE* >::iterator np =
176 std::find( m_BackPointers.begin(), m_BackPointers.end(), aNode );
177
178 if( np != m_BackPointers.end() )
179 return;
180
181 m_BackPointers.push_back( aNode );
182}
std::list< SGNODE * > m_BackPointers
nodes which hold a reference to this.
Definition: sg_node.h:226

References SGNODE::m_BackPointers.

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

◆ AddRefNode()

bool SGINDEX::AddRefNode ( SGNODE aNode)
overridevirtualnoexcept

Implements SGNODE.

Definition at line 108 of file sg_index.cpp.

109{
110 // Node should have no children or refs.
111 wxCHECK( false, false );
112
113 return false;
114}

◆ AssociateWrapper()

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

Associate this object with a handle to itself.

The 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 207 of file sg_node.cpp.

208{
209 wxCHECK( aWrapperRef && *aWrapperRef == this, /* void */ );
210
211 // if there is an existing association then break it and emit a warning
212 // just in case the behavior is undesired
213 if( m_Association )
214 {
215 *m_Association = nullptr;
216
217 wxLogTrace( MASK_3D_SG, wxT( "%s:%s:%d * [WARNING] association being broken with "
218 "previous wrapper" ),
219 __FILE__, __FUNCTION__, __LINE__ );
220 }
221
222 m_Association = aWrapperRef;
223}
SGNODE ** m_Association
Handle to the instance held by a wrapper.
Definition: sg_node.h:233

Referenced by S3D::AssociateSGNodeWrapper(), IFSG_APPEARANCE::Attach(), IFSG_COLORS::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COORDS::Attach(), IFSG_FACESET::Attach(), IFSG_NORMALS::Attach(), IFSG_SHAPE::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_COLORS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), and IFSG_TRANSFORM::NewNode().

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

186{
187 if( nullptr == aNode )
188 return;
189
190 std::list< SGNODE* >::iterator np =
191 std::find( m_BackPointers.begin(), m_BackPointers.end(), aNode );
192
193 if( np != m_BackPointers.end() )
194 {
195 m_BackPointers.erase( np );
196 return;
197 }
198
199 wxLogTrace( MASK_3D_SG, wxT( "%s:%s:%d * [BUG] delNodeRef() did not find its target, this "
200 "node type %d, referenced node type %d" ),
201 __FILE__, __FUNCTION__, __LINE__,
202 m_SGtype,
203 aNode->GetNodeType() );
204}
S3D::SGTYPES m_SGtype
Type of Scene Graph node.
Definition: sg_node.h:228

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

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

◆ DisassociateWrapper()

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

Remove the association between an IFSG* wrapper object and this object.

Definition at line 225 of file sg_node.cpp.

226{
227 if( !m_Association )
228 return;
229
230 wxCHECK( aWrapperRef, /* void */ );
231
232 wxCHECK( *aWrapperRef == *m_Association && aWrapperRef == m_Association, /* void */ );
233
234 m_Association = nullptr;
235}

Referenced by IFSG_APPEARANCE::Attach(), IFSG_COLORS::Attach(), IFSG_COORDINDEX::Attach(), IFSG_COORDS::Attach(), IFSG_FACESET::Attach(), IFSG_NORMALS::Attach(), IFSG_SHAPE::Attach(), IFSG_TRANSFORM::Attach(), IFSG_NODE::Destroy(), IFSG_APPEARANCE::NewNode(), IFSG_COLORS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), IFSG_TRANSFORM::NewNode(), and IFSG_NODE::~IFSG_NODE().

◆ FindNode()

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

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.

83{
84 if( nullptr == aNodeName || 0 == aNodeName[0] )
85 return nullptr;
86
87 if( !m_Name.compare( aNodeName ) )
88 return this;
89
90 return nullptr;
91}
std::string m_Name
name to use for referencing the entity by name.
Definition: sg_node.h:229

Referenced by SGFACESET::FindNode().

◆ GetIndices()

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

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.

127{
128 if( index.empty() )
129 {
130 nIndices = 0;
131 aIndexList = nullptr;
132 return false;
133 }
134
135 nIndices = index.size();
136 aIndexList = & index[0];
137 return true;
138}

References index.

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

◆ GetName()

◆ GetNodeType()

◆ GetNodeTypeName()

const char * SGNODE::GetNodeTypeName ( S3D::SGTYPES  aNodeType) const
noexceptinherited

Definition at line 164 of file sg_node.cpp.

165{
166 return node_names[aNodeType].c_str();
167}
static const std::string node_names[S3D::SGTYPE_END+1]
Definition: sg_node.cpp:36

References node_names.

Referenced by IFSG_NODE::GetNodeTypeName(), IFSG_APPEARANCE::NewNode(), IFSG_COLORS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_COORDS::NewNode(), IFSG_FACESET::NewNode(), IFSG_NORMALS::NewNode(), IFSG_SHAPE::NewNode(), and IFSG_TRANSFORM::NewNode().

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

221 {
222 return m_written;
223 }
bool m_written
Set to true when the object has been written after a ReNameNodes().
Definition: sg_node.h:230

References SGNODE::m_written.

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

◆ ReadCache()

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

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.

308{
309 wxCHECK( index.empty(), false );
310
311 size_t npts;
312 aFile.read( (char*)&npts, sizeof(size_t) );
313 int tmp;
314
315 if( aFile.fail() )
316 return false;
317
318 for( size_t i = 0; i < npts; ++i )
319 {
320 aFile.read( (char*) &tmp, sizeof( int ) );
321
322 if( aFile.fail() )
323 return false;
324
325 index.push_back( tmp );
326 }
327
328 return true;
329}

References index.

Referenced by SGFACESET::ReadCache().

◆ ReNameNodes()

void SGINDEX::ReNameNodes ( void  )
overridevirtual

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

Implements SGNODE.

Definition at line 161 of file sg_index.cpp.

162{
163 m_written = false;
164
165 // rename this node
166 m_Name.clear();
167 GetName();
168}
const char * GetName(void)
Definition: sg_node.cpp:146

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.

239{
240 for( int i = 0; i < (int)S3D::SGTYPE_END; ++i )
241 node_counts[i] = 1;
242}
@ SGTYPE_END
Definition: sg_types.h:45
static unsigned int node_counts[S3D::SGTYPE_END]
Definition: sg_node.cpp:50

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 
)

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.

142{
143 index.clear();
144
145 if( 0 == nIndices || nullptr == aIndexList )
146 return;
147
148 for( size_t i = 0; i < nIndices; ++i )
149 index.push_back( aIndexList[i] );
150
151 return;
152}

References index.

◆ SetName()

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

Definition at line 155 of file sg_node.cpp.

156{
157 if( nullptr == aName || 0 == aName[0] )
159 else
160 m_Name = aName;
161}

References getNodeName(), SGNODE::m_Name, and SGNODE::m_SGtype.

Referenced by SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), SGSHAPE::ReadCache(), and IFSG_NODE::SetName().

◆ SetParent()

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

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.

53{
54 if( nullptr != m_Parent )
55 {
56 if( aParent == m_Parent )
57 return true;
58
59 // handle the change in parents
60 if( notify )
62
63 m_Parent = nullptr;
64
65 if( nullptr == aParent )
66 return true;
67 }
68
69 // only a SGFACESET may be parent to a SGINDEX and derived types
70 if( nullptr != aParent && S3D::SGTYPE_FACESET != aParent->GetNodeType() )
71 return false;
72
73 m_Parent = aParent;
74
75 if( m_Parent )
76 m_Parent->AddChildNode( this );
77
78 return true;
79}
virtual bool AddChildNode(SGNODE *aNode)=0
virtual void unlinkChildNode(const SGNODE *aNode)=0
Remove references to an owned child.

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.

117{
118 if( aNewParent == m_Parent )
119 return true;
120
121 if( nullptr == aNewParent )
122 return false;
123
124 if( nullptr == m_Parent )
125 {
126 if( aNewParent->AddChildNode( this ) )
127 return true;
128
129 return false;
130 }
131
132 if( aNewParent->GetNodeType() != m_Parent->GetNodeType() )
133 return false;
134
135 SGNODE* oldParent = m_Parent;
136 m_Parent->unlinkChildNode( this );
137 m_Parent = nullptr;
138 aNewParent->unlinkRefNode( this );
139 aNewParent->AddChildNode( this );
140 oldParent->AddRefNode( this );
141
142 return true;
143}
The base class of all Scene Graph nodes.
Definition: sg_node.h:75
virtual bool AddRefNode(SGNODE *aNode)=0
virtual void unlinkRefNode(const SGNODE *aNode)=0
Remove pointers to a referenced node.

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)
overridevirtualnoexcept

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.

95{
96 // Node should have no children or refs.
97 wxCHECK( false, /* void */ );
98}

◆ unlinkRefNode()

void SGINDEX::unlinkRefNode ( const SGNODE aNode)
overridevirtualnoexcept

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.

102{
103 // Node should have no children or refs.
104 wxCHECK( false, /* void */ );
105}

◆ WriteCache()

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

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.

263{
264 if( nullptr == parentNode )
265 {
266 wxCHECK( m_Parent, false );
267
268 SGNODE* np = m_Parent;
269
270 while( nullptr != np->GetParent() )
271 np = np->GetParent();
272
273 if( np->WriteCache( aFile, nullptr ) )
274 {
275 m_written = true;
276 return true;
277 }
278
279 return false;
280 }
281
282 wxCHECK( parentNode == m_Parent, false );
283
284 if( !aFile.good() )
285 {
286 wxLogTrace( MASK_3D_SG, wxT( "%s:%s:%d * [INFO] bad stream" ),
287 __FILE__, __FUNCTION__, __LINE__ );
288
289 return false;
290 }
291
292 aFile << "[" << GetName() << "]";
293 size_t npts = index.size();
294 aFile.write( (char*)&npts, sizeof(size_t) );
295
296 for( size_t i = 0; i < npts; ++i )
297 aFile.write( (char*)&index[i], sizeof(int) );
298
299 if( aFile.fail() )
300 return false;
301
302 m_written = true;
303 return true;
304}
virtual bool WriteCache(std::ostream &aFile, SGNODE *parentNode)=0
Write this node's data to a binary cache file.
SGNODE * GetParent(void) const noexcept
Returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie.
Definition: sg_node.cpp:110

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

Referenced by SGFACESET::WriteCache().

◆ writeColorIndex()

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

Definition at line 226 of file sg_index.cpp.

227{
228 aFile << " colorIndex [\n ";
229 return writeIndexList( aFile );
230}
bool writeIndexList(std::ostream &aFile)
Definition: sg_index.cpp:233

References writeIndexList().

Referenced by WriteVRML().

◆ writeCoordIndex()

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

Definition at line 183 of file sg_index.cpp.

184{
185 size_t n = index.size();
186
187 wxCHECK_MSG( n % 3 == 0, false, wxT( "Coordinate index is not divisible by three (violates "
188 "triangle constraint)" ) );
189
190 aFile << " coordIndex [\n ";
191
192 // indices to control formatting
193 int nv0 = 0;
194 int nv1 = 0;
195
196 for( size_t i = 0; i < n; )
197 {
198 aFile << index[i];
199 ++i;
200
201 if( ++nv0 == 3 )
202 {
203 aFile << ",-1";
204 ++nv1;
205 nv0 = 0;
206 }
207
208 if( i < n )
209 {
210 aFile << ",";
211
212 if( nv1 == 8 )
213 {
214 nv1 = 0;
215 aFile << "\n ";
216 }
217 }
218 }
219
220 aFile << "]\n";
221
222 return true;
223}

References index.

Referenced by WriteVRML().

◆ writeIndexList()

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

Definition at line 233 of file sg_index.cpp.

234{
235 // index to control formatting
236 int nv = 0;
237 size_t n = index.size();
238
239 for( size_t i = 0; i < n; )
240 {
241 aFile << index[i];
242 ++i;
243
244 if( i < n )
245 {
246 aFile << ",";
247
248 if( ++nv == 20 )
249 {
250 aFile << "\n ";
251 nv = 0;
252 }
253 }
254 }
255
256 aFile << "]\n";
257
258 return true;
259}

References index.

Referenced by writeColorIndex().

◆ WriteVRML()

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

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.

172{
173 if( index.empty() )
174 return false;
175
177 return writeCoordIndex( aFile );
178
179 return writeColorIndex( aFile );
180}
bool writeCoordIndex(std::ostream &aFile)
Definition: sg_index.cpp:183
bool writeColorIndex(std::ostream &aFile)
Definition: sg_index.cpp:226
@ SGTYPE_COORDINDEX
Definition: sg_types.h:42

References index, SGNODE::m_SGtype, S3D::SGTYPE_COORDINDEX, writeColorIndex(), and 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: