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

Variable Index

 o default_name
The default name to be used by the node if no DEF name has been set.
 o DEFAULT_WRAP_NUMBER
The default number of field values to wrap to the new line
 o indent_string
The string representing the indent of this node for printing
 o name
The DEF name of the node.
 o outputStream
The PrintStream that is used to print the output to.
 o reference_count
The current number of references that are made to this node.
 o type
What type the derived node is.
 o userData
Allows the user to carray around extra data with this node if you so desire.
 o wrapLevel
Used to defined how many items should be printed on a line for MF fields

Constructor Index

 o VrmlObject()

Method Index

 o cleanup()
Called just before a node is to be deleted by its parent.
 o clone()
Make a clone of this object
 o get_nodeType()
 o toString()
 o writeMFColor(String, String, float[][])
Write out an MFColor field.
 o writeMFFloat(String, String, float[])
Write out an MFFloat field.
 o writeMFInt32(String, String, int[])
Write out an MFInt32 field.
 o writeMFRotation(String, String, float[][])
Write out an MFRotation field.
 o writeMFString(String, String, String[])
Write out an MFString field.
 o writeMFVec2f(String, String, float[][])
Write out an MFVec2f field.
 o writeMFVec3f(String, String, float[][])
Write out an MFVec3f field.
 o writeNodeHeader(String, boolean, int)
Write the node header consisting of the DEF/USE information and node name.
 o writeReset()
Used for maintaining the reference counting when trying to do DEF/USE in the write to stream method.
 o writeToStream(int)
Write the contents of this node out.
 o writeToStream(PrintStream, int)
Called when needing to write information to a stream Deprecated.

Variables

 o DEFAULT_WRAP_NUMBER
 public static final int DEFAULT_WRAP_NUMBER
The default number of field values to wrap to the new line

 o type
 protected int type
What type the derived node is. Values is detemined by the VrmlTypes class

See Also:
VrmlTypes
 o name
 public String name
The DEF name of the node. If no name is defined then this should be null

 o default_name
 protected String default_name
The default name to be used by the node if no DEF name has been set.

 o 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

 o 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.

 o 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.

 o wrapLevel
 public int wrapLevel
Used to defined how many items should be printed on a line for MF fields

 o indent_string
 protected String indent_string
The string representing the indent of this node for printing

Constructors

 o VrmlObject
 public VrmlObject()

Methods

 o 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.

 o 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

 o 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.

 o toString
 public String toString()
Overrides:
toString in class Object
 o get_nodeType
 public int get_nodeType()
Returns:
The integer representing the type of this node. The value is defined by
See Also:
VrmlType
 o writeReset
 public void writeReset()
Used for maintaining the reference counting when trying to do DEF/USE in the write to stream method.

 o 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
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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