All Packages Class Hierarchy This Package Previous Next Index
Class vlc.vrml.generic.geometry.VrmlObject
java.lang.Object
|
+----vlc.vrml.generic.geometry.VrmlObject
- public abstract class VrmlObject
- extends Object
- implements Cloneable
JVerge
- Version:
- 0.8 (beta 4)
Copyright 1997
The Virtual Light Company
under the
GNU LGPL
The latest information and bugs in JVerge can be found at
http://www.vlc.com.au/JVerge
VRML base object definition
There are three main pieces of information. The name is the DEF name
associated with this object. The Node is the information returned from
the createVrmlFromString call. And the Type is the type represented
as an integer from the VrmlTypes.java.
A reference count is also available. This is used to determine if this node
has been used in the scene graph already. If the reference count is 0 then it
has not been added. The first node to add this node should increment the
reference count and also note that it is the first to use the node.
This class is also used as the base class of the other forms of JVerge
classes. Provides a common starting point for all the classes allowing
as much freedom within your applocation details as possible. If you
need to make the code portable, make sure that you pass this version of
VrmlObject around as everything exists as a subclass of this class.
- Author:
- Justin Couch justin@vlc.com.au
-
default_name
- The default name to be used by the node if no DEF name has been set.
-
DEFAULT_WRAP_NUMBER
- The default number of field values to wrap to the new line
-
indent_string
- The string representing the indent of this node for printing
-
name
- The DEF name of the node.
-
outputStream
- The PrintStream that is used to print the output to.
-
reference_count
- The current number of references that are made to this node.
-
type
- What type the derived node is.
-
userData
- Allows the user to carray around extra data with this node if you so
desire.
-
wrapLevel
- Used to defined how many items should be printed on a line for MF fields
-
VrmlObject()
-
-
cleanup()
- Called just before a node is to be deleted by its parent.
-
clone()
- Make a clone of this object
-
get_nodeType()
-
-
toString()
-
-
writeMFColor(String, String, float[][])
- Write out an MFColor field.
-
writeMFFloat(String, String, float[])
- Write out an MFFloat field.
-
writeMFInt32(String, String, int[])
- Write out an MFInt32 field.
-
writeMFRotation(String, String, float[][])
- Write out an MFRotation field.
-
writeMFString(String, String, String[])
- Write out an MFString field.
-
writeMFVec2f(String, String, float[][])
- Write out an MFVec2f field.
-
writeMFVec3f(String, String, float[][])
- Write out an MFVec3f field.
-
writeNodeHeader(String, boolean, int)
- Write the node header consisting of the DEF/USE information and node name.
-
writeReset()
- Used for maintaining the reference counting when trying to do DEF/USE in
the write to stream method.
-
writeToStream(int)
- Write the contents of this node out.
-
writeToStream(PrintStream, int)
- Called when needing to write information to a stream
Deprecated.
DEFAULT_WRAP_NUMBER
public static final int DEFAULT_WRAP_NUMBER
- The default number of field values to wrap to the new line
type
protected int type
- What type the derived node is. Values is detemined by the VrmlTypes class
- See Also:
- VrmlTypes
name
public String name
- The DEF name of the node. If no name is defined then this should be null
default_name
protected String default_name
- The default name to be used by the node if no DEF name has been set.
outputStream
public static PrintStream outputStream
- The PrintStream that is used to print the output to. The default value is
to send everything to System.out. If you wish to change this then set
the value directly before calling writeToStream
reference_count
public int reference_count
- The current number of references that are made to this node.
reference_count is publicly accessible so that you can do cut and paste
with these nodes. The problem is that normally you would just delete the
node, but a removeChildren event deletes the entire node. If there is
only one reference to it then you end up deleting all the node structures
beneath it. To fix, you can trick the library into thinking that there is
an extra reference to this node first by incrementing this node during
the cut and then decrementing again after the paste.
userData
public Object userData
- Allows the user to carray around extra data with this node if you so
desire. JVerge does not use this so you are free to do what you like.
wrapLevel
public int wrapLevel
- Used to defined how many items should be printed on a line for MF fields
indent_string
protected String indent_string
- The string representing the indent of this node for printing
VrmlObject
public VrmlObject()
cleanup
public void cleanup()
- Called just before a node is to be deleted by its parent. A blank
version is provided for nodes that don't need to do anything. The default
version just reduces the reference_count by one each time this node is
told to clean itself up.
writeToStream
public void writeToStream(PrintStream fp,
int indent)
- Note: writeToStream() is deprecated.
Pleas use the writeToStream(int) method and set outputStream.
- Called when needing to write information to a stream
writeToStream
public abstract void writeToStream(int indent)
- Write the contents of this node out. The contents are written to
outputStream with each line beginning at least at the nominated indent.
toString
public String toString()
- Overrides:
- toString in class Object
get_nodeType
public int get_nodeType()
- Returns:
- The integer representing the type of this node. The value is
defined by
- See Also:
- VrmlType
writeReset
public void writeReset()
- Used for maintaining the reference counting when trying to do DEF/USE in
the write to stream method.
writeNodeHeader
protected boolean writeNodeHeader(String nodeName,
boolean continued,
int indent)
- Write the node header consisting of the DEF/USE information and node name.
If this is a USED node then let the caller know by returning true.
- Parameters:
- nodeName - The name of this type of node
- continued - True if this node is following on a field definition
- Returns:
- true if this node has been USEd and no further output required
writeMFColor
protected void writeMFColor(String buffer,
String fieldname,
float values[][])
- Write out an MFColor field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFFloat
protected void writeMFFloat(String buffer,
String fieldname,
float values[])
- Write out an MFFloat field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFInt32
protected void writeMFInt32(String buffer,
String fieldname,
int values[])
- Write out an MFInt32 field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFRotation
protected void writeMFRotation(String buffer,
String fieldname,
float values[][])
- Write out an MFRotation field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFString
protected void writeMFString(String buffer,
String fieldname,
String values[])
- Write out an MFString field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFVec2f
protected void writeMFVec2f(String buffer,
String fieldname,
float values[][])
- Write out an MFVec2f field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
writeMFVec3f
protected void writeMFVec3f(String buffer,
String fieldname,
float values[][])
- Write out an MFVec3f field. This does not check for default values
or any errors. It assumes that the indent is correct and the
printstream is correctly specified. The buffer assumes you have the
correct amount of indent for this field relative to the parent.
- Parameters:
- buffer - A buffer of spaces that preceed each line of text
- fieldname - The name of the field that is being printed
- values - The values to be printed out.
clone
public Object clone()
- Make a clone of this object
- Returns:
- A complete clone of this object
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index