KiCad PCB EDA Suite
vrml1_base.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <iostream>
25 #include <sstream>
26 #include <wx/log.h>
27 
28 #include "vrml1_base.h"
29 #include "vrml1_group.h"
30 #include "vrml1_separator.h"
31 #include "vrml1_material.h"
32 #include "vrml1_matbinding.h"
33 #include "vrml1_coords.h"
34 #include "vrml1_switch.h"
35 #include "vrml1_faceset.h"
36 #include "vrml1_transform.h"
37 #include "vrml1_shapehints.h"
38 #include "plugins/3dapi/ifsg_all.h"
39 
40 
42 {
43  m_Type = WRL1_BASE;
45  return;
46 }
47 
48 
50 {
51  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
52  wxLogTrace( MASK_VRML, " * [INFO] Destroying virtual base node\n" );
53  #endif
54 
55  cancelDict();
56  return;
57 }
58 
59 
60 // functions inherited from WRL1NODE
61 bool WRL1BASE::SetParent( WRL1NODE* aParent, bool /* doUnlink */ )
62 {
63  #ifdef DEBUG_VRML1
64  do {
65  std::ostringstream ostr;
66  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
67  ostr << " * [BUG] attempting to set parent on WRL1BASE node";
68  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
69  } while( 0 );
70  #endif
71 
72  return false;
73 }
74 
75 
76 std::string WRL1BASE::GetName( void )
77 {
78  #ifdef DEBUG_VRML1
79  do {
80  std::ostringstream ostr;
81  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
82  ostr << " * [BUG] attempting to extract name from virtual base node";
83  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
84  } while( 0 );
85  #endif
86 
87  return std::string( "" );
88 }
89 
90 
91 bool WRL1BASE::SetName( const std::string& aName )
92 {
93  #ifdef DEBUG_VRML1
94  do {
95  std::ostringstream ostr;
96  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
97  ostr << " * [BUG] attempting to set name on virtual base node";
98  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
99  } while( 0 );
100  #endif
101 
102  return false;
103 }
104 
105 
106 bool WRL1BASE::Read( WRLPROC& proc )
107 {
108  if( proc.GetVRMLType() != VRML_V1 )
109  {
110  #ifdef DEBUG_VRML1
111  do {
112  std::ostringstream ostr;
113  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
114  ostr << " * [BUG] no open file or file is not a VRML1 file";
115  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
116  } while( 0 );
117  #endif
118 
119  return false;
120  }
121 
122  // Note: according to the VRML1 specification, a file may contain
123  // only one grouping node at the top level. The following code
124  // supports non-conformant VRML1 files by processing all top level
125  // nodes as if the vrml1_base were the equivalent of a vrml1_separator
126 
127  while( proc.Peek() )
128  {
129  size_t line, column;
130  proc.GetFilePosData( line, column );
131 
132  if( !ReadNode( proc, this, NULL ) )
133  {
134  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
135  do {
136  std::ostringstream ostr;
137  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
138  ostr << " * [INFO] bad file format; unexpected eof at line ";
139  ostr << line << ", column " << column;
140  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
141  } while( 0 );
142  #endif
143 
144  return false;
145  }
146  }
147 
148  if( !proc.eof() )
149  {
150  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
151  do {
152  std::ostringstream ostr;
153  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
154  ostr << proc.GetError();
155  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
156  } while( 0 );
157  #endif
158 
159  return false;
160  }
161 
162  return true;
163 }
164 
165 
166 bool WRL1BASE::implementUse( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
167 {
168  if( NULL != aNode )
169  *aNode = NULL;
170 
171  if( !aParent )
172  {
173  #ifdef DEBUG_VRML1
174  do {
175  std::ostringstream ostr;
176  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
177  ostr << " * [BUG] invoked with NULL parent";
178  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
179  } while( 0 );
180  #endif
181 
182  return false;
183  }
184 
185  std::string glob;
186 
187  if( !proc.ReadName( glob ) )
188  {
189  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
190  do {
191  std::ostringstream ostr;
192  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
193  ostr << proc.GetError();
194  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
195  } while( 0 );
196  #endif
197 
198  return false;
199  }
200 
201  WRL1NODE* ref = aParent->FindNode( glob );
202 
203  // return 'true' - the file may be defective but it may still be somewhat OK
204  if( NULL == ref )
205  {
206  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
207  do {
208  std::ostringstream ostr;
209  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
210  ostr << " * [INFO] node '" << glob << "' not found";
211  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
212  } while( 0 );
213  #endif
214 
215  return true;
216  }
217 
218  if( !aParent->AddRefNode( ref ) )
219  {
220  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
221  do {
222  std::ostringstream ostr;
223  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
224  ostr << " * [INFO] failed to add node '" << glob << "' (";
225  ostr << ref->GetNodeTypeName( ref->GetNodeType() ) << ") to parent of type ";
226  ostr << aParent->GetNodeTypeName( aParent->GetNodeType() );
227  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
228  } while( 0 );
229  #endif
230 
231  return false;
232  }
233 
234  if( NULL != aNode )
235  *aNode = ref;
236 
237  return true;
238 }
239 
240 
241 bool WRL1BASE::implementDef( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
242 {
243  if( NULL != aNode )
244  *aNode = NULL;
245 
246  if( NULL == aParent )
247  {
248  #ifdef DEBUG_VRML1
249  do {
250  std::ostringstream ostr;
251  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
252  ostr << " * [BUG] invalid parent pointer (NULL)";
253  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
254  } while( 0 );
255  #endif
256 
257  return false;
258  }
259 
260  std::string glob;
261  WRL1NODE* lnode = NULL;
262 
263  if( !proc.ReadName( glob ) )
264  {
265  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
266  do {
267  std::ostringstream ostr;
268  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
269  ostr << proc.GetError();
270  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
271  } while( 0 );
272  #endif
273 
274  return false;
275  }
276 
277  size_t line, column;
278  proc.GetFilePosData( line, column );
279 
280  if( ReadNode( proc, aParent, &lnode ) )
281  {
282  if( NULL != aNode )
283  *aNode = lnode;
284 
285  if( lnode && !lnode->SetName( glob ) )
286  {
287  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
288  do {
289  std::ostringstream ostr;
290  size_t line, column;
291  proc.GetFilePosData( line, column );
292  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
293  ostr << " * [INFO] bad formatting (invalid name) at line";
294  ostr << line << ", column " << column;
295  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
296  } while( 0 );
297  #endif
298 
299  return false;
300  }
301 
302  if( !m_dictionary )
303  return false;
304 
305  m_dictionary->AddName( glob, lnode );
306 
307  return true;
308  }
309 
310  return false;
311 }
312 
313 
314 bool WRL1BASE::ReadNode( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
315 {
316  // This function reads a node and stores a pointer to it in aNode.
317  // A value 'true' is returned if a node is successfully read or,
318  // if the node is not supported, successfully discarded. Callers
319  // must always check the value of aNode when the function returns
320  // 'true' since it will be NULL if the node type is not supported.
321 
322  if( NULL != aNode )
323  *aNode = NULL;
324 
325  if( NULL == aParent )
326  {
327  #ifdef DEBUG_VRML1
328  do {
329  std::ostringstream ostr;
330  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
331  ostr << " * [BUG] invalid parent pointer (NULL)";
332  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
333  } while( 0 );
334  #endif
335 
336  return false;
337  }
338 
339  std::string glob;
340  WRL1NODES ntype;
341 
342  if( !proc.ReadName( glob ) )
343  {
344  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
345  if( !proc.eof() )
346  {
347  std::ostringstream ostr;
348  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
349  ostr << proc.GetError();
350  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
351  }
352  #endif
353 
354  return false;
355  }
356 
357  // Process node name:
358  // the names encountered at this point should be one of the
359  // built-in node names or one of:
360  // DEF, USE
361  if( !glob.compare( "USE" ) )
362  {
363  if( !implementUse( proc, aParent, aNode ) )
364  {
365  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
366  do {
367  std::ostringstream ostr;
368  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
369  ostr << proc.GetError();
370  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
371  } while( 0 );
372  #endif
373 
374  return false;
375  }
376 
377  return true;
378  }
379 
380  if( !glob.compare( "DEF" ) )
381  {
382  if( !implementDef( proc, aParent, aNode ) )
383  {
384  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
385  do {
386  std::ostringstream ostr;
387  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
388  ostr << proc.GetError();
389  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
390  } while( 0 );
391  #endif
392 
393  return false;
394  }
395 
396  return true;
397  }
398 
399  ntype = getNodeTypeID( glob );
400  size_t line = 0;
401  size_t column = 0;
402  proc.GetFilePosData( line, column );
403 
404  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
405  do {
406  std::ostringstream ostr;
407  ostr << " * [INFO] Processing node '" << glob << "' ID: " << ntype;
408  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
409  } while( 0 );
410  #endif
411 
412  switch( ntype )
413  {
414  case WRL1_GROUP:
415 
416  if( !readGroup( proc, aParent, aNode ) )
417  return false;
418 
419  break;
420 
421  case WRL1_SEPARATOR:
422 
423  if( !readSeparator( proc, aParent, aNode ) )
424  return false;
425 
426  break;
427 
428  case WRL1_SWITCH:
429 
430  if( !readSwitch( proc, aParent, aNode ) )
431  return false;
432 
433  break;
434 
435  case WRL1_MATERIAL:
436 
437  if( !readMaterial( proc, aParent, aNode ) )
438  return false;
439 
440  break;
441 
443 
444  if( !readMatBinding( proc, aParent, aNode ) )
445  return false;
446 
447  break;
448 
449  case WRL1_COORDINATE3:
450 
451  if( !readCoords( proc, aParent, aNode ) )
452  return false;
453 
454  break;
455 
456  case WRL1_INDEXEDFACESET:
457 
458  if( !readFaceSet( proc, aParent, aNode ) )
459  return false;
460 
461  break;
462 
463  case WRL1_TRANSFORM:
464  case WRL1_TRANSLATION:
465  case WRL1_ROTATION:
466  case WRL1_SCALE:
467 
468  if( !readTransform( proc, aParent, aNode ) )
469  return false;
470 
471  break;
472 
473  case WRL1_SHAPEHINTS:
474 
475  if( !readShapeHints( proc, aParent, aNode ) )
476  return false;
477 
478  break;
479 
480  //
481  // items not implemented or for optional future implementation:
482  //
483  default:
484 
485  proc.GetFilePosData( line, column );
486 
487  if( !proc.DiscardNode() )
488  {
489  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
490  do {
491  std::ostringstream ostr;
492  ostr << proc.GetError() << "\n";
493  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
494  ostr << " * [INFO] could not discard node at line " << line;
495  ostr << ", column " << column;
496  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
497  } while( 0 );
498  #endif
499 
500  return false;
501  }
502  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 1 )
503  else
504  {
505  std::ostringstream ostr;
506  ostr << " * [INFO] discarded node '" << glob << "' at line ";
507  ostr << line << ", col " << column << " (currently unsupported)";
508  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
509  }
510  #endif
511 
512  break;
513  }
514 
515  return true;
516 }
517 
518 
519 bool WRL1BASE::Read( WRLPROC& proc, WRL1BASE* aTopNode )
520 {
521  // this function makes no sense in the base node
522  #ifdef DEBUG_VRML1
523  do {
524  std::ostringstream ostr;
525  ostr << proc.GetError() << "\n";
526  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
527  ostr << " * [BUG] this method must never be invoked on a WRL1BASE object";
528  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
529  } while( 0 );
530  #endif
531 
532  return false;
533 }
534 
535 
536 bool WRL1BASE::readGroup( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
537 {
538  if( NULL != aNode )
539  *aNode = NULL;
540 
541  WRL1GROUP* np = new WRL1GROUP( m_dictionary, aParent );
542 
543  if( !np->Read( proc, this ) )
544  {
545  delete np;
546  return false;
547  }
548 
549  if( NULL != aNode )
550  *aNode = (WRL1NODE*) np;
551 
552  return true;
553 }
554 
555 
556 bool WRL1BASE::readSeparator( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
557 {
558  if( NULL != aNode )
559  *aNode = NULL;
560 
561  WRL1SEPARATOR* np = new WRL1SEPARATOR( m_dictionary, aParent );
562 
563  if( !np->Read( proc, this ) )
564  {
565  delete np;
566  return false;
567  }
568 
569  if( NULL != aNode )
570  *aNode = (WRL1NODE*) np;
571 
572  return true;
573 }
574 
575 
576 bool WRL1BASE::readSwitch( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
577 {
578  WRL1SWITCH* np = new WRL1SWITCH( m_dictionary, aParent );
579 
580  if( !np->Read( proc, this ) )
581  {
582  delete np;
583  return false;
584  }
585 
586  if( NULL != aNode )
587  *aNode = (WRL1NODE*) np;
588 
589  return true;
590 }
591 
592 
593 bool WRL1BASE::readMaterial( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
594 {
595  if( NULL != aNode )
596  *aNode = NULL;
597 
598  WRL1MATERIAL* np = new WRL1MATERIAL( m_dictionary, aParent );
599 
600  if( !np->Read( proc, this ) )
601  {
602  delete np;
603  return false;
604  }
605 
606  if( NULL != aNode )
607  *aNode = (WRL1NODE*) np;
608 
609  return true;
610 }
611 
612 
613 bool WRL1BASE::readMatBinding( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
614 {
615  if( NULL != aNode )
616  *aNode = NULL;
617 
618  WRL1MATBINDING* np = new WRL1MATBINDING( m_dictionary, aParent );
619 
620  if( !np->Read( proc, this ) )
621  {
622  delete np;
623  return false;
624  }
625 
626  if( NULL != aNode )
627  *aNode = (WRL1NODE*) np;
628 
629  return true;
630 }
631 
632 
633 bool WRL1BASE::readCoords( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
634 {
635  if( NULL != aNode )
636  *aNode = NULL;
637 
638  WRL1COORDS* np = new WRL1COORDS( m_dictionary, aParent );
639 
640  if( !np->Read( proc, this ) )
641  {
642  delete np;
643  return false;
644  }
645 
646  if( NULL != aNode )
647  *aNode = (WRL1NODE*) np;
648 
649  return true;
650 }
651 
652 
653 bool WRL1BASE::readFaceSet( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
654 {
655  if( NULL != aNode )
656  *aNode = NULL;
657 
658  WRL1FACESET* np = new WRL1FACESET( m_dictionary, aParent );
659 
660  if( !np->Read( proc, this ) )
661  {
662  delete np;
663  return false;
664  }
665 
666  if( NULL != aNode )
667  *aNode = (WRL1NODE*) np;
668 
669  return true;
670 }
671 
672 
673 bool WRL1BASE::readTransform( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
674 {
675  if( NULL != aNode )
676  *aNode = NULL;
677 
678  WRL1TRANSFORM* np = new WRL1TRANSFORM( m_dictionary, aParent );
679 
680  if( !np->Read( proc, this ) )
681  {
682  delete np;
683  return false;
684  }
685 
686  if( NULL != aNode )
687  *aNode = (WRL1NODE*) np;
688 
689  return true;
690 }
691 
692 
693 bool WRL1BASE::readShapeHints( WRLPROC& proc, WRL1NODE* aParent, WRL1NODE** aNode )
694 {
695  if( NULL != aNode )
696  *aNode = NULL;
697 
698  WRL1SHAPEHINTS* np = new WRL1SHAPEHINTS( m_dictionary, aParent );
699 
700  if( !np->Read( proc, this ) )
701  {
702  delete np;
703  return false;
704  }
705 
706  if( NULL != aNode )
707  *aNode = (WRL1NODE*) np;
708 
709  return true;
710 }
711 
712 
714 {
715  #if defined( DEBUG_VRML1 ) && ( DEBUG_VRML1 > 2 )
716  do {
717  std::ostringstream ostr;
718  ostr << " * [INFO] Translating VRML1 Base with " << m_Items.size();
719  ostr << " items";
720  wxLogTrace( MASK_VRML, "%s\n", ostr.str().c_str() );
721  } while( 0 );
722  #endif
723 
724  if( m_Items.empty() )
725  return NULL;
726 
727  if( m_Items.size() == 1 )
728  return (*m_Items.begin())->TranslateToSG( NULL, NULL );
729 
730  // Note: according to the VRML1 specification, a file may contain
731  // only one grouping node at the top level. The following code
732  // supports non-conformant VRML1 files.
733 
734  m_current.Init();
735 
736  IFSG_TRANSFORM txNode( true );
737  bool hasContent = false;
738 
739  std::list< WRL1NODE* >::iterator sI = m_Items.begin();
740  std::list< WRL1NODE* >::iterator eI = m_Items.end();
741 
742  SGNODE* node = txNode.GetRawPtr();
743 
744  while( sI != eI )
745  {
746  if( NULL != (*sI)->TranslateToSG( node, &m_current ) )
747  hasContent = true;
748 
749  ++sI;
750  }
751 
752  if( !hasContent )
753  {
754  txNode.Destroy();
755  return NULL;
756  }
757 
758  return node;
759 }
WRL1BASE represents the top node of a VRML1 model.
Definition: vrml1_base.h:45
bool implementUse(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:166
virtual WRL1NODE * FindNode(const std::string &aNodeName)
Function FindNode searches the tree of linked nodes and returns a reference to the current node with ...
Definition: vrml1_node.cpp:416
bool SetParent(WRL1NODE *aParent, bool doUnlink=true) override
Function SetParent sets the parent WRL1NODE of this object.
Definition: vrml1_base.cpp:61
const char * GetNodeTypeName(WRL1NODES aNodeType) const
Definition: vrml1_node.cpp:378
bool readSeparator(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:556
WRL1SEPARATOR.
void cancelDict(void)
Definition: vrml1_node.cpp:244
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
bool GetFilePosData(size_t &line, size_t &column)
Definition: wrlproc.cpp:1951
virtual std::string GetName(void) override
Definition: vrml1_base.cpp:76
#define MASK_VRML
Definition: wrltypes.h:37
WRLVERSION GetVRMLType(void)
Definition: wrlproc.cpp:221
WRL1STATUS m_current
Definition: vrml1_node.h:128
WRL1MATBINDING.
WRL1FACESET.
Definition: vrml1_faceset.h:42
bool Read(WRLPROC &proc)
Definition: vrml1_base.cpp:106
SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
WRL1NODES getNodeTypeID(const std::string &aNodeName)
Function getNodeTypeID returns the ID based on the given aNodeName or WRL1_INVALID (WRL1_END) if no s...
Definition: vrml1_node.cpp:393
collects header files for all SG* wrappers and the API
void Init()
Definition: vrml1_node.h:92
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
Definition: ifsg_node.cpp:66
WRL1COORDS.
Definition: vrml1_coords.h:42
bool readSwitch(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:576
bool readGroup(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:536
virtual ~WRL1BASE()
Definition: vrml1_base.cpp:49
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
bool AddName(const std::string &aName, WRL1NODE *aNode)
Definition: vrml1_node.cpp:38
bool readCoords(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:633
bool readTransform(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:673
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
#define NULL
SGNODE * TranslateToSG(SGNODE *aParent, WRL1STATUS *sp) override
Function TranslateToSG produces a representation of the data using the intermediate scenegraph struct...
Definition: vrml1_base.cpp:713
virtual bool AddRefNode(WRL1NODE *aNode)
Definition: vrml1_node.cpp:479
bool ReadNode(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:314
WRL1NODE represents the base class of all VRML1 nodes.
Definition: vrml1_node.h:111
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
bool DiscardNode(void)
Definition: wrlproc.cpp:359
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
WRL1MATERIAL.
WRL1GROUP.
Definition: vrml1_group.h:40
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
char Peek(void)
Definition: wrlproc.cpp:1979
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
Definition: vrml1_group.cpp:76
NAMEREGISTER * m_dictionary
Definition: vrml1_node.h:138
bool implementDef(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:241
bool readShapeHints(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:693
WRL1SHAPEHINTS.
WRL1NODES GetNodeType(void) const
Function GetNodeType returns the type of this node instance.
Definition: vrml1_node.cpp:310
WRL1NODES m_Type
Definition: vrml1_node.h:119
virtual bool SetName(const std::string &aName) override
Definition: vrml1_base.cpp:91
bool ReadName(std::string &aName)
Definition: wrlproc.cpp:280
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
WRL1SWITCH.
Definition: vrml1_switch.h:40
bool readMatBinding(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:613
std::list< WRL1NODE * > m_Items
Definition: vrml1_node.h:125
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
WRL1TRANSFORM.
WRL1NODES
Definition: wrltypes.h:52
std::string GetError(void)
Definition: wrlproc.cpp:1945
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
Definition: ifsg_node.cpp:54
bool readMaterial(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:593
bool eof(void)
Definition: wrlproc.cpp:1939
virtual bool SetName(const std::string &aName)
Definition: vrml1_node.cpp:328
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
bool readFaceSet(WRLPROC &proc, WRL1NODE *aParent, WRL1NODE **aNode)
Definition: vrml1_base.cpp:653