|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.web3d.vrml.export.Exporter
org.web3d.vrml.export.X3DClassicExporter
X3D Classic VRML encoding Expoter. The pretty printing on this is pretty bad. Routes are pushed to the end of the execution space, spacing is off and comments are lost. In the future this may be fixed, but its not a trivial problem. WARNING: Do not change the location of a push or pop unless you really test the results. This class must track when a MFField ends. The rules for this are fairly complex. A field starts either on a startField, protoFieldDecl or scriptFieldDecl. it ends on another startField/scriptfield/protofield, an endProtoDecl, endScriptDecl or endNode which had at least one field decl and an IS decl and a fieldValue call. yesh. startField pushs these stacks: inFieldType currentField nodeCnt -- all fields, only MFNode fieldDecl on the end of the field it pops these stacks. startNode pushes these stacks: fieldCnt
| Field Summary | |
protected VRMLScriptNodeType |
currentScript
Copy of the current working script definition |
protected java.util.HashMap |
externProtoMap
The mapping of externproto names (key) to node instances (value) |
protected static VRMLFieldReader |
fieldParser
Field Parser |
static int |
INDENT_SIZE
|
protected java.util.HashMap |
protoMap
The mapping of proto names (key) to node instances (value) |
| Fields inherited from class org.web3d.vrml.export.Exporter |
majorVersion, minorVersion |
| Constructor Summary | |
X3DClassicExporter(java.io.OutputStream os,
int major,
int minor)
Public Constructor. |
|
| Method Summary | |
void |
componentDecl(java.lang.String componentName)
A component declaration has been found in the code. |
void |
endDocument()
Declaration of the end of the document. |
void |
endExternProtoDecl()
Notification of the end of an EXTERNPROTO declaration. |
void |
endField()
Notification of the end of a field declaration. |
void |
endNode()
Notification of the end of a node declaration. |
void |
endProtoBody()
Notification of the end of an ordinary proto body. |
void |
endProtoDecl()
Notification of the end of an ordinary proto declaration statement. |
void |
endScriptDecl()
Notification of the end of a script declaration. |
void |
exportDecl(java.lang.String defName,
java.lang.String exported)
An EXPORT declaration has been found in the document. |
void |
externProtoURI(java.lang.String[] values)
Notification of the URI list for an EXTERNPROTO. |
void |
fieldValue(java.lang.String value)
The value of a normal field. |
void |
fieldValue(java.lang.String[] values)
The value of an MFField where the underlying parser knows about how the values are broken up. |
void |
importDecl(java.lang.String inline,
java.lang.String exported,
java.lang.String imported)
An IMPORT declaration has been found in the document. |
void |
metaDecl(java.lang.String key,
java.lang.String value)
A META declaration has been found in the code. |
void |
profileDecl(java.lang.String profileName)
A profile declaration has been found in the code. |
void |
protoFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
Notification of a proto's field declaration. |
void |
protoIsDecl(java.lang.String fieldName)
Notification of a field value uses an IS statement. |
void |
routeDecl(java.lang.String srcNode,
java.lang.String srcField,
java.lang.String destNode,
java.lang.String destField)
Notification of a ROUTE declaration in the file. |
void |
scriptFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
Notification of a script's field declaration. |
void |
setDocumentLocator(Locator loc)
Set the document locator that can be used by the implementing code to find out information about the current line information. |
void |
startDocument(java.lang.String uri,
java.lang.String url,
java.lang.String encoding,
java.lang.String type,
java.lang.String version,
java.lang.String comment)
Declaration of the start of the document. |
void |
startExternProtoDecl(java.lang.String name)
Notification of the start of an EXTERNPROTO declaration of the given name. |
void |
startField(java.lang.String name)
Notification of a field declaration. |
void |
startNode(java.lang.String name,
java.lang.String defName)
Notification of the start of a node. |
void |
startProtoBody()
Notification of the start of an ordinary proto body. |
void |
startProtoDecl(java.lang.String name)
Notification of the start of an ordinary (inline) proto declaration. |
void |
startScriptDecl()
Notification of the start of a script declaration. |
void |
useDecl(java.lang.String defName)
The field value is a USE for the given node name. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int INDENT_SIZE
protected static VRMLFieldReader fieldParser
protected java.util.HashMap protoMap
protected java.util.HashMap externProtoMap
protected VRMLScriptNodeType currentScript
| Constructor Detail |
public X3DClassicExporter(java.io.OutputStream os,
int major,
int minor)
os - The stream to send output to.major - The major version number of this sceneminor - The minor version number of this scene| Method Detail |
public void setDocumentLocator(Locator loc)
startDocument() has
been called, you can assume that you will not have one available.
loc - The locator instance to use
public void startDocument(java.lang.String uri,
java.lang.String url,
java.lang.String encoding,
java.lang.String type,
java.lang.String version,
java.lang.String comment)
throws SAVException,
VRMLException
# start. The type string contains the representation of
the first few characters of the file after the #. This allows us to
work out if it is VRML97 or the later X3D spec.
Version numbers change from VRML97 to X3D and aren't logical. In the
first, it is #VRML V2.0 and the second is
#X3D V1.0 even though this second header represents a
later spec.
uri - The URI of the file.url - The base URL of the file for resolving relative URIs
contained in the fileencoding - The encoding of this document - utf8 or binarytype - The bytes of the first part of the file headerversion - The VRML version of this documentcomment - Any trailing text on this line. If there is none, this
is null.
SAVException - This call is taken at the wrong time in the
structure of the document
VRMLException - The content provided is invalid for this
part of the document or can't be parsed
public void profileDecl(java.lang.String profileName)
throws SAVException,
VRMLException
profileName - The name of the profile to use
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void componentDecl(java.lang.String componentName)
throws SAVException,
VRMLException
componentName - The name of the component to use
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void metaDecl(java.lang.String key,
java.lang.String value)
throws SAVException,
VRMLException
key - The value of the key stringvalue - The value of the value string
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void importDecl(java.lang.String inline,
java.lang.String exported,
java.lang.String imported)
throws SAVException,
VRMLException
inline - The name of the inline DEF nodesexported - The exported name from the inlined fileimported - The local name to use for the exported name
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void exportDecl(java.lang.String defName,
java.lang.String exported)
throws SAVException,
VRMLException
defName - The DEF name of the nodes to be exportedexported - The name to be exported as
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endDocument()
throws SAVException,
VRMLException
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startNode(java.lang.String name,
java.lang.String defName)
throws SAVException,
VRMLException
name - The name of the node that we are about to parsedefName - The string associated with the DEF name. Null if not
given for this node.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endNode()
throws SAVException,
VRMLException
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startField(java.lang.String name)
throws SAVException,
VRMLException
ScriptHandler or ProtoHandler methods are
used.
name - The name of the field declared
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(java.lang.String value)
throws SAVException,
VRMLException
startField() or endNode().
If this field is an SFNode with a USE declaration you will have the
useDecl(String) method called rather than this method. If the
SFNode is empty the value returned here will be "NULL".
There are times where we have an MFField that is declared in the file to be empty. To signify this case, this method will be called with a parameter value of null. A lot of the time this is because we can't really determine if the incoming node is an MFNode or not.
value - The value of this field
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void fieldValue(java.lang.String[] values)
throws SAVException,
VRMLException
values - The list of string representing the values
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void useDecl(java.lang.String defName)
throws SAVException,
VRMLException
startField() or endNode().
defName - The name of the DEF string to use
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endField()
throws SAVException,
VRMLException
useDecl(String) or fieldValue(String). This
will only ever be called if there have been nodes declared. If no nodes
have been declared (ie "[]") then you will get a
fieldValue(). call with the parameter value of null.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void routeDecl(java.lang.String srcNode,
java.lang.String srcField,
java.lang.String destNode,
java.lang.String destField)
throws SAVException,
VRMLException
srcNode - The name of the DEF of the source nodesrcField - The name of the field to route values fromdestNode - The name of the DEF of the destination nodedestField - The name of the field to route values to
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException
public void startScriptDecl()
throws SAVException,
VRMLException
endScriptDecl() call belong to this
script node. This method will be called after the ContentHandler
startNode() method call. All DEF information is contained
in that method call and this just signifies the start of script
processing so that we know to treat the field parsing callbacks a
little differently.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endScriptDecl()
throws SAVException,
VRMLException
endNode() callback.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void scriptFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
throws SAVException,
VRMLException
url, mustEvaluate and
directOutput fields. These fields use the normal field
callbacks of ContentHandler.
If the current parsing is in a proto and the field "value" is defined
with an IS statement then the value returned here is null. There will
be a subsequent call to the ProtoHandlers protoIsDecl()
method with the name of the field included.
access - The access type (eg exposedField, field etc)type - The field type (eg SFInt32, MFVec3d etc)name - The name of the fieldvalue - The default value of the field as either String or
String[]. Null if not allowed.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startProtoDecl(java.lang.String name)
throws SAVException,
VRMLException
name - The name of the proto
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endProtoDecl()
throws SAVException,
VRMLException
startProtoBody() Then that method should toss an
exception.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void protoFieldDecl(int access,
java.lang.String type,
java.lang.String name,
java.lang.Object value)
throws SAVException,
VRMLException
access - The access type (eg exposedField, field etc)type - The field type (eg SFInt32, MFVec3d etc)name - The name of the fieldvalue - The default value of the field as either String or
String[]. Null if not allowed.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void protoIsDecl(java.lang.String fieldName)
throws SAVException,
VRMLException
fieldName - The name of the field that is being IS'd
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startProtoBody()
throws SAVException,
VRMLException
endProtoBody() statement form the body and not the normal
scenegraph information.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endProtoBody()
throws SAVException,
VRMLException
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void startExternProtoDecl(java.lang.String name)
throws SAVException,
VRMLException
endExternProtoDecl() call
you should only receive protoFieldDecl(int, java.lang.String, java.lang.String, java.lang.Object) calls.
name - The node name of the extern proto
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void endExternProtoDecl()
throws SAVException,
VRMLException
externProtoURI(java.lang.String[]) Then that method should toss an
exception.
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
public void externProtoURI(java.lang.String[] values)
throws SAVException,
VRMLException
values - A list of strings representing all of the URI values
SAVException - This call is taken at the wrong time in the
structure of the document.
VRMLException - This call is taken at the wrong time in the
structure of the document.
|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||