H3D API  2.4.1
Namespaces | Classes | Functions
H3D::X3D Namespace Reference

X3D namespace. More...

Namespaces

 Convert
 The Convert namespace contains help functions for parsing a string and converting it to a X3D field value.
 

Classes

class  DEFNodesBase
 Base class that adds functionallity needed for reference count debugging. More...
 
class  InvalidNodeType
 An exception for errors when the Node type is not what was expected. More...
 
class  NoSuchDEFName
 An exception for errors when the DEF name does not exist in the DEF nodes structure. More...
 
class  DEFNodes
 Provides a mapping between defined DEF names in X3D and the nodes they refer to. More...
 
class  IStreamInputSource
 This class is a derivative of the standard Xerxes C InputSource class. More...
 
class  IStreamInputStream
 This class implements the BinInputStream interface to read from a istream. More...
 
class  XMLParseError
 An exception for errors occuring while parsing an X3D XML file. More...
 
class  X3DSAX2Handlers
 This class implements the SAX2 ContentHandler and ErrorHandler interface in order to build an H3D scenegraph from a X3D XML file. More...
 

Functions

H3DAPI_API GroupcreateVRMLFromStream (istream &in, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create H3D nodes given VRML data as an istream. More...
 
H3DAPI_API GroupcreateVRMLFromString (const string &str, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create H3D nodes given VRML data as a string. More...
 
H3DAPI_API GroupcreateVRMLFromURL (const string &urn, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, bool change_base_path_during_parsing=true)
 Create H3D nodes given VRML data as a URL. More...
 
H3DAPI_API AutoRef< NodecreateVRMLNodeFromStream (istream &in, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create a H3D Node given VRML data as a istream. More...
 
H3DAPI_API AutoRef< NodecreateVRMLNodeFromString (const string &str, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create a H3D Node given VRML data as a string. More...
 
H3DAPI_API AutoRef< NodecreateVRMLNodeFromURL (const string &urn, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, bool change_base_path_during_parsing=true)
 Create a H3D Node given VRML data as a URL. More...
 
H3DAPI_API GroupcreateX3DFromStream (istream &in, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, const string &system_id="<stream input>")
 Create H3D nodes given X3D data as a istream. More...
 
H3DAPI_API GroupcreateX3DFromString (const string &str, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create H3D nodes given X3D data as a string. More...
 
H3DAPI_API GroupcreateX3DFromURL (const string &urn, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, bool change_base_path_during_parsing=true)
 Create H3D nodes given X3D data as a URL. More...
 
H3DAPI_API AutoRef< NodecreateX3DNodeFromStream (istream &in, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, const string &system_id="<stream input>")
 Create a H3D Node given X3D data as a istream. More...
 
H3DAPI_API AutoRef< NodecreateX3DNodeFromString (const string &str, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL)
 Create a H3D Node given X3D data as a string. More...
 
H3DAPI_API AutoRef< NodecreateX3DNodeFromURL (const string &urn, DEFNodes *dn=NULL, DEFNodes *exported_nodes=NULL, PrototypeVector *prototypes=NULL, bool change_base_path_during_parsing=true)
 Create a H3D Node given X3D data as a URL. More...
 
H3DAPI_API void writeNodeAsX3D (ostream &os, Node *node, const string &container_field="")
 Write the scene graph part of the node given in X3D/XML format to the given ostream.
 
H3DAPI_API void writeNodeAsVRML (ostream &os, Node *node)
 Write the scene graph part of the node given in X3D/VRML format to the given ostream.
 
H3DAPI_API void writeGeometryAsSTL (ostream &os, X3DGeometryNode *geom, const string &name="", bool use_binary_format=false)
 Write the triangles rendered by the geometry node as STL to the given ostream. More...
 
H3DAPI_API void writeNodeAsX3DHelp (ostream &os, Node *node, const string &container_field, const string &prefix, std::set< Node * > &visited_nodes, unsigned int output_type=0)
 Help function for writeNodeAsX3D and writeNodeAsVRML output_type = 0 means xml output, 1 means vrml output.
 
template<class Type >
Type X3DStringToValue (const string &x3d_string)
 Convert a string to a specified type according to the X3D/XML field encoding. More...
 
template<class VectorType >
void X3DStringToVector (const string &x3d_string, VectorType &values)
 Convert a string to a vector of a specified type according to the X3D/XML field encoding. More...
 
template<>
void X3DStringToVector< vector< string > > (const string &x3d_string, vector< string > &values)
 Template specializaion for handling the case of MFString where the the values are specified as e.g. More...
 
PixelImageX3DStringTo2DImage (const string &x3d_string)
 Convert a string to a PixelImage according to the X3D/XML field encoding for SFImage. More...
 
PixelImageX3DStringTo3DImage (const string &x3d_string)
 Convert a string to a 3D PixelImage according to the X3D spec for Pixel3DTexture. More...
 

Detailed Description

X3D namespace.

Function Documentation

◆ createVRMLFromStream()

Group * H3D::X3D::createVRMLFromStream ( istream &  in,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create H3D nodes given VRML data as an istream.

Parameters
inThe input stream to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the stream.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the stream.
Returns
A Group containing the nodes created.

References H3D::X3DGroupingNode::children.

◆ createVRMLFromString()

Group * H3D::X3D::createVRMLFromString ( const string &  str,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create H3D nodes given VRML data as a string.

Parameters
strThe input string to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the string.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the string.
Returns
A Group containing the nodes created.

References H3D::X3DGroupingNode::children.

Referenced by createVRMLFromURL().

◆ createVRMLFromURL()

Group * H3D::X3D::createVRMLFromURL ( const string &  urn,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
bool  change_base_path_during_parsing = true 
)

Create H3D nodes given VRML data as a URL.

Parameters
urnThe input URL to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the URL.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the URL.
change_base_path_during_parsingIf true, the base path of the ResourceResolver will be set to the part of urn that is before the file name during parsing of this file. E.g. if urn is /test/test.x3d, the base path will be set to /test/. If false, it will remain what it was before calling this function.
Returns
A Group containing the nodes created.

References H3D::X3DGroupingNode::children, createVRMLFromString(), H3DUtil::ResourceResolver::getBaseURL(), H3DUtil::ResourceResolver::getURNResolver(), H3DUtil::ResourceResolver::releaseTmpFileName(), H3DUtil::ResourceResolver::resolveURLAsFile(), H3DUtil::ResourceResolver::resolveURLAsString(), H3DUtil::URNResolver::resolveURN(), and H3DUtil::ResourceResolver::setBaseURL().

◆ createVRMLNodeFromStream()

AutoRef< Node > H3D::X3D::createVRMLNodeFromStream ( istream &  in,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create a H3D Node given VRML data as a istream.

Parameters
inThe input stream to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the stream.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the stream.
Returns
The created Node.

References H3D::X3DGroupingNode::children, and H3DUtil::AutoRef< class >::reset().

◆ createVRMLNodeFromString()

AutoRef< Node > H3D::X3D::createVRMLNodeFromString ( const string &  str,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create a H3D Node given VRML data as a string.

Parameters
strThe input string to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the string.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the string.
Returns
The created Node.

References H3D::X3DGroupingNode::children, and H3DUtil::AutoRef< class >::reset().

Referenced by createVRMLNodeFromURL().

◆ createVRMLNodeFromURL()

AutoRef< Node > H3D::X3D::createVRMLNodeFromURL ( const string &  urn,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
bool  change_base_path_during_parsing = true 
)

Create a H3D Node given VRML data as a URL.

Parameters
urnThe input URL to read VRML data from.
dnA DEFNodes structure to store the DEF nodes found in the URL.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the URL.
change_base_path_during_parsingIf true, the base path of the ResourceResolver will be set to the part of urn that is before the file name during parsing of this file. E.g. if urn is /test/test.x3d, the base path will be set to /test/. If false, it will remain what it was before calling this function.
Returns
The created Node.

References H3D::X3DGroupingNode::children, createVRMLNodeFromString(), H3DUtil::ResourceResolver::getBaseURL(), H3DUtil::ResourceResolver::getURNResolver(), H3DUtil::ResourceResolver::releaseTmpFileName(), H3DUtil::AutoRef< class >::reset(), H3DUtil::ResourceResolver::resolveURLAsFile(), H3DUtil::ResourceResolver::resolveURLAsString(), H3DUtil::URNResolver::resolveURN(), and H3DUtil::ResourceResolver::setBaseURL().

◆ createX3DFromStream()

Group * H3D::X3D::createX3DFromStream ( istream &  in,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
const string &  system_id = "<stream input>" 
)

Create H3D nodes given X3D data as a istream.

Parameters
inThe input stream to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the stream.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the stream.
system_idName of the source of the stream, e.g. file name.
Returns
A Group containing the nodes created.

References H3D::X3DGroupingNode::children, createX3DNodeFromStream(), and H3DUtil::AutoRef< class >::get().

◆ createX3DFromString()

Group * H3D::X3D::createX3DFromString ( const string &  str,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create H3D nodes given X3D data as a string.

Parameters
strThe input string to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the string.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the string.
Returns
A Group containing the nodes created.

Referenced by createX3DFromURL(), H3D::FBODebugger::FBODebugger(), and H3D::Inline::LoadedScene::update().

◆ createX3DFromURL()

Group * H3D::X3D::createX3DFromURL ( const string &  urn,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
bool  change_base_path_during_parsing = true 
)

Create H3D nodes given X3D data as a URL.

Parameters
urnThe input URL to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the URL.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the URL.
change_base_path_during_parsingIf true, the base path of the ResourceResolver will be set to the part of urn that is before the file name during parsing of this file. E.g. if urn is /test/test.x3d, the base path will be set to /test/. If false, it will remain what it was before calling this function.
Returns
A Group containing the nodes created.

References createX3DFromString(), H3DUtil::ResourceResolver::getBaseURL(), H3DUtil::ResourceResolver::getURNResolver(), H3DUtil::ResourceResolver::resolveURLAsFile(), H3DUtil::ResourceResolver::resolveURLAsString(), H3DUtil::URNResolver::resolveURN(), and H3DUtil::ResourceResolver::setBaseURL().

Referenced by H3D::Scene::loadSceneRoot(), H3D::Anchor::replaceSceneRoot(), H3D::Anchor::GeometrySelected::update(), and H3D::Inline::LoadedScene::update().

◆ createX3DNodeFromStream()

AutoRef< Node > H3D::X3D::createX3DNodeFromStream ( istream &  in,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
const string &  system_id = "<stream input>" 
)

Create a H3D Node given X3D data as a istream.

Parameters
inThe input stream to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the stream.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the stream.
system_idName of the source of the stream, e.g. file name.
Returns
The created Node.

Referenced by createX3DFromStream().

◆ createX3DNodeFromString()

AutoRef< Node > H3D::X3D::createX3DNodeFromString ( const string &  str,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL 
)

Create a H3D Node given X3D data as a string.

Parameters
strThe input string to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the string.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the string.
Returns
The created Node.

Referenced by createX3DNodeFromURL(), H3D::ShadowCaster::render(), H3D::HAnimJoint::renderSkeleton(), and H3D::X3DTextureNode::renderToImage().

◆ createX3DNodeFromURL()

AutoRef< Node > H3D::X3D::createX3DNodeFromURL ( const string &  urn,
DEFNodes dn = NULL,
DEFNodes exported_nodes = NULL,
PrototypeVector *  prototypes = NULL,
bool  change_base_path_during_parsing = true 
)

Create a H3D Node given X3D data as a URL.

Parameters
urnThe input URL to read X3D data from.
dnA DEFNodes structure to store the DEF nodes found in the URL.
exported_nodesA DEFNodes structure to store the nodes that are exported with the EXPORT statement.
prototypesA map from the PROTO declaration nodes specified in the URL.
change_base_path_during_parsingIf true, the base path of the ResourceResolver will be set to the part of urn that is before the file name during parsing of this file. E.g. if urn is /test/test.x3d, the base path will be set to /test/. If false, it will remain what it was before calling this function.
Returns
The created Node.

References createX3DNodeFromString(), H3DUtil::ResourceResolver::getBaseURL(), H3DUtil::ResourceResolver::getURNResolver(), H3DUtil::ResourceResolver::resolveURLAsFile(), H3DUtil::ResourceResolver::resolveURLAsString(), H3DUtil::URNResolver::resolveURN(), and H3DUtil::ResourceResolver::setBaseURL().

Referenced by H3D::Scene::Scene().

◆ writeGeometryAsSTL()

H3DAPI_API void H3D::X3D::writeGeometryAsSTL ( ostream &  os,
X3DGeometryNode geom,
const string &  name = "",
bool  use_binary_format = false 
)

Write the triangles rendered by the geometry node as STL to the given ostream.

The name parameter specifies the name to use in the stl file for the solid.

◆ X3DStringTo2DImage()

PixelImage * H3D::X3D::X3DStringTo2DImage ( const string &  x3d_string)

Convert a string to a PixelImage according to the X3D/XML field encoding for SFImage.

Parameters
x3d_stringThe string to convert.
Returns
The converted value.
Exceptions
Convert::X3DFieldConversionError

References H3D::X3D::Convert::getValue< int >(), and H3D::X3D::Convert::skipWhitespaces().

Referenced by H3D::X3DTexture2DNode::SFImage::setValueFromString().

◆ X3DStringTo3DImage()

PixelImage * H3D::X3D::X3DStringTo3DImage ( const string &  x3d_string)

Convert a string to a 3D PixelImage according to the X3D spec for Pixel3DTexture.

Parameters
x3d_stringThe string to convert.
Returns
The converted value.
Exceptions
Convert::X3DFieldConversionError

References H3D::X3D::Convert::getValue< int >(), and H3D::X3D::Convert::skipWhitespaces().

Referenced by H3D::H3DImageObject::SFImage::setValueFromString(), and H3D::X3DTexture3DNode::SFImage::setValueFromString().

◆ X3DStringToValue()

template<class Type >
Type H3D::X3D::X3DStringToValue ( const string &  x3d_string)

Convert a string to a specified type according to the X3D/XML field encoding.

Template Parameters
TypeThe type to convert the string to.
Parameters
x3d_stringThe string to convert.
Returns
The converted value.
Exceptions
Convert::X3DFieldConversionError\ returns The string converted to class Type.

References H3D::X3D::Convert::skipWhitespaces().

◆ X3DStringToVector()

template<class VectorType >
void H3D::X3D::X3DStringToVector ( const string &  x3d_string,
VectorType &  values 
)
inline

Convert a string to a vector of a specified type according to the X3D/XML field encoding.

Template Parameters
VectorTypeThe vector type to store the converted types in.
Parameters
x3d_stringThe string to convert.
valuesThe return vector.
Exceptions
Convert::X3DFieldConversionError

References H3D::X3D::Convert::getValue(), H3D::X3D::Convert::skipWhitespaces(), and H3D::X3D::Convert::skipWhitespacesAndCommas().

◆ X3DStringToVector< vector< string > >()

template<>
void H3D::X3D::X3DStringToVector< vector< string > > ( const string &  x3d_string,
vector< string > &  values 
)
inline

Template specializaion for handling the case of MFString where the the values are specified as e.g.

'"WALK" "ANY"'

Parameters
x3d_stringThe string to convert.
valuesThe return vector.
Exceptions
Convert::X3DFieldConversionError

References H3D::X3D::Convert::getQuoteEnclosedStringValue(), H3D::X3D::Convert::getValue< string >(), H3D::X3D::Convert::skipWhitespaces(), and H3D::X3D::Convert::skipWhitespacesAndCommas().