56 m_Type = WRL2NODES::WRL2_BASE;
62 std::map< std::string, SGNODE* >::iterator iS =
m_inlineModels.begin();
63 std::map< std::string, SGNODE* >::iterator eS =
m_inlineModels.end();
82 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set parent on WRL2BASE node." ) );
103 std::map< std::string, SGNODE* >::iterator dp =
m_inlineModels.find( aName );
110 if( aName.compare( 0, 7,
"file://" ) == 0 )
112 if( aName.length() <= 7 )
115 tname = wxString::FromUTF8Unchecked( aName.substr( 7 ).c_str() );
119 tname = wxString::FromUTF8Unchecked( aName.c_str() );
125 if( fn.IsRelative() && !
m_dir.empty() )
127 wxString fname = wxString::FromUTF8Unchecked(
m_dir.c_str() );
128 fname.append( tname );
154 wxCHECK_MSG(
false, std::string(
"" ), wxT(
"Attempt to extract name from base node." ) );
160 wxCHECK_MSG(
false,
false, wxT(
"Attempt to set name of base node." ) );
166 wxCHECK_MSG( proc.
GetVRMLType() == WRLVERSION::VRML_V2,
false,
167 wxT(
"No open file or file is not a VRML2 file." ) );
172 while(
ReadNode( proc,
this, &node ) && !proc.
eof() );
190 if(
nullptr != aNode )
193 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
201 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
212 " * [INFO] node '%s' not found." ),
213 __FILE__, __FUNCTION__, __LINE__, glob );
222 " * [INFO] failed to add node '%s' (%d) to parent of type %d" ),
223 __FILE__, __FUNCTION__, __LINE__, glob, ref->
GetNodeType(),
229 if(
nullptr != aNode )
238 if(
nullptr != aNode )
241 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
250 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
255 if(
ReadNode( proc, aParent, &lnode ) )
257 if(
nullptr != aNode )
260 if( lnode && !lnode->
SetName( glob ) )
264 " * [INFO] bad formatting (invalid name) %s." ),
285 if(
nullptr != aNode )
288 wxCHECK_MSG( aParent,
false, wxT(
"Invalid parent." ) );
297 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
313 if( !glob.compare(
"USE" ) )
319 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
327 if( !glob.compare(
"DEF" ) )
333 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
342 if( !glob.compare(
"PROTO" ) )
348 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
357 if( !glob.compare(
"EXTERNPROTO" ) )
363 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
372 if( !glob.compare(
"ROUTE" ) )
378 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
388 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Processing node '%s' ID: %d" ), glob, ntype );
395 case WRL2NODES::WRL2_APPEARANCE:
402 case WRL2NODES::WRL2_BOX:
404 if( !
readBox( proc, aParent, aNode ) )
409 case WRL2NODES::WRL2_COLOR:
416 case WRL2NODES::WRL2_CONE:
420 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
433 case WRL2NODES::WRL2_COORDINATE:
440 case WRL2NODES::WRL2_CYLINDER:
444 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
457 case WRL2NODES::WRL2_ELEVATIONGRID:
461 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
474 case WRL2NODES::WRL2_EXTRUSION:
478 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
491 case WRL2NODES::WRL2_INDEXEDFACESET:
498 case WRL2NODES::WRL2_INDEXEDLINESET:
505 case WRL2NODES::WRL2_POINTSET:
512 case WRL2NODES::WRL2_MATERIAL:
519 case WRL2NODES::WRL2_NORMAL:
526 case WRL2NODES::WRL2_SHAPE:
533 case WRL2NODES::WRL2_SPHERE:
537 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
550 case WRL2NODES::WRL2_SWITCH:
557 case WRL2NODES::WRL2_TRANSFORM:
558 case WRL2NODES::WRL2_GROUP:
565 case WRL2NODES::WRL2_INLINE:
575 case WRL2NODES::WRL2_ANCHOR:
576 case WRL2NODES::WRL2_AUDIOCLIP:
577 case WRL2NODES::WRL2_BACKGROUND:
578 case WRL2NODES::WRL2_BILLBOARD:
579 case WRL2NODES::WRL2_COLLISION:
580 case WRL2NODES::WRL2_COLORINTERPOLATOR:
581 case WRL2NODES::WRL2_COORDINATEINTERPOLATOR:
582 case WRL2NODES::WRL2_CYLINDERSENSOR:
583 case WRL2NODES::WRL2_DIRECTIONALLIGHT:
584 case WRL2NODES::WRL2_FOG:
585 case WRL2NODES::WRL2_FONTSTYLE:
586 case WRL2NODES::WRL2_IMAGETEXTURE:
587 case WRL2NODES::WRL2_LOD:
588 case WRL2NODES::WRL2_MOVIETEXTURE:
589 case WRL2NODES::WRL2_NAVIGATIONINFO:
590 case WRL2NODES::WRL2_NORMALINTERPOLATOR:
591 case WRL2NODES::WRL2_ORIENTATIONINTERPOLATOR:
592 case WRL2NODES::WRL2_PIXELTEXTURE:
593 case WRL2NODES::WRL2_PLANESENSOR:
594 case WRL2NODES::WRL2_POINTLIGHT:
595 case WRL2NODES::WRL2_POSITIONINTERPOLATOR:
596 case WRL2NODES::WRL2_PROXIMITYSENSOR:
597 case WRL2NODES::WRL2_SCALARINTERPOLATOR:
598 case WRL2NODES::WRL2_SCRIPT:
599 case WRL2NODES::WRL2_SOUND:
600 case WRL2NODES::WRL2_SPHERESENSOR:
601 case WRL2NODES::WRL2_SPOTLIGHT:
602 case WRL2NODES::WRL2_TEXT:
603 case WRL2NODES::WRL2_TEXTURECOORDINATE:
604 case WRL2NODES::WRL2_TEXTURETRANSFORM:
605 case WRL2NODES::WRL2_TIMESENSOR:
606 case WRL2NODES::WRL2_TOUCHSENSOR:
607 case WRL2NODES::WRL2_VIEWPOINT:
608 case WRL2NODES::WRL2_VISIBILITYSENSOR:
609 case WRL2NODES::WRL2_WORLDINFO:
610 case WRL2NODES::WRL2_INVALID:
615 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard %s node %s." ),
635 wxCHECK_MSG(
false,
false, wxT(
"This method must never be invoked on a WRL2BASE object." ) );
641 if(
nullptr != aNode )
646 if( !np->
Read( proc,
this ) )
652 if(
nullptr != aNode )
661 if(
nullptr != aNode )
666 if( !np->
Read( proc,
this ) )
672 if(
nullptr != aNode )
681 if(
nullptr != aNode )
686 if( !np->
Read( proc,
this ) )
692 if(
nullptr != aNode )
701 if(
nullptr != aNode )
706 if( !np->
Read( proc,
this ) )
712 if(
nullptr != aNode )
721 if(
nullptr != aNode )
726 if( !np->
Read( proc,
this ) )
732 if(
nullptr != aNode )
741 if(
nullptr != aNode )
746 if( !np->
Read( proc,
this ) )
752 if(
nullptr != aNode )
761 if(
nullptr != aNode )
766 if( !np->
Read( proc,
this ) )
772 if(
nullptr != aNode )
781 if(
nullptr != aNode )
786 if( !np->
Read( proc,
this ) )
792 if(
nullptr != aNode )
801 if(
nullptr != aNode )
806 if( !np->
Read( proc,
this ) )
812 if(
nullptr != aNode )
821 if(
nullptr != aNode )
826 if( !np->
Read( proc,
this ) )
832 if(
nullptr != aNode )
841 if(
nullptr != aNode )
846 if( !np->
Read( proc,
this ) )
852 if(
nullptr != aNode )
861 if(
nullptr != aNode )
866 if( !np->
Read( proc,
this ) )
872 if(
nullptr != aNode )
881 if(
nullptr != aNode )
888 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] failed to discard in line node %s." ),
899 if( !np->
Read( proc,
this ) )
905 if(
nullptr != aNode )
919 if(
nullptr != aParent )
938 std::list< WRL2NODE* >::iterator sC =
m_Children.begin();
939 std::list< WRL2NODE* >::iterator eC =
m_Children.end();
947 type = (*sC)->GetNodeType();
951 case WRL2NODES::WRL2_SHAPE:
958 if(
nullptr != pshape )
967 case WRL2NODES::WRL2_TRANSFORM:
968 case WRL2NODES::WRL2_SWITCH:
969 case WRL2NODES::WRL2_INLINE:
971 if(
nullptr != (*sC)->TranslateToSG( topNode.
GetRawPtr() ) )
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
Define the basic data set required to represent a 3D model.
The base class of all Scene Graph nodes.
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
The top node of a VRML2 model.
bool readMaterial(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
std::map< std::string, SGNODE * > m_inlineModels
virtual bool SetName(const std::string &aName) override
void SetEnableInline(bool enable)
bool readTransform(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool GetEnableInline(void)
bool readLineSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readShape(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool implementDef(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readPointSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readInline(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
SGNODE * GetInlineData(const std::string &aName)
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool implementUse(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readColor(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool SetParent(WRL2NODE *aParent, bool doUnlink=true) override
Set the parent WRL2NODE of this object.
virtual std::string GetName(void) override
bool readBox(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readAppearance(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readNorms(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readSwitch(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool readCoords(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
bool readFaceSet(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
virtual bool SetName(const std::string &aName)
WRL2NODES getNodeTypeID(const std::string &aNodeName)
std::list< WRL2NODE * > m_Children
virtual WRL2NODE * FindNode(const std::string &aNodeName, const WRL2NODE *aCaller)
Search the tree of linked nodes and returns a reference to the first node found with the given name.
virtual bool AddRefNode(WRL2NODE *aNode)
WRL2NODES GetNodeType(void) const
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
bool ReadGlob(std::string &aGlob)
WRLVERSION GetVRMLType(void)
const char * GetParentDir(void)
std::string GetError(void)
bool ReadName(std::string &aName)
std::string GetFilePosition() const
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
collects header files for all SG* wrappers and the API
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
SCENEGRAPH * LoadVRML(const wxString &aFileName, bool useInline)
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().