41typedef std::pair< std::string, WRL2NODES >
NODEITEM;
42typedef std::map< std::string, WRL2NODES >
NODEMAP;
50 m_Type = WRL2NODES::WRL2_END;
80 nodenames.emplace(
NODEITEM(
"ColorInterpolator", WRL2NODES::WRL2_COLORINTERPOLATOR ) );
84 WRL2NODES::WRL2_COORDINATEINTERPOLATOR ) );
86 nodenames.emplace(
NODEITEM(
"CylinderSensor", WRL2NODES::WRL2_CYLINDERSENSOR ) );
87 nodenames.emplace(
NODEITEM(
"DirectionalLight", WRL2NODES::WRL2_DIRECTIONALLIGHT ) );
94 nodenames.emplace(
NODEITEM(
"IndexedFaceSet", WRL2NODES::WRL2_INDEXEDFACESET ) );
95 nodenames.emplace(
NODEITEM(
"IndexedLineSet", WRL2NODES::WRL2_INDEXEDLINESET ) );
100 nodenames.emplace(
NODEITEM(
"NavigationInfo", WRL2NODES::WRL2_NAVIGATIONINFO ) );
102 nodenames.emplace(
NODEITEM(
"NormalInterpolator", WRL2NODES::WRL2_NORMALINTERPOLATOR ) );
104 WRL2NODES::WRL2_ORIENTATIONINTERPOLATOR ) );
110 WRL2NODES::WRL2_POSITIONINTERPOLATOR ) );
111 nodenames.emplace(
NODEITEM(
"ProximitySensor", WRL2NODES::WRL2_PROXIMITYSENSOR ) );
112 nodenames.emplace(
NODEITEM(
"ScalarInterpolator", WRL2NODES::WRL2_SCALARINTERPOLATOR ) );
121 nodenames.emplace(
NODEITEM(
"TextureCoordinate", WRL2NODES::WRL2_TEXTURECOORDINATE ) );
122 nodenames.emplace(
NODEITEM(
"TextureTransform", WRL2NODES::WRL2_TEXTURETRANSFORM ) );
127 nodenames.emplace(
NODEITEM(
"VisibilitySensor", WRL2NODES::WRL2_VISIBILITYSENSOR ) );
143 (*sBP)->unlinkRefNode(
this );
147 std::list< WRL2NODE* >::iterator sC =
m_Refs.begin();
148 std::list< WRL2NODE* >::iterator eC =
m_Refs.end();
152 (*sC)->delNodeRef(
this );
162 (*sC)->SetParent(
nullptr,
false );
177 std::list< WRL2NODE* >::iterator np =
189 std::list< WRL2NODE* >::iterator np =
199 " * [BUG] delNodeRef() did not find its target." ),
200 __FILE__, __FUNCTION__, __LINE__ );
227 std::set< std::string >::iterator item =
badNames.find( aName );
233 " * [INFO] invalid node name '%s' (matches restricted word)" ),
234 __FILE__, __FUNCTION__, __LINE__, *item );
240 if( isdigit( aName[0] ) )
243 " * [INFO] invalid node name '%s' (begins with digit)" ),
244 __FILE__, __FUNCTION__, __LINE__, aName );
253 #define BAD_CHARS1 "\"\'#,.\\[]{}\x00\x01\x02\x03\x04\x05\x06\x09\x0A\x0B\x0C\x0D\x0E\x0F"
254 #define BAD_CHARS2 "\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
256 if( std::string::npos != aName.find_first_of(
BAD_CHARS1 )
257 || std::string::npos != aName.find_first_of(
BAD_CHARS2 ) )
261 " * [INFO] invalid node name '%s' (contains invalid character)" ),
262 __FILE__, __FUNCTION__, __LINE__, aName );
275 if( aNodeType < WRL2NODES::WRL2_BASE || aNodeType >= WRL2NODES::WRL2_END )
276 return "*INVALID_TYPE*";
278 if( aNodeType == WRL2NODES::WRL2_BASE )
279 return "*VIRTUAL_BASE*";
281 NODEMAP::iterator it =
nodenames.begin();
282 advance( it, (
static_cast<int>( aNodeType ) -
static_cast<int>( WRL2NODES::WRL2_BEGIN ) ) );
284 return it->first.c_str();
290 NODEMAP::iterator it =
nodenames.find( aNodeName );
295 return WRL2NODES::WRL2_INVALID;
307 if( aNodeName.empty() )
310 if( !
m_Name.compare( aNodeName ) )
313 std::list< WRL2NODE* >::iterator sLA =
m_Children.begin();
314 std::list< WRL2NODE* >::iterator eLA =
m_Children.end();
320 if( *sLA != aCaller )
322 psg = (*sLA)->
FindNode( aNodeName,
this );
344 if(
nullptr !=
m_Parent && doUnlink )
358 wxCHECK_MSG( aNode,
false, wxT(
"Invalid node pointer." ) );
359 wxCHECK_MSG( aNode->
GetNodeType() != WRL2NODES::WRL2_BASE,
false,
360 wxT(
"Attempting to add a base node to another node." ) );
363 std::list< WRL2NODE* >::iterator sC =
m_Children.begin();
364 std::list< WRL2NODE* >::iterator eC =
m_Children.end();
385 wxCHECK_MSG( aNode,
false, wxT(
"Invalid node pointer." ) );
386 wxCHECK_MSG( aNode->
GetNodeType() != WRL2NODES::WRL2_BASE,
false,
387 wxT(
"Attempt to add a base node reference to another base node" ) );
389 std::list< WRL2NODE* >::iterator sR =
m_Refs.begin();
390 std::list< WRL2NODE* >::iterator eR =
m_Refs.end();
400 m_Refs.push_back( aNode );
409 std::list< WRL2NODE* >::iterator sL =
m_Children.begin();
410 std::list< WRL2NODE* >::iterator eL =
m_Children.end();
427 std::list< WRL2NODE* >::iterator sL =
m_Refs.begin();
428 std::list< WRL2NODE* >::iterator eL =
m_Refs.end();
void addNodeRef(WRL2NODE *aNode)
Add a pointer to a node which references but does not own this node.
virtual bool SetName(const std::string &aName)
WRL2NODES getNodeTypeID(const std::string &aNodeName)
std::list< WRL2NODE * > m_BackPointers
WRL2NODE * GetParent(void) const
virtual std::string GetName(void)
virtual bool SetParent(WRL2NODE *aParent, bool doUnlink=true)
Set the parent WRL2NODE of this object.
virtual void unlinkChildNode(const WRL2NODE *aNode)
Remove references to an owned child.
std::string GetError(void)
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)
void delNodeRef(WRL2NODE *aNode)
Remove a pointer to a node which references but does not own this node.
virtual void unlinkRefNode(const WRL2NODE *aNode)
Remove pointers to a referenced node.
const char * GetNodeTypeName(WRL2NODES aNodeType) const
WRL2NODES GetNodeType(void) const
std::list< WRL2NODE * > m_Refs
virtual bool AddChildNode(WRL2NODE *aNode)
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
std::map< std::string, std::vector< SGNODE * > > NODEMAP
std::pair< std::string, std::vector< SGNODE * > > NODEITEM
std::map< std::string, WRL2NODES > NODEMAP
static std::set< std::string > badNames
std::pair< std::string, WRL2NODES > NODEITEM