KiCad PCB EDA Suite
WRL2BASE Class Reference

WRL2BASE represents the top node of a VRML2 model. More...

#include <vrml2_base.h>

Inheritance diagram for WRL2BASE:
WRL2NODE

Public Member Functions

bool isDangling (void) override
 Function isDangling returns true if the object does not have a parent which is a logical container for the object - for example if a Shape has a parent which is a Base node. More...
 
 WRL2BASE ()
 
virtual ~WRL2BASE ()
 
void SetEnableInline (bool enable)
 
bool GetEnableInline (void)
 
SGNODEGetInlineData (const std::string &aName)
 
bool Read (WRLPROC &proc)
 
bool ReadNode (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
virtual std::string GetName (void) override
 
virtual bool SetName (const std::string &aName) override
 
bool Read (WRLPROC &proc, WRL2BASE *aTopNode) override
 
bool SetParent (WRL2NODE *aParent, bool doUnlink=true) override
 Function SetParent sets the parent WRL2NODE of this object. More...
 
SGNODETranslateToSG (SGNODE *aParent) override
 Function TranslateToSG produces a representation of the data using the intermediate scenegraph structures of the kicad_3dsg library. More...
 
WRL2NODES getNodeTypeID (const std::string &aNodeName)
 Function getNodeTypeID returns the ID based on the given aNodeName or WRL2_INVALID (WRL2_END) if no such node name exists. More...
 
virtual void unlinkChildNode (const WRL2NODE *aNode)
 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 WRL2NODE *aNode)
 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 (WRL2NODE *aNode)
 Function addNodeRef adds a pointer to a node which references, but does not own, this node. More...
 
void delNodeRef (WRL2NODE *aNode)
 Function delNodeRef removes a pointer to a node which references, but does not own, this node. More...
 
WRL2NODES GetNodeType (void) const
 Function GetNodeType returns the type of this node instance. More...
 
WRL2NODEGetParent (void) const
 Function GetParent returns a pointer to the parent SGNODE of this object or NULL if the object has no parent (ie. More...
 
const char * GetNodeTypeName (WRL2NODES aNodeType) const
 
virtual WRL2NODEFindNode (const std::string &aNodeName, const WRL2NODE *aCaller)
 Function FindNode searches the tree of linked nodes and returns a reference to the first node found with the given name. More...
 
virtual bool AddChildNode (WRL2NODE *aNode)
 
virtual bool AddRefNode (WRL2NODE *aNode)
 
std::string GetError (void)
 

Protected Attributes

WRL2NODEm_Parent
 
WRL2NODES m_Type
 
std::string m_Name
 
std::list< WRL2NODE * > m_BackPointers
 
std::list< WRL2NODE * > m_Children
 
std::list< WRL2NODE * > m_Refs
 
std::string m_error
 
SGNODEm_sgNode
 

Private Member Functions

bool implementUse (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool implementDef (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readTransform (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readShape (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readAppearance (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readMaterial (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readFaceSet (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readLineSet (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readPointSet (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readCoords (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readNorms (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readColor (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readBox (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readSwitch (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 
bool readInline (WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
 

Private Attributes

bool m_useInline
 
std::string m_dir
 
std::map< std::string, SGNODE * > m_inlineModels
 

Detailed Description

WRL2BASE represents the top node of a VRML2 model.

Definition at line 59 of file vrml2_base.h.

Constructor & Destructor Documentation

◆ WRL2BASE()

WRL2BASE::WRL2BASE ( )

Definition at line 50 of file vrml2_base.cpp.

50  : WRL2NODE()
51 {
52  m_useInline = false;
53  m_Type = WRL2_BASE;
54  return;
55 }
WRL2NODES m_Type
Definition: vrml2_node.h:62
bool m_useInline
Definition: vrml2_base.h:62

References WRL2NODE::m_Type, m_useInline, and WRL2_BASE.

◆ ~WRL2BASE()

WRL2BASE::~WRL2BASE ( )
virtual

Definition at line 58 of file vrml2_base.cpp.

59 {
60  std::map< std::string, SGNODE* >::iterator iS = m_inlineModels.begin();
61  std::map< std::string, SGNODE* >::iterator eS = m_inlineModels.end();
62 
63  while( iS != eS )
64  {
65  SGNODE* np = iS->second;
66 
67  // destroy any orphaned Inline{} node data
68  if( np && NULL == S3D::GetSGNodeParent( np ) )
69  S3D::DestroyNode( np );
70 
71  ++iS;
72  }
73 
74  m_inlineModels.clear();
75 
76  return;
77 }
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:210
#define NULL
std::map< std::string, SGNODE * > m_inlineModels
Definition: vrml2_base.h:83

References S3D::DestroyNode(), S3D::GetSGNodeParent(), m_inlineModels, and NULL.

Member Function Documentation

◆ AddChildNode()

bool WRL2NODE::AddChildNode ( WRL2NODE aNode)
virtualinherited

Reimplemented in WRL2FACESET, WRL2LINESET, WRL2POINTSET, WRL2APPEARANCE, WRL2SHAPE, WRL2MATERIAL, WRL2INLINE, WRL2COLOR, WRL2COORDS, WRL2NORMS, and WRL2BOX.

Definition at line 377 of file vrml2_node.cpp.

378 {
379  if( aNode == NULL )
380  return false;
381 
382  if( aNode->GetNodeType() == WRL2_BASE )
383  {
384  #ifdef DEBUG_VRML2
385  do {
386  std::ostringstream ostr;
387  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
388  ostr << " * [BUG] attempting to add a base node to another node";
389  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
390  } while( 0 );
391  #endif
392 
393  return false;
394  }
395 
396  std::list< WRL2NODE* >::iterator sC = m_Children.begin();
397  std::list< WRL2NODE* >::iterator eC = m_Children.end();
398 
399  while( sC != eC )
400  {
401  if( *sC == aNode )
402  return false;
403 
404  ++sC;
405  }
406 
407  m_Children.push_back( aNode );
408 
409  if( aNode->GetParent() != this )
410  aNode->SetParent( this );
411 
412  return true;
413 }
virtual bool SetParent(WRL2NODE *aParent, bool doUnlink=true)
Function SetParent sets the parent WRL2NODE of this object.
Definition: vrml2_node.cpp:360
std::list< WRL2NODE * > m_Children
Definition: vrml2_node.h:66
#define MASK_VRML
Definition: wrltypes.h:37
#define NULL
WRL2NODES GetNodeType(void) const
Function GetNodeType returns the type of this node instance.
Definition: vrml2_node.cpp:212
WRL2NODE * GetParent(void) const
Function GetParent returns a pointer to the parent SGNODE of this object or NULL if the object has no...
Definition: vrml2_node.cpp:218

References WRL2NODE::GetNodeType(), WRL2NODE::GetParent(), WRL2NODE::m_Children, MASK_VRML, NULL, WRL2NODE::SetParent(), and WRL2_BASE.

Referenced by WRL2SHAPE::AddChildNode(), WRL2APPEARANCE::AddChildNode(), WRL2POINTSET::AddChildNode(), WRL2LINESET::AddChildNode(), WRL2FACESET::AddChildNode(), WRL2SWITCH::AddRefNode(), WRL2TRANSFORM::AddRefNode(), WRL2NODE::SetParent(), WRL2APPEARANCE::WRL2APPEARANCE(), WRL2BOX::WRL2BOX(), WRL2COLOR::WRL2COLOR(), WRL2COORDS::WRL2COORDS(), WRL2FACESET::WRL2FACESET(), WRL2INLINE::WRL2INLINE(), WRL2LINESET::WRL2LINESET(), WRL2MATERIAL::WRL2MATERIAL(), WRL2NORMS::WRL2NORMS(), WRL2POINTSET::WRL2POINTSET(), WRL2SHAPE::WRL2SHAPE(), WRL2SWITCH::WRL2SWITCH(), and WRL2TRANSFORM::WRL2TRANSFORM().

◆ addNodeRef()

void WRL2NODE::addNodeRef ( WRL2NODE aNode)
inherited

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

Parameters
aNodeis the node holding a reference to this object

Definition at line 170 of file vrml2_node.cpp.

171 {
172  // the parent node must never be added as a backpointer
173  if( aNode == m_Parent )
174  return;
175 
176  std::list< WRL2NODE* >::iterator np =
177  std::find( m_BackPointers.begin(), m_BackPointers.end(), aNode );
178 
179  if( np != m_BackPointers.end() )
180  return;
181 
182  m_BackPointers.push_back( aNode );
183 
184  return;
185 }
WRL2NODE * m_Parent
Definition: vrml2_node.h:61
std::list< WRL2NODE * > m_BackPointers
Definition: vrml2_node.h:65

References WRL2NODE::m_BackPointers, and WRL2NODE::m_Parent.

Referenced by WRL2NODE::AddRefNode().

◆ AddRefNode()

bool WRL2NODE::AddRefNode ( WRL2NODE aNode)
virtualinherited

Reimplemented in WRL2FACESET, WRL2LINESET, WRL2POINTSET, WRL2APPEARANCE, WRL2SHAPE, WRL2TRANSFORM, WRL2MATERIAL, WRL2INLINE, WRL2SWITCH, WRL2COLOR, WRL2COORDS, WRL2NORMS, and WRL2BOX.

Definition at line 416 of file vrml2_node.cpp.

417 {
418  if( NULL == aNode )
419  {
420  #ifdef DEBUG_VRML2
421  do {
422  std::ostringstream ostr;
423  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
424  ostr << " * [BUG] NULL passed as node pointer";
425  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
426  } while( 0 );
427  #endif
428 
429  return false;
430  }
431 
432  if( aNode->GetNodeType() == WRL2_BASE )
433  {
434  #ifdef DEBUG_VRML2
435  do {
436  std::ostringstream ostr;
437  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
438  ostr << " * [BUG] attempting to add a base node ref to another base node";
439  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
440  } while( 0 );
441  #endif
442 
443  return false;
444  }
445 
446  std::list< WRL2NODE* >::iterator sR = m_Refs.begin();
447  std::list< WRL2NODE* >::iterator eR = m_Refs.end();
448 
449  while( sR != eR )
450  {
451  if( *sR == aNode )
452  return true;
453 
454  ++sR;
455  }
456 
457  m_Refs.push_back( aNode );
458  aNode->addNodeRef( this );
459 
460  return true;
461 }
void addNodeRef(WRL2NODE *aNode)
Function addNodeRef adds a pointer to a node which references, but does not own, this node.
Definition: vrml2_node.cpp:170
#define MASK_VRML
Definition: wrltypes.h:37
std::list< WRL2NODE * > m_Refs
Definition: vrml2_node.h:67
#define NULL
WRL2NODES GetNodeType(void) const
Function GetNodeType returns the type of this node instance.
Definition: vrml2_node.cpp:212

References WRL2NODE::addNodeRef(), WRL2NODE::GetNodeType(), WRL2NODE::m_Refs, MASK_VRML, NULL, and WRL2_BASE.

Referenced by WRL2SWITCH::AddRefNode(), WRL2TRANSFORM::AddRefNode(), WRL2SHAPE::AddRefNode(), WRL2APPEARANCE::AddRefNode(), WRL2POINTSET::AddRefNode(), WRL2LINESET::AddRefNode(), WRL2FACESET::AddRefNode(), and implementUse().

◆ delNodeRef()

void WRL2NODE::delNodeRef ( WRL2NODE aNode)
inherited

Function delNodeRef removes a pointer to a node which references, but does not own, this node.

Parameters
aNodeis the node holding a reference to this object

Definition at line 188 of file vrml2_node.cpp.

189 {
190  std::list< WRL2NODE* >::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  #ifdef DEBUG_VRML2
200  do {
201  std::ostringstream ostr;
202  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
203  ostr << " * [BUG] delNodeRef() did not find its target";
204  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
205  } while( 0 );
206  #endif
207 
208  return;
209 }
#define MASK_VRML
Definition: wrltypes.h:37
std::list< WRL2NODE * > m_BackPointers
Definition: vrml2_node.h:65

References WRL2NODE::m_BackPointers, and MASK_VRML.

◆ FindNode()

WRL2NODE * WRL2NODE::FindNode ( const std::string &  aNodeName,
const WRL2NODE aCaller 
)
virtualinherited

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().

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

Definition at line 327 of file vrml2_node.cpp.

328 {
329  if( aNodeName.empty() )
330  return NULL;
331 
332  if( !m_Name.compare( aNodeName ) )
333  return this;
334 
335  std::list< WRL2NODE* >::iterator sLA = m_Children.begin();
336  std::list< WRL2NODE* >::iterator eLA = m_Children.end();
337 
338  WRL2NODE* psg = NULL;
339 
340  while( sLA != eLA )
341  {
342  if( *sLA != aCaller )
343  {
344  psg = (*sLA)->FindNode( aNodeName, this );
345 
346  if( NULL != psg)
347  return psg;
348 
349  }
350  ++sLA;
351  }
352 
353  if( NULL != m_Parent && aCaller != m_Parent )
354  return m_Parent->FindNode( aNodeName, this );
355 
356  return NULL;
357 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
std::list< WRL2NODE * > m_Children
Definition: vrml2_node.h:66
std::string m_Name
Definition: vrml2_node.h:63
#define NULL
WRL2NODE * m_Parent
Definition: vrml2_node.h:61
virtual WRL2NODE * FindNode(const std::string &aNodeName, const WRL2NODE *aCaller)
Function FindNode searches the tree of linked nodes and returns a reference to the first node found w...
Definition: vrml2_node.cpp:327

References WRL2NODE::FindNode(), WRL2NODE::m_Children, WRL2NODE::m_Name, WRL2NODE::m_Parent, and NULL.

Referenced by WRL2NODE::FindNode(), and implementUse().

◆ GetEnableInline()

bool WRL2BASE::GetEnableInline ( void  )

Definition at line 103 of file vrml2_base.cpp.

104 {
105  return m_useInline;
106 }
bool m_useInline
Definition: vrml2_base.h:62

References m_useInline.

◆ GetError()

std::string WRL2NODE::GetError ( void  )
inherited

Definition at line 321 of file vrml2_node.cpp.

322 {
323  return m_error;
324 }
std::string m_error
Definition: vrml2_node.h:68

References WRL2NODE::m_error.

◆ GetInlineData()

SGNODE * WRL2BASE::GetInlineData ( const std::string &  aName)

Definition at line 109 of file vrml2_base.cpp.

110 {
111  if( aName.empty() )
112  return NULL;
113 
114  std::map< std::string, SGNODE* >::iterator dp = m_inlineModels.find( aName );
115 
116  if( dp != m_inlineModels.end() )
117  return dp->second;
118 
119  wxString tname;
120 
121  if( aName.compare( 0, 7, "file://" ) == 0 )
122  {
123  if( aName.length() <= 7 )
124  return NULL;
125 
126  tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
127  }
128  else
129  {
130  tname = wxString::FromUTF8Unchecked( aName.c_str() );
131  }
132 
133  wxFileName fn;
134  fn.Assign( tname );
135 
136  if( fn.IsRelative() && !m_dir.empty() )
137  {
138  wxString fname = wxString::FromUTF8Unchecked( m_dir.c_str() );
139  fname.append( tname );
140  fn.Assign( fname );
141  }
142 
143  if( !fn.Normalize() )
144  {
145  m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
146  return NULL;
147  }
148 
149  SCENEGRAPH* sp = LoadVRML( fn.GetFullPath(), false );
150 
151  if( NULL == sp )
152  {
153  m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, NULL ) );
154  return NULL;
155  }
156 
157  m_inlineModels.insert( std::pair< std::string, SGNODE* >( aName, (SGNODE*)sp ) );
158 
159  return (SGNODE*)sp;
160 }
SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
#define NULL
std::map< std::string, SGNODE * > m_inlineModels
Definition: vrml2_base.h:83
SCENEGRAPH * LoadVRML(const wxString &aFileName, bool useInline)
Definition: vrml.cpp:161
std::string m_dir
Definition: vrml2_base.h:63

References LoadVRML(), m_dir, m_inlineModels, and NULL.

Referenced by WRL2INLINE::TranslateToSG().

◆ GetName()

std::string WRL2BASE::GetName ( void  )
overridevirtual

Reimplemented from WRL2NODE.

Definition at line 163 of file vrml2_base.cpp.

164 {
165  #ifdef DEBUG_VRML2
166  do {
167  std::ostringstream ostr;
168  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
169  ostr << " * [BUG] attempting to extract name from virtual base node";
170  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
171  } while( 0 );
172  #endif
173 
174  return std::string( "" );
175 }
#define MASK_VRML
Definition: wrltypes.h:37

References MASK_VRML.

◆ GetNodeType()

◆ getNodeTypeID()

WRL2NODES WRL2NODE::getNodeTypeID ( const std::string &  aNodeName)
inherited

Function getNodeTypeID returns the ID based on the given aNodeName or WRL2_INVALID (WRL2_END) if no such node name exists.

Definition at line 310 of file vrml2_node.cpp.

311 {
312  NODEMAP::iterator it = nodenames.find( aNodeName );
313 
314  if( nodenames.end() != it )
315  return it->second;
316 
317  return WRL2_INVALID;
318 }
static NODEMAP nodenames
Definition: vrml2_node.cpp:42

References nodenames, and WRL2_INVALID.

Referenced by ReadNode().

◆ GetNodeTypeName()

const char * WRL2NODE::GetNodeTypeName ( WRL2NODES  aNodeType) const
inherited

Definition at line 295 of file vrml2_node.cpp.

296 {
297  if( aNodeType < WRL2_BASE || aNodeType >= WRL2_END )
298  return "*INVALID_TYPE*";
299 
300  if( aNodeType == WRL2_BASE )
301  return "*VIRTUAL_BASE*";
302 
303  NODEMAP::iterator it = nodenames.begin();
304  advance( it, (aNodeType - WRL2_BEGIN) );
305 
306  return it->first.c_str();
307 }
static NODEMAP nodenames
Definition: vrml2_node.cpp:42

References nodenames, WRL2_BASE, WRL2_BEGIN, and WRL2_END.

Referenced by WRL2SHAPE::AddChildNode(), WRL2APPEARANCE::AddChildNode(), WRL2POINTSET::AddChildNode(), WRL2LINESET::AddChildNode(), WRL2FACESET::AddChildNode(), WRL2SHAPE::AddRefNode(), WRL2APPEARANCE::AddRefNode(), WRL2POINTSET::AddRefNode(), WRL2LINESET::AddRefNode(), WRL2FACESET::AddRefNode(), and implementUse().

◆ GetParent()

WRL2NODE * WRL2NODE::GetParent ( void  ) const
inherited

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 218 of file vrml2_node.cpp.

219 {
220  return m_Parent;
221 }
WRL2NODE * m_Parent
Definition: vrml2_node.h:61

References WRL2NODE::m_Parent.

Referenced by WRL2NODE::AddChildNode(), WRL2SWITCH::AddRefNode(), WRL2TRANSFORM::AddRefNode(), WRL2APPEARANCE::unlinkChildNode(), WRL2POINTSET::unlinkChildNode(), WRL2LINESET::unlinkChildNode(), WRL2FACESET::unlinkChildNode(), WRL2APPEARANCE::unlinkRefNode(), WRL2POINTSET::unlinkRefNode(), WRL2LINESET::unlinkRefNode(), and WRL2FACESET::unlinkRefNode().

◆ implementDef()

bool WRL2BASE::implementDef ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 303 of file vrml2_base.cpp.

304 {
305  if( NULL != aNode )
306  *aNode = NULL;
307 
308  if( NULL == aParent )
309  {
310  #ifdef DEBUG_VRML2
311  do {
312  std::ostringstream ostr;
313  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
314  ostr << " * [BUG] invalid parent pointer (NULL)";
315  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
316  } while( 0 );
317  #endif
318 
319  return false;
320  }
321 
322  std::string glob;
323  WRL2NODE* lnode = NULL;
324 
325  if( !proc.ReadName( glob ) )
326  {
327  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
328  do {
329  std::ostringstream ostr;
330  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
331  ostr << proc.GetError();
332  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
333  } while( 0 );
334  #endif
335 
336  return false;
337  }
338 
339  size_t line, column;
340  proc.GetFilePosData( line, column );
341 
342  if( ReadNode( proc, aParent, &lnode ) )
343  {
344  if( NULL != aNode )
345  *aNode = lnode;
346 
347  if( lnode && !lnode->SetName( glob ) )
348  {
349  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
350  do {
351  std::ostringstream ostr;
352  size_t line, column;
353  proc.GetFilePosData( line, column );
354  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
355  ostr << " * [INFO] bad formatting (invalid name) at line";
356  ostr << line << ", column " << column;
357  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
358  } while( 0 );
359  #endif
360 
361  return false;
362  }
363 
364  return true;
365  }
366 
367  return false;
368 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
bool GetFilePosData(size_t &line, size_t &column)
Definition: wrlproc.cpp:1951
#define MASK_VRML
Definition: wrltypes.h:37
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:371
virtual bool SetName(const std::string &aName)
Definition: vrml2_node.cpp:230
#define NULL
bool ReadName(std::string &aName)
Definition: wrlproc.cpp:280
std::string GetError(void)
Definition: wrlproc.cpp:1945

References WRLPROC::GetError(), WRLPROC::GetFilePosData(), MASK_VRML, NULL, WRLPROC::ReadName(), ReadNode(), and WRL2NODE::SetName().

Referenced by ReadNode().

◆ implementUse()

bool WRL2BASE::implementUse ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 228 of file vrml2_base.cpp.

229 {
230  if( NULL != aNode )
231  *aNode = NULL;
232 
233  if( !aParent )
234  {
235  #ifdef DEBUG_VRML2
236  do {
237  std::ostringstream ostr;
238  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
239  ostr << " * [BUG] invoked with NULL parent";
240  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
241  } while( 0 );
242  #endif
243 
244  return false;
245  }
246 
247  std::string glob;
248 
249  if( !proc.ReadName( glob ) )
250  {
251  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
252  do {
253  std::ostringstream ostr;
254  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
255  ostr << proc.GetError();
256  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
257  } while( 0 );
258  #endif
259 
260  return false;
261  }
262 
263  WRL2NODE* ref = aParent->FindNode( glob, NULL );
264 
265  // return 'true' - the file may be defective but it may still be somewhat OK
266  if( NULL == ref )
267  {
268  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
269  do {
270  std::ostringstream ostr;
271  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
272  ostr << " * [INFO] node '" << glob << "' not found";
273  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
274  } while( 0 );
275  #endif
276 
277  return true;
278  }
279 
280  if( !aParent->AddRefNode( ref ) )
281  {
282  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
283  do {
284  std::ostringstream ostr;
285  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
286  ostr << " * [INFO] failed to add node '" << glob << "' (";
287  ostr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type ";
288  ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
289  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
290  } while( 0 );
291  #endif
292 
293  return false;
294  }
295 
296  if( NULL != aNode )
297  *aNode = ref;
298 
299  return true;
300 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define MASK_VRML
Definition: wrltypes.h:37
#define NULL
WRL2NODES GetNodeType(void) const
Function GetNodeType returns the type of this node instance.
Definition: vrml2_node.cpp:212
const char * GetNodeTypeName(WRL2NODES aNodeType) const
Definition: vrml2_node.cpp:295
bool ReadName(std::string &aName)
Definition: wrlproc.cpp:280
std::string GetError(void)
Definition: wrlproc.cpp:1945
virtual bool AddRefNode(WRL2NODE *aNode)
Definition: vrml2_node.cpp:416
virtual WRL2NODE * FindNode(const std::string &aNodeName, const WRL2NODE *aCaller)
Function FindNode searches the tree of linked nodes and returns a reference to the first node found w...
Definition: vrml2_node.cpp:327

References WRL2NODE::AddRefNode(), WRL2NODE::FindNode(), WRLPROC::GetError(), WRL2NODE::GetNodeType(), WRL2NODE::GetNodeTypeName(), MASK_VRML, NULL, and WRLPROC::ReadName().

Referenced by ReadNode().

◆ isDangling()

bool WRL2BASE::isDangling ( void  )
overridevirtual

Function isDangling returns true if the object does not have a parent which is a logical container for the object - for example if a Shape has a parent which is a Base node.

This function is used to determine whether an object should be moved to a different parent during the VRML to SG* translation.

Implements WRL2NODE.

Definition at line 221 of file vrml2_base.cpp.

222 {
223  // the base node is never dangling
224  return false;
225 }

◆ Read() [1/2]

bool WRL2BASE::Read ( WRLPROC proc)

Definition at line 193 of file vrml2_base.cpp.

194 {
195  if( proc.GetVRMLType() != VRML_V2 )
196  {
197  #ifdef DEBUG_VRML2
198  do {
199  std::ostringstream ostr;
200  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
201  ostr << " * [BUG] no open file or file is not a VRML2 file";
202  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
203  } while( 0 );
204  #endif
205 
206  return false;
207  }
208 
209  WRL2NODE* node = NULL;
210  m_dir = proc.GetParentDir();
211 
212  while( ReadNode( proc, this, &node ) && !proc.eof() );
213 
214  if( proc.eof() )
215  return true;
216 
217  return false;
218 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define MASK_VRML
Definition: wrltypes.h:37
WRLVERSION GetVRMLType(void)
Definition: wrlproc.cpp:221
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:371
#define NULL
const char * GetParentDir(void)
Definition: wrlproc.cpp:227
bool eof(void)
Definition: wrlproc.cpp:1939
std::string m_dir
Definition: vrml2_base.h:63

References WRLPROC::eof(), WRLPROC::GetParentDir(), WRLPROC::GetVRMLType(), m_dir, MASK_VRML, NULL, ReadNode(), and VRML_V2.

Referenced by LoadVRML().

◆ Read() [2/2]

bool WRL2BASE::Read ( WRLPROC proc,
WRL2BASE aTopNode 
)
overridevirtual

Implements WRL2NODE.

Definition at line 847 of file vrml2_base.cpp.

848 {
849  // this function makes no sense in the base node
850  #ifdef DEBUG_VRML2
851  do {
852  std::ostringstream ostr;
853  ostr << proc.GetError() << "\n";
854  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
855  ostr << " * [BUG] this method must never be invoked on a WRL2BASE object";
856  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
857  } while( 0 );
858  #endif
859 
860  return false;
861 }
#define MASK_VRML
Definition: wrltypes.h:37
std::string GetError(void)
Definition: wrlproc.cpp:1945

References WRLPROC::GetError(), and MASK_VRML.

◆ readAppearance()

bool WRL2BASE::readAppearance ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 904 of file vrml2_base.cpp.

905 {
906  if( NULL != aNode )
907  *aNode = NULL;
908 
909  WRL2APPEARANCE* np = new WRL2APPEARANCE( aParent );
910 
911  if( !np->Read( proc, this ) )
912  {
913  delete np;
914  return false;
915  }
916 
917  if( NULL != aNode )
918  *aNode = (WRL2NODE*) np;
919 
920  return true;
921 }
WRL2APPEARANCE.
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override

References NULL, and WRL2APPEARANCE::Read().

Referenced by ReadNode().

◆ readBox()

bool WRL2BASE::readBox ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1064 of file vrml2_base.cpp.

1065 {
1066  if( NULL != aNode )
1067  *aNode = NULL;
1068 
1069  WRL2BOX* np = new WRL2BOX( aParent );
1070 
1071  if( !np->Read( proc, this ) )
1072  {
1073  delete np;
1074  return false;
1075  }
1076 
1077  if( NULL != aNode )
1078  *aNode = (WRL2NODE*) np;
1079 
1080  return true;
1081 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
WRL2BOX.
Definition: vrml2_box.h:40
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
Definition: vrml2_box.cpp:81

References NULL, and WRL2BOX::Read().

Referenced by ReadNode().

◆ readColor()

bool WRL2BASE::readColor ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1044 of file vrml2_base.cpp.

1045 {
1046  if( NULL != aNode )
1047  *aNode = NULL;
1048 
1049  WRL2COLOR* np = new WRL2COLOR( aParent );
1050 
1051  if( !np->Read( proc, this ) )
1052  {
1053  delete np;
1054  return false;
1055  }
1056 
1057  if( NULL != aNode )
1058  *aNode = (WRL2NODE*) np;
1059 
1060  return true;
1061 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
WRL2COLOR.
Definition: vrml2_color.h:42
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override

References NULL, and WRL2COLOR::Read().

Referenced by ReadNode().

◆ readCoords()

bool WRL2BASE::readCoords ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1004 of file vrml2_base.cpp.

1005 {
1006  if( NULL != aNode )
1007  *aNode = NULL;
1008 
1009  WRL2COORDS* np = new WRL2COORDS( aParent );
1010 
1011  if( !np->Read( proc, this ) )
1012  {
1013  delete np;
1014  return false;
1015  }
1016 
1017  if( NULL != aNode )
1018  *aNode = (WRL2NODE*) np;
1019 
1020  return true;
1021 }
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2COORDS.
Definition: vrml2_coords.h:42
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL

References NULL, and WRL2COORDS::Read().

Referenced by ReadNode().

◆ readFaceSet()

bool WRL2BASE::readFaceSet ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 944 of file vrml2_base.cpp.

945 {
946  if( NULL != aNode )
947  *aNode = NULL;
948 
949  WRL2FACESET* np = new WRL2FACESET( aParent );
950 
951  if( !np->Read( proc, this ) )
952  {
953  delete np;
954  return false;
955  }
956 
957  if( NULL != aNode )
958  *aNode = (WRL2NODE*) np;
959 
960  return true;
961 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
#define NULL
WRL2FACESET.
Definition: vrml2_faceset.h:42

References NULL, and WRL2FACESET::Read().

Referenced by ReadNode().

◆ readInline()

bool WRL2BASE::readInline ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1104 of file vrml2_base.cpp.

1105 {
1106  if( NULL != aNode )
1107  *aNode = NULL;
1108 
1109  if( !m_useInline )
1110  {
1111  size_t line = 0;
1112  size_t column = 0;
1113  proc.GetFilePosData( line, column );
1114 
1115  if( !proc.DiscardNode() )
1116  {
1117  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
1118  do {
1119  std::ostringstream ostr;
1120  ostr << proc.GetError() << "\n";
1121  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
1122  ostr << " * [INFO] could not discard Inline node at line " << line;
1123  ostr << ", column " << column;
1124  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
1125  } while( 0 );
1126  #endif
1127 
1128  return false;
1129  }
1130 
1131  return true;
1132  }
1133 
1134  WRL2INLINE* np = new WRL2INLINE( aParent );
1135 
1136  if( !np->Read( proc, this ) )
1137  {
1138  delete np;
1139  return false;
1140  }
1141 
1142  if( NULL != aNode )
1143  *aNode = (WRL2NODE*) np;
1144 
1145  return true;
1146 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
bool GetFilePosData(size_t &line, size_t &column)
Definition: wrlproc.cpp:1951
#define MASK_VRML
Definition: wrltypes.h:37
#define NULL
bool DiscardNode(void)
Definition: wrlproc.cpp:359
bool m_useInline
Definition: vrml2_base.h:62
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
std::string GetError(void)
Definition: wrlproc.cpp:1945
WRL2INLINE.
Definition: vrml2_inline.h:40

References WRLPROC::DiscardNode(), WRLPROC::GetError(), WRLPROC::GetFilePosData(), m_useInline, MASK_VRML, NULL, and WRL2INLINE::Read().

Referenced by ReadNode().

◆ readLineSet()

bool WRL2BASE::readLineSet ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 964 of file vrml2_base.cpp.

965 {
966  if( NULL != aNode )
967  *aNode = NULL;
968 
969  WRL2LINESET* np = new WRL2LINESET( aParent );
970 
971  if( !np->Read( proc, this ) )
972  {
973  delete np;
974  return false;
975  }
976 
977  if( NULL != aNode )
978  *aNode = (WRL2NODE*) np;
979 
980  return true;
981 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
WRL2LINESET.
Definition: vrml2_lineset.h:42
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override

References NULL, and WRL2LINESET::Read().

Referenced by ReadNode().

◆ readMaterial()

bool WRL2BASE::readMaterial ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 924 of file vrml2_base.cpp.

925 {
926  if( NULL != aNode )
927  *aNode = NULL;
928 
929  WRL2MATERIAL* np = new WRL2MATERIAL( aParent );
930 
931  if( !np->Read( proc, this ) )
932  {
933  delete np;
934  return false;
935  }
936 
937  if( NULL != aNode )
938  *aNode = (WRL2NODE*) np;
939 
940  return true;
941 }
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
WRL2MATERIAL.

References NULL, and WRL2MATERIAL::Read().

Referenced by ReadNode().

◆ ReadNode()

bool WRL2BASE::ReadNode ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)

Definition at line 371 of file vrml2_base.cpp.

372 {
373  // This function reads a node and stores a pointer to it in aNode.
374  // A value 'true' is returned if a node is successfully read or,
375  // if the node is not supported, successfully discarded. Callers
376  // must always check the value of aNode when the function returns
377  // 'true' since it will be NULL if the node type is not supported.
378 
379  if( NULL != aNode )
380  *aNode = NULL;
381 
382  if( NULL == aParent )
383  {
384  #ifdef DEBUG_VRML2
385  do {
386  std::ostringstream ostr;
387  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
388  ostr << " * [BUG] invalid parent pointer (NULL)";
389  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
390  } while( 0 );
391  #endif
392 
393  return false;
394  }
395 
396  std::string glob;
397  WRL2NODES ntype;
398 
399  if( !proc.ReadName( glob ) )
400  {
401  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
402  if( !proc.eof() )
403  {
404  std::ostringstream ostr;
405  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
406  ostr << proc.GetError();
407  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
408  }
409  #endif
410 
411  return false;
412  }
413 
414  // Process node name:
415  // the names encountered at this point should be one of the
416  // built-in node names or one of:
417  // DEF, USE
418  // PROTO, EXTERNPROTO
419  // ROUTE
420  // any PROTO or EXTERNPROTO defined name
421  // since we do not support PROTO or EXTERNPROTO, any unmatched names are
422  // assumed to be defined via PROTO/EXTERNPROTO and deleted according to
423  // a typical pattern.
424 
425  if( !glob.compare( "USE" ) )
426  {
427  if( !implementUse( proc, aParent, aNode ) )
428  {
429  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
430  do {
431  std::ostringstream ostr;
432  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
433  ostr << proc.GetError();
434  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
435  } while( 0 );
436  #endif
437 
438  return false;
439  }
440 
441  return true;
442  }
443 
444  if( !glob.compare( "DEF" ) )
445  {
446  if( !implementDef( proc, aParent, aNode ) )
447  {
448  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
449  do {
450  std::ostringstream ostr;
451  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
452  ostr << proc.GetError();
453  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
454  } while( 0 );
455  #endif
456 
457  return false;
458  }
459 
460  return true;
461  }
462 
463  // pattern to skip: PROTO name list
464  if( !glob.compare( "PROTO" ) )
465  {
466  if( !proc.ReadName( glob ) || !proc.DiscardList() )
467  {
468  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
469  do {
470  std::ostringstream ostr;
471  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
472  ostr << proc.GetError();
473  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
474  } while( 0 );
475  #endif
476 
477  return false;
478  }
479 
480  return true;
481  }
482 
483  // pattern to skip: EXTERNPROTO name1 name2 list
484  if( !glob.compare( "EXTERNPROTO" ) )
485  {
486  if( !proc.ReadName( glob ) || !proc.ReadName( glob ) || !proc.DiscardList() )
487  {
488  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
489  do {
490  std::ostringstream ostr;
491  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
492  ostr << proc.GetError();
493  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
494  } while( 0 );
495  #endif
496 
497  return false;
498  }
499 
500  return true;
501  }
502 
503  // pattern to skip: ROUTE glob1 glob2 glob3
504  if( !glob.compare( "ROUTE" ) )
505  {
506  if( !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) || !proc.ReadGlob( glob ) )
507  {
508  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
509  do {
510  std::ostringstream ostr;
511  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
512  ostr << proc.GetError();
513  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
514  } while( 0 );
515  #endif
516 
517  return false;
518  }
519 
520  return true;
521  }
522 
523  ntype = getNodeTypeID( glob );
524  size_t line = 0;
525  size_t column = 0;
526  proc.GetFilePosData( line, column );
527 
528  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 2 )
529  do {
530  std::ostringstream ostr;
531  ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
532  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
533  } while( 0 );
534  #endif
535 
536  switch( ntype )
537  {
538  //
539  // items to be implemented:
540  //
541  case WRL2_APPEARANCE:
542 
543  if( !readAppearance( proc, aParent, aNode ) )
544  return false;
545 
546  break;
547 
548  case WRL2_BOX:
549 
550  if( !readBox( proc, aParent, aNode ) )
551  return false;
552 
553  break;
554 
555  case WRL2_COLOR:
556 
557  if( !readColor( proc, aParent, aNode ) )
558  return false;
559 
560  break;
561 
562  case WRL2_CONE:
563  // XXX - IMPLEMENT
564  if( !proc.DiscardNode() )
565  {
566  #ifdef DEBUG_VRML2
567  do {
568  std::ostringstream ostr;
569  ostr << " * [INFO] FAIL: discard " << glob << " node at l";
570  ostr << line << ", c" << column;
571  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
572  } while( 0 );
573  #endif
574 
575  return false;
576  }
577  #ifdef DEBUG_VRML2
578  else
579  {
580  do {
581  std::ostringstream ostr;
582  ostr << " * [INFO] OK: discard " << glob << " node at l";
583  ostr << line << ", c" << column;
584  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
585  } while( 0 );
586  }
587  #endif
588 
589  break;
590 
591  case WRL2_COORDINATE:
592 
593  if( !readCoords( proc, aParent, aNode ) )
594  return false;
595 
596  break;
597 
598  case WRL2_CYLINDER:
599  // XXX - IMPLEMENT
600  if( !proc.DiscardNode() )
601  {
602  #ifdef DEBUG_VRML2
603  do {
604  std::ostringstream ostr;
605  ostr << " * [INFO] FAIL: discard " << glob << " node at l";
606  ostr << line << ", c" << column;
607  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
608  } while( 0 );
609  #endif
610 
611  return false;
612  }
613  #ifdef DEBUG_VRML2
614  else
615  {
616  std::ostringstream ostr;
617  ostr << " * [INFO] OK: discard " << glob << " node at l";
618  ostr << line << ", c" << column;
619  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
620  }
621  #endif
622 
623  break;
624 
625  case WRL2_ELEVATIONGRID:
626  // XXX - IMPLEMENT
627  if( !proc.DiscardNode() )
628  {
629  #ifdef DEBUG_VRML2
630  do {
631  std::ostringstream ostr;
632  ostr << " * [INFO] FAIL: discard " << glob << " node at l";
633  ostr << line << ", c" << column;
634  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
635  } while( 0 );
636  #endif
637 
638  return false;
639  }
640  #ifdef DEBUG_VRML2
641  else
642  {
643  do {
644  std::ostringstream ostr;
645  ostr << " * [INFO] OK: discard " << glob << " node at l";
646  ostr << line << ", c" << column;
647  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
648  } while( 0 );
649  }
650  #endif
651 
652  break;
653 
654  case WRL2_EXTRUSION:
655  // XXX - IMPLEMENT
656  if( !proc.DiscardNode() )
657  {
658  #ifdef DEBUG_VRML2
659  do {
660  std::ostringstream ostr;
661  ostr << " * [INFO] FAIL: discard " << glob << " node at l";
662  ostr << line << ", c" << column;
663  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
664  } while( 0 );
665  #endif
666 
667  return false;
668  }
669  #ifdef DEBUG_VRML2
670  else
671  {
672  std::ostringstream ostr;
673  ostr << " * [INFO] OK: discard " << glob << " node at l";
674  ostr << line << ", c" << column;
675  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
676  }
677  #endif
678 
679  break;
680 
681  case WRL2_INDEXEDFACESET:
682 
683  if( !readFaceSet( proc, aParent, aNode ) )
684  return false;
685 
686  break;
687 
688  case WRL2_INDEXEDLINESET:
689 
690  if( !readLineSet( proc, aParent, aNode ) )
691  return false;
692 
693  break;
694 
695  case WRL2_POINTSET:
696 
697  if( !readPointSet( proc, aParent, aNode ) )
698  return false;
699 
700  break;
701 
702  case WRL2_MATERIAL:
703 
704  if( !readMaterial( proc, aParent, aNode ) )
705  return false;
706 
707  break;
708 
709  case WRL2_NORMAL:
710 
711  if( !readNorms( proc, aParent, aNode ) )
712  return false;
713 
714  break;
715 
716  case WRL2_SHAPE:
717 
718  if( !readShape( proc, aParent, aNode ) )
719  return false;
720 
721  break;
722 
723  case WRL2_SPHERE:
724  // XXX - IMPLEMENT
725  if( !proc.DiscardNode() )
726  {
727  #ifdef DEBUG_VRML2
728  do {
729  std::ostringstream ostr;
730  ostr << " * [INFO] FAIL: discard " << glob << " node at l";
731  ostr << line << ", c" << column;
732  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
733  } while( 0 );
734  #endif
735 
736  return false;
737  }
738  #ifdef DEBUG_VRML2
739  else
740  {
741  std::ostringstream ostr;
742  ostr << " * [INFO] OK: discard " << glob << " node at l";
743  ostr << line << ", c" << column;
744  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
745  }
746  #endif
747 
748  break;
749 
750  case WRL2_SWITCH:
751 
752  if( !readSwitch( proc, aParent, aNode ) )
753  return false;
754 
755  break;
756 
757  case WRL2_TRANSFORM:
758  case WRL2_GROUP:
759 
760  if( !readTransform( proc, aParent, aNode ) )
761  return false;
762 
763  break;
764 
765  case WRL2_INLINE:
766 
767  if( !readInline( proc, aParent, aNode ) )
768  return false;
769 
770  break;
771 
772  //
773  // items not implemented or for optional future implementation:
774  //
775  case WRL2_ANCHOR:
776  case WRL2_AUDIOCLIP:
777  case WRL2_BACKGROUND:
778  case WRL2_BILLBOARD:
779  case WRL2_COLLISION:
782  case WRL2_CYLINDERSENSOR:
784  case WRL2_FOG:
785  case WRL2_FONTSTYLE:
786  case WRL2_IMAGETEXTURE:
787  case WRL2_LOD:
788  case WRL2_MOVIETEXTURE:
789  case WRL2_NAVIGATIONINFO:
792  case WRL2_PIXELTEXTURE:
793  case WRL2_PLANESENSOR:
794  case WRL2_POINTLIGHT:
798  case WRL2_SCRIPT:
799  case WRL2_SOUND:
800  case WRL2_SPHERESENSOR:
801  case WRL2_SPOTLIGHT:
802  case WRL2_TEXT:
805  case WRL2_TIMESENSOR:
806  case WRL2_TOUCHSENSOR:
807  case WRL2_VIEWPOINT:
809  case WRL2_WORLDINFO:
810  case WRL2_INVALID:
811  default:
812 
813  proc.GetFilePosData( line, column );
814 
815  if( !proc.DiscardNode() )
816  {
817  #if defined( DEBUG_VRML2 ) && ( DEBUG_VRML2 > 1 )
818  do {
819  std::ostringstream ostr;
820  ostr << proc.GetError() << "\n";
821  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
822  ostr << " * [INFO] could not discard node at line " << line;
823  ostr << ", column " << column;
824  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
825  } while( 0 );
826  #endif
827 
828  return false;
829  }
830  #ifdef DEBUG_VRML2
831  else
832  {
833  std::ostringstream ostr;
834  ostr << " * [INFO] OK: discard unsupported " << glob << " node at l";
835  ostr << line << ", c" << column;
836  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
837  }
838  #endif
839 
840  break;
841  }
842 
843  return true;
844 }
bool implementDef(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:303
bool readShape(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:884
bool readMaterial(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:924
bool GetFilePosData(size_t &line, size_t &column)
Definition: wrlproc.cpp:1951
bool readLineSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:964
bool readCoords(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
#define MASK_VRML
Definition: wrltypes.h:37
bool readAppearance(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:904
WRL2NODES getNodeTypeID(const std::string &aNodeName)
Function getNodeTypeID returns the ID based on the given aNodeName or WRL2_INVALID (WRL2_END) if no s...
Definition: vrml2_node.cpp:310
bool ReadGlob(std::string &aGlob)
Definition: wrlproc.cpp:236
#define NULL
bool readColor(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool DiscardNode(void)
Definition: wrlproc.cpp:359
bool readFaceSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:944
bool ReadName(std::string &aName)
Definition: wrlproc.cpp:280
bool readTransform(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:864
WRL2NODES
Definition: wrltypes.h:121
bool readSwitch(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readNorms(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
std::string GetError(void)
Definition: wrlproc.cpp:1945
bool readBox(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool DiscardList(void)
Definition: wrlproc.cpp:482
bool readPointSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:984
bool eof(void)
Definition: wrlproc.cpp:1939
bool readInline(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool implementUse(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:228

References WRLPROC::DiscardList(), WRLPROC::DiscardNode(), WRLPROC::eof(), WRLPROC::GetError(), WRLPROC::GetFilePosData(), WRL2NODE::getNodeTypeID(), implementDef(), implementUse(), MASK_VRML, NULL, readAppearance(), readBox(), readColor(), readCoords(), readFaceSet(), WRLPROC::ReadGlob(), readInline(), readLineSet(), readMaterial(), WRLPROC::ReadName(), readNorms(), readPointSet(), readShape(), readSwitch(), readTransform(), WRL2_ANCHOR, WRL2_APPEARANCE, WRL2_AUDIOCLIP, WRL2_BACKGROUND, WRL2_BILLBOARD, WRL2_BOX, WRL2_COLLISION, WRL2_COLOR, WRL2_COLORINTERPOLATOR, WRL2_CONE, WRL2_COORDINATE, WRL2_COORDINATEINTERPOLATOR, WRL2_CYLINDER, WRL2_CYLINDERSENSOR, WRL2_DIRECTIONALLIGHT, WRL2_ELEVATIONGRID, WRL2_EXTRUSION, WRL2_FOG, WRL2_FONTSTYLE, WRL2_GROUP, WRL2_IMAGETEXTURE, WRL2_INDEXEDFACESET, WRL2_INDEXEDLINESET, WRL2_INLINE, WRL2_INVALID, WRL2_LOD, WRL2_MATERIAL, WRL2_MOVIETEXTURE, WRL2_NAVIGATIONINFO, WRL2_NORMAL, WRL2_NORMALINTERPOLATOR, WRL2_ORIENTATIONINTERPOLATOR, WRL2_PIXELTEXTURE, WRL2_PLANESENSOR, WRL2_POINTLIGHT, WRL2_POINTSET, WRL2_POSITIONINTERPOLATOR, WRL2_PROXIMITYSENSOR, WRL2_SCALARINTERPOLATOR, WRL2_SCRIPT, WRL2_SHAPE, WRL2_SOUND, WRL2_SPHERE, WRL2_SPHERESENSOR, WRL2_SPOTLIGHT, WRL2_SWITCH, WRL2_TEXT, WRL2_TEXTURECOORDINATE, WRL2_TEXTURETRANSFORM, WRL2_TIMESENSOR, WRL2_TOUCHSENSOR, WRL2_TRANSFORM, WRL2_VIEWPOINT, WRL2_VISIBILITYSENSOR, and WRL2_WORLDINFO.

Referenced by implementDef(), WRL2SHAPE::Read(), WRL2APPEARANCE::Read(), WRL2POINTSET::Read(), WRL2LINESET::Read(), WRL2FACESET::Read(), Read(), WRL2SWITCH::readChildren(), and WRL2TRANSFORM::readChildren().

◆ readNorms()

bool WRL2BASE::readNorms ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1024 of file vrml2_base.cpp.

1025 {
1026  if( NULL != aNode )
1027  *aNode = NULL;
1028 
1029  WRL2NORMS* np = new WRL2NORMS( aParent );
1030 
1031  if( !np->Read( proc, this ) )
1032  {
1033  delete np;
1034  return false;
1035  }
1036 
1037  if( NULL != aNode )
1038  *aNode = (WRL2NODE*) np;
1039 
1040  return true;
1041 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
#define NULL
WRL2NORMS.
Definition: vrml2_norms.h:42

References NULL, and WRL2NORMS::Read().

Referenced by ReadNode().

◆ readPointSet()

bool WRL2BASE::readPointSet ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 984 of file vrml2_base.cpp.

985 {
986  if( NULL != aNode )
987  *aNode = NULL;
988 
989  WRL2POINTSET* np = new WRL2POINTSET( aParent );
990 
991  if( !np->Read( proc, this ) )
992  {
993  delete np;
994  return false;
995  }
996 
997  if( NULL != aNode )
998  *aNode = (WRL2NODE*) np;
999 
1000  return true;
1001 }
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
WRL2POINTSET.

References NULL, and WRL2POINTSET::Read().

Referenced by ReadNode().

◆ readShape()

bool WRL2BASE::readShape ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 884 of file vrml2_base.cpp.

885 {
886  if( NULL != aNode )
887  *aNode = NULL;
888 
889  WRL2SHAPE* np = new WRL2SHAPE( aParent );
890 
891  if( !np->Read( proc, this ) )
892  {
893  delete np;
894  return false;
895  }
896 
897  if( NULL != aNode )
898  *aNode = (WRL2NODE*) np;
899 
900  return true;
901 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
WRL2SHAPE.
Definition: vrml2_shape.h:40
#define NULL
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override

References NULL, and WRL2SHAPE::Read().

Referenced by ReadNode().

◆ readSwitch()

bool WRL2BASE::readSwitch ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 1084 of file vrml2_base.cpp.

1085 {
1086  if( NULL != aNode )
1087  *aNode = NULL;
1088 
1089  WRL2SWITCH* np = new WRL2SWITCH( aParent );
1090 
1091  if( !np->Read( proc, this ) )
1092  {
1093  delete np;
1094  return false;
1095  }
1096 
1097  if( NULL != aNode )
1098  *aNode = (WRL2NODE*) np;
1099 
1100  return true;
1101 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2SWITCH.
Definition: vrml2_switch.h:40

References NULL, and WRL2SWITCH::Read().

Referenced by ReadNode().

◆ readTransform()

bool WRL2BASE::readTransform ( WRLPROC proc,
WRL2NODE aParent,
WRL2NODE **  aNode 
)
private

Definition at line 864 of file vrml2_base.cpp.

865 {
866  if( NULL != aNode )
867  *aNode = NULL;
868 
869  WRL2TRANSFORM* np = new WRL2TRANSFORM( aParent );
870 
871  if( !np->Read( proc, this ) )
872  {
873  delete np;
874  return false;
875  }
876 
877  if( NULL != aNode )
878  *aNode = (WRL2NODE*) np;
879 
880  return true;
881 }
WRL2NODE represents the base class of all VRML2 nodes.
Definition: vrml2_node.h:58
#define NULL
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2TRANSFORM.

References NULL, and WRL2TRANSFORM::Read().

Referenced by ReadNode().

◆ SetEnableInline()

void WRL2BASE::SetEnableInline ( bool  enable)

Definition at line 96 of file vrml2_base.cpp.

97 {
98  m_useInline = enable;
99  return;
100 }
bool m_useInline
Definition: vrml2_base.h:62

References m_useInline.

Referenced by LoadVRML().

◆ SetName()

bool WRL2BASE::SetName ( const std::string &  aName)
overridevirtual

Reimplemented from WRL2NODE.

Definition at line 178 of file vrml2_base.cpp.

179 {
180  #ifdef DEBUG_VRML2
181  do {
182  std::ostringstream ostr;
183  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
184  ostr << " * [BUG] attempting to set name on virtual base node";
185  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
186  } while( 0 );
187  #endif
188 
189  return false;
190 }
#define MASK_VRML
Definition: wrltypes.h:37

References MASK_VRML.

◆ SetParent()

bool WRL2BASE::SetParent ( WRL2NODE aParent,
bool  doUnlink = true 
)
overridevirtual

Function SetParent sets the parent WRL2NODE of this object.

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

Reimplemented from WRL2NODE.

Definition at line 81 of file vrml2_base.cpp.

82 {
83  #ifdef DEBUG_VRML2
84  do {
85  std::ostringstream ostr;
86  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
87  ostr << " * [BUG] attempting to set parent on WRL2BASE node";
88  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
89  } while( 0 );
90  #endif
91 
92  return false;
93 }
#define MASK_VRML
Definition: wrltypes.h:37

References MASK_VRML.

◆ TranslateToSG()

SGNODE * WRL2BASE::TranslateToSG ( SGNODE aParent)
overridevirtual

Function TranslateToSG produces a representation of the data using the intermediate scenegraph structures of the kicad_3dsg library.

Parameters
aParentis a pointer to the parent SG node
Returns
is non-NULL on success

Implements WRL2NODE.

Definition at line 1149 of file vrml2_base.cpp.

1150 {
1151  if( m_Children.empty() )
1152  return NULL;
1153 
1154  S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
1155 
1156  if( NULL != aParent && ptype != S3D::SGTYPE_SHAPE )
1157  {
1158  #ifdef DEBUG_VRML2
1159  do {
1160  std::ostringstream ostr;
1161  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
1162  ostr << " * [BUG] WRL2BASE does not have a Transform parent (parent ID: ";
1163  ostr << ptype << ")";
1164  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
1165  } while( 0 );
1166  #endif
1167 
1168  return NULL;
1169  }
1170 
1171  if( m_sgNode )
1172  {
1173  if( NULL != aParent )
1174  {
1176  && !S3D::AddSGNodeChild( aParent, m_sgNode ) )
1177  {
1178  return NULL;
1179  }
1180  else if( aParent != S3D::GetSGNodeParent( m_sgNode )
1181  && !S3D::AddSGNodeRef( aParent, m_sgNode ) )
1182  {
1183  return NULL;
1184  }
1185  }
1186 
1187  return m_sgNode;
1188  }
1189 
1190  IFSG_TRANSFORM topNode( aParent );
1191 
1192  std::list< WRL2NODE* >::iterator sC = m_Children.begin();
1193  std::list< WRL2NODE* >::iterator eC = m_Children.end();
1194  WRL2NODES type;
1195 
1196  // Include only Shape and Transform nodes in the top node
1197  bool test = false; // set to true if there are any subnodes for display
1198 
1199  while( sC != eC )
1200  {
1201  type = (*sC)->GetNodeType();
1202 
1203  switch( type )
1204  {
1205  case WRL2_SHAPE:
1206  // wrap the shape in a transform
1207  do
1208  {
1209  IFSG_TRANSFORM wrapper( topNode.GetRawPtr() );
1210  SGNODE* pshape = (*sC)->TranslateToSG( wrapper.GetRawPtr() );
1211 
1212  if( NULL != pshape )
1213  test = true;
1214  else
1215  wrapper.Destroy();
1216 
1217  } while( 0 );
1218 
1219  break;
1220 
1221  case WRL2_TRANSFORM:
1222  case WRL2_SWITCH:
1223  case WRL2_INLINE:
1224 
1225  if( NULL != (*sC)->TranslateToSG( topNode.GetRawPtr() ) )
1226  test = true;
1227 
1228  break;
1229 
1230  default:
1231  break;
1232  }
1233 
1234  ++ sC;
1235  }
1236 
1237  if( false == test )
1238  {
1239  topNode.Destroy();
1240  return NULL;
1241  }
1242 
1243  m_sgNode = topNode.GetRawPtr();
1244 
1245  return m_sgNode;
1246 }
std::list< WRL2NODE * > m_Children
Definition: vrml2_node.h:66
#define MASK_VRML
Definition: wrltypes.h:37
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
Definition: ifsg_api.cpp:645
#define NULL
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
Definition: ifsg_api.cpp:654
SGNODE * m_sgNode
Definition: vrml2_node.h:70
SGTYPES
Definition: sg_types.h:34
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
Definition: ifsg_api.cpp:627
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
WRL2NODES
Definition: wrltypes.h:121

References S3D::AddSGNodeChild(), S3D::AddSGNodeRef(), IFSG_NODE::Destroy(), IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), S3D::GetSGNodeType(), WRL2NODE::m_Children, WRL2NODE::m_sgNode, MASK_VRML, NULL, S3D::SGTYPE_SHAPE, WRL2_INLINE, WRL2_SHAPE, WRL2_SWITCH, and WRL2_TRANSFORM.

Referenced by LoadVRML().

◆ unlinkChildNode()

void WRL2NODE::unlinkChildNode ( const WRL2NODE aNode)
virtualinherited

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.

Parameters
aNodeis the child which is being deleted

Reimplemented in WRL2FACESET, WRL2LINESET, WRL2POINTSET, WRL2APPEARANCE, and WRL2SHAPE.

Definition at line 464 of file vrml2_node.cpp.

465 {
466  std::list< WRL2NODE* >::iterator sL = m_Children.begin();
467  std::list< WRL2NODE* >::iterator eL = m_Children.end();
468 
469  while( sL != eL )
470  {
471  if( *sL == aNode )
472  {
473  m_Children.erase( sL );
474  return;
475  }
476 
477  ++sL;
478  }
479 
480  return;
481 }
std::list< WRL2NODE * > m_Children
Definition: vrml2_node.h:66

References WRL2NODE::m_Children.

Referenced by WRL2NODE::SetParent(), WRL2SHAPE::unlinkChildNode(), WRL2APPEARANCE::unlinkChildNode(), WRL2POINTSET::unlinkChildNode(), WRL2LINESET::unlinkChildNode(), WRL2FACESET::unlinkChildNode(), and WRL2NODE::~WRL2NODE().

◆ unlinkRefNode()

void WRL2NODE::unlinkRefNode ( const WRL2NODE aNode)
virtualinherited

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.

Parameters
aNodeis the node which is being deleted

Reimplemented in WRL2FACESET, WRL2LINESET, WRL2POINTSET, WRL2APPEARANCE, and WRL2SHAPE.

Definition at line 484 of file vrml2_node.cpp.

485 {
486  std::list< WRL2NODE* >::iterator sL = m_Refs.begin();
487  std::list< WRL2NODE* >::iterator eL = m_Refs.end();
488 
489  while( sL != eL )
490  {
491  if( *sL == aNode )
492  {
493  m_Refs.erase( sL );
494  return;
495  }
496 
497  ++sL;
498  }
499 
500  return;
501 }
std::list< WRL2NODE * > m_Refs
Definition: vrml2_node.h:67

References WRL2NODE::m_Refs.

Referenced by WRL2SHAPE::unlinkRefNode(), WRL2APPEARANCE::unlinkRefNode(), WRL2POINTSET::unlinkRefNode(), WRL2LINESET::unlinkRefNode(), and WRL2FACESET::unlinkRefNode().

Member Data Documentation

◆ m_BackPointers

◆ m_Children

◆ m_dir

std::string WRL2BASE::m_dir
private

Definition at line 63 of file vrml2_base.h.

Referenced by GetInlineData(), and Read().

◆ m_error

std::string WRL2NODE::m_error
protectedinherited

Definition at line 68 of file vrml2_node.h.

Referenced by WRL2NODE::GetError().

◆ m_inlineModels

std::map< std::string, SGNODE* > WRL2BASE::m_inlineModels
private

Definition at line 83 of file vrml2_base.h.

Referenced by GetInlineData(), and ~WRL2BASE().

◆ m_Name

std::string WRL2NODE::m_Name
protectedinherited

Definition at line 63 of file vrml2_node.h.

Referenced by WRL2NODE::FindNode(), WRL2NODE::GetName(), and WRL2NODE::SetName().

◆ m_Parent

◆ m_Refs

◆ m_sgNode

◆ m_Type

◆ m_useInline

bool WRL2BASE::m_useInline
private

Definition at line 62 of file vrml2_base.h.

Referenced by GetEnableInline(), readInline(), SetEnableInline(), and WRL2BASE().


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