VRML 2.0 Java API

VRML 2.0 Java API

History

  • Thu Aug 30 1996: First version( Community Place )

  • O : Implemented
  • * : Only implemented for class instances created using the class constructor - not available for instances created from getField/getEventIn/get...etc.
  • X : Unimplemented (No interfaces)


    Index

    vrml package

  • vrml.Field
  • vrml.ConstField
  • vrml.ConstMField
  • vrml.MField
  • vrml.Event
  • vrml.Browser
  • vrml.BaseNode

    vrml.field package

  • vrml.field.ConstSFBool
  • vrml.field.ConstSFColor
  • vrml.field.ConstSFFloat
  • vrml.field.ConstSFImage
  • vrml.field.ConstSFInt32
  • vrml.field.ConstSFNode
  • vrml.field.ConstSFRotation
  • vrml.field.ConstSFString
  • vrml.field.ConstSFTime
  • vrml.field.ConstSFVec2f
  • vrml.field.ConstSFVec3f
  • vrml.field.ConstMFColor
  • vrml.field.ConstMFFloat
  • vrml.field.ConstMFInt32
  • vrml.field.ConstMFNode
  • vrml.field.ConstMFRotation
  • vrml.field.ConstMFString
  • vrml.field.ConstMFTime
  • vrml.field.ConstMFVec2f
  • vrml.field.ConstMFVec3f
  • vrml.field.SFBool
  • vrml.field.SFColor
  • vrml.field.SFFloat
  • vrml.field.SFImage
  • vrml.field.SFInt32
  • vrml.field.SFNode
  • vrml.field.SFRotation
  • vrml.field.SFString
  • vrml.field.SFTime
  • vrml.field.SFVec2f
  • vrml.field.SFVec3f
  • vrml.field.MFColor
  • vrml.field.MFFloat
  • vrml.field.MFInt32
  • vrml.field.MFNode
  • vrml.field.MFRotation
  • vrml.field.MFString
  • vrml.field.MFTime
  • vrml.field.MFVec2f
  • vrml.field.MFVec3f

    vrml.node package

  • vrml.node.Node
  • vrml.node.Script

    Appendix vs package

    vs package contains the mult user shared behavior API.

  • vs.Vscp

    vrml package

    public abstract class Field implements Cloneable
    {
    O   public Object clone();
    }
    
    public abstract class ConstField extends Field
    {
    }
    
    public abstract class ConstMField extends ConstField
    {
    O   public abstract int getSize();
    }
    
    public abstract class MField extends Field
    {
    O   public abstract int getSize();
    X   public abstract void clear();
    X   public abstract void delete(int index);
    }
    
    public class Event implements Cloneable {
    O  public String getName();
    O  public double getTimeStamp();
    O  public ConstField getValue();
    O  public Object clone();
    }
    
    public class Browser {
      // Browser interface
    O  public String getName();      
    O  public String getVersion();   
    
    X  public float getCurrentSpeed();
    
    X  public float getCurrentFrameRate();
    
    O  public String getWorldURL();
    X  public void replaceWorld(BaseNode[] nodes);
    
    O  public BaseNode[] createVrmlFromString(String vrmlSyntax)
        throws InvalidVRMLSyntaxException;
    
    O  public void createVrmlFromURL(String[] url, BaseNode node, String event)
    
    O  public void addRoute(BaseNode fromNode, String fromEventOut,
        BaseNode toNode, String toEventIn);
    O  public void deleteRoute(BaseNode fromNode, String fromEventOut,
        BaseNode toNode, String toEventIn);
    
    O  public void loadURL(String[] url, String[] parameter)
    
    O  public void setDescription(String description);
    }
    
    //
    // This is the general BaseNode class
    // 
    public abstract class BaseNode 
    {
      // Returns the type of the node.  If the node is a prototype
      //   it returns the name of the prototype.
    O  public String getType();
    
      // Get the Browser that this node is contained in.
    O  public Browser getBrowser();
    }
    
    

    vrml.field package

    public class ConstSFBool extends ConstField
    {
    O   public boolean getValue();
    }
    
    public class ConstSFColor extends ConstField
    {
    O   public void getValue(float color[]);
    O   public float getRed();
    O   public float getGreen();
    O   public float getBlue();
    }
    
    public class ConstSFFloat extends ConstField
    {
    O   public float getValue();
    }
    
    Xpublic class ConstSFImage extends ConstField
    {
    X   public int getWidth();
    X   public int getHeight();
    X   public int getComponents();
    X   public void getPixels(byte pixels[]);
    }
    
    public class ConstSFInt32 extends ConstField
    {
    O   public int getValue();
    }
    
    public class ConstSFNode extends ConstField
    {
      /* *****************************************
       * Return value of getValue() must extend BaseNode class.
       * The concrete class is implementation dependent 
       * and up to browser implementation. 
       ****************************************** */
    O   public BaseNode getValue();
    }
    
    public class ConstSFRotation extends ConstField
    {
    O   public void getValue(float[] rotation);
    }
    
    public class ConstSFString extends ConstField
    {
    O   public String getValue();
    }
    
    public class ConstSFTime extends ConstField
    {
    O   public double getValue();
    }
    
    public class ConstSFVec2f extends ConstField
    {
    O   public void getValue(float vec2[]);
    O   public float getX();
    O   public float getY();
    }
    
    public class ConstSFVec3f extends ConstField
    {
    O   public void getValue(float vec3[]);
    O   public float getX();
    O   public float getY();
    O   public float getZ();
    }
    
    public class ConstMFColor extends ConstMField
    {
    O   public void getValue(float colors[][]);
    O   public void getValue(float colors[]);
    *   public void get1Value(int index, float color[]);
    *   public void get1Value(int index, SFColor color);
    }
    
    public class ConstMFFloat extends ConstMField
    {
    O   public void getValue(float values[]);
    *   public float get1Value(int index);
    }
    
    public class ConstMFInt32 extends ConstMField
    {
    O   public void getValue(int values[]);
    *   public int get1Value(int index);
    }
    
    Xpublic class ConstMFNode extends ConstMField
    {
      /******************************************
       * Return value of getValue() must extend BaseNode class.
       * The concrete class is implementation dependent 
       * and up to browser implementation. 
       *******************************************/ 
    O   public void getValue(BaseNode values[]);
    X   public BaseNode get1Value(int index);
    }
    
    public class ConstMFRotation extends ConstMField
    {
    O   public void getValue(float rotations[][]);
    O   public void getValue(float rotations[]);
    *   public void get1Value(int index, float rotation[]);
    *   public void get1Value(int index, SFRotation rotation);
    }
    
    public class ConstMFString extends ConstMField
    {
    O   public void getValue(String values[]);
    *   public String get1Value(int index);
    }
    
    public class ConstMFTime extends ConstMField
    {
    O   public void getValue(double times[]);
    *   public double get1Value(int index);
    }
    
    public class ConstMFVec2f extends ConstMField
    {
    O   public void getValue(float vecs[][]);
    O   public void getValue(float vecs[]);
    *   public void get1Value(int index, float vec[]);
    *   public void get1Value(int index, SFVec2f vec);
    }
    
    public class ConstMFVec3f extends ConstMField
    {
    O   public void getValue(float vecs[][]);
    O   public void getValue(float vecs[]);
    *   public void get1Value(int index, float vec[]);
    *   public void get1Value(int index, SFVec3f vec);
    }
    
    public class SFBool extends Field
    {
    O   public SFBool(boolean value);
    O   public boolean getValue();
    O   public void setValue(boolean b);
    O   public void setValue(ConstSFBool b);
    O   public void setValue(SFBool b);
    }
    
    public class SFColor extends Field
    {
    O   public SFColor(float red, float green, float blue);
    O   public void getValue(float color[]);
    O   public float getRed();
    O   public float getGreen();
    O   public float getBlue();
    O   public void setValue(float color[]);
    O   public void setValue(float red, float green, float blue);
    O   public void setValue(ConstSFColor color);
    O   public void setValue(SFColor color);
    }
    
    public class SFFloat extends Field
    {
    O   public SFFloat(float f);
    O   public float getValue();
    O   public void setValue(float f);
    O   public void setValue(ConstSFFloat f);
    O   public void setValue(SFFloat f);
    }
    
    Xpublic class SFImage extends Field
    {
    X   public SFImage(int width, int height, int components, byte pixels[]);
    X   public int getWidth();
    X   public int getHeight();
    X   public int getComponents();
    X   public void getPixels(byte pixels[]);
    X   public void setValue(int width, int height, int components,
                            byte pixels[]);
    X   public void setValue(ConstSFImage image);
    X   public void setValue(SFImage image);
    }
    
    public class SFInt32 extends Field
    {
    O   public SFInt32(int value);
    O   public int getValue();
    O   public void setValue(int i);
    O   public void setValue(ConstSFInt32 i);
    O   public void setValue(SFInt32 i);
    }
    
    public class SFNode extends Field
    {
    O   public SFNode(BaseNode node);
    
      /******************************************
       * Return value of getValue() must extend BaseNode class.
       * The concrete class is implementation dependent 
       * and up to browser implementation. 
       *******************************************/ 
    O   public BaseNode getValue();
    O   public void setValue(BaseNode node);
    O   public void setValue(ConstSFNode node);
    O   public void setValue(SFNode node);
    }
    
    public class SFRotation extends Field
    {
    O   public SFRotation(float axisX, float axisY, float axisZ, float rotation);
    O   public void getValue(float[] rotation);
    O   public void setValue(float[] rotation);
    O   public void setValue(float axisX, float axisY, float axisZ, float rotation);
    O   public void setValue(ConstSFRotation rotation);
    O   public void setValue(SFRotation rotation);
    }
    
    public class SFString extends Field
    {
    O   public SFString(String s);
    O   public String getValue();
    O   public void setValue(String s);
    O   public void setValue(ConstSFString s);
    O   public void setValue(SFString s);
    }
    
    public class SFTime extends Field
    {
    O   public SFTime(double time);
    O   public double getValue();
    O   public void setValue(double time);
    O   public void setValue(ConstSFTime time);
    O   public void setValue(SFTime time);
    }
    
    public class SFVec2f extends Field
    {
    O   public SFVec2f(float x, float y);
    O   public void getValue(float vec[]);
    O   public float getX();
    O   public float getY();
    O   public void setValue(float vec[]);
    O   public void setValue(float x, float y);
    O   public void setValue(ConstSFVec2f vec);
    O   public void setValue(SFVec2f vec);
    }
    
    public class SFVec3f extends Field
    {
    O   public SFVec3f(float x, float y, float z);
    O   public void getValue(float vec[]);
    O   public float getX();
    O   public float getY();
    O   public float getZ();
    O   public void setValue(float vec[]);
    O   public void setValue(float x, float y, float z);
    O   public void setValue(ConstSFVec3f vec);
    O   public void setValue(SFVec3f vec);
    }
    
    public class MFColor extends MField
    {
    O   public MFColor(float value[][]);
    O   public MFColor(float value[]);
    O   public MFColor(int size, float value[]);
    
    O   public void getValue(float colors[][]);
    O   public void getValue(float colors[]);
    
    O   public void setValue(float colors[][]);
    O   public void setValue(int size, float colors[]);
       /****************************************************
        color[0] ... color[size - 1] are used as color data
        in the way that color[0], color[1], and color[2] 
        represent the first color. The number of colors
        is defined as "size / 3".
        ***************************************************/
    
    O   public void setValue(ConstMFColor colors);
    
    *   public void get1Value(int index, float color[]);
    *   public void get1Value(int index, SFColor color);
    
    *   public void set1Value(int index, ConstSFColor color);
    *   public void set1Value(int index, SFColor color);
    *   public void set1Value(int index, float red, float green, float blue);
    
    *   public void addValue(ConstSFColor color);
    *   public void addValue(SFColor color);
    *   public void addValue(float red, float green, float blue);
    
    *   public void insertValue(int index, ConstSFColor color);
    *   public void insertValue(int index, SFColor color);
    *   public void insertValue(int index, float red, float green, float blue);
    }
    
    public class MFFloat extends MField
    {
    O   public MFFloat(float values[]);
    
    O   public void getValue(float values[]);
    
    O   public void setValue(float values[]);
    O   public void setValue(int size, float values[]);
    O   public void setValue(ConstMFFloat value);
    
    *   public float get1Value(int index);
    
    *   public void set1Value(int index, float f);
    *   public void set1Value(int index, ConstSFFloat f);
    *   public void set1Value(int index, SFFloat f);
    
    *   public void addValue(float f);
    *   public void addValue(ConstSFFloat f);
    *   public void addValue(SFFloat f);
    
    *   public void insertValue(int index, float f);
    *   public void insertValue(int index, ConstSFFloat f);
    *   public void insertValue(int index, SFFloat f);
    }
    
    public class MFInt32 extends MField
    {
    O   public MFInt32(int values[]);
    
    O   public void getValue(int values[]);
    
    O   public void setValue(int values[]);
    O   public void setValue(int size, int values[]);
    O   public void setValue(ConstMFInt32 value);
    
    *   public int get1Value(int index);
    
    *   public void set1Value(int index, int i);
    *   public void set1Value(int index, ConstSFInt32 i);
    *   public void set1Value(int index, SFInt32 i);
    
    *   public void addValue(int i);
    *   public void addValue(ConstSFInt32 i);
    *   public void addValue(SFInt32 i);
    
    *   public void insertValue(int index, int i);
    *   public void insertValue(int index, ConstSFInt32 i);
    *   public void insertValue(int index, SFInt32 i);
    }
    
    public class MFNode extends MField
    {
    O   public MFNode(BaseNode node[]);
    
      /******************************************
       * Return value of getValue() must extend BaseNode class.
       * The concrete class is implementation dependent 
       * and up to browser implementation. 
       *******************************************/ 
    O   public void getValue(BaseNode node[]);
    
    O   public void setValue(BaseNode node[]);
    O   public void setValue(int size, BaseNode node[]);
    O   public void setValue(ConstMFNode node);
    
    *   public BaseNode get1Value(int index);
    
    *   public void set1Value(int index, BaseNode node);
    *   public void set1Value(int index, ConstSFNode node);
    *   public void set1Value(int index, SFNode node);
    
    *   public void addValue(BaseNode node);
    *   public void addValue(ConstSFNode node);
    *   public void addValue(SFNode node);
    
    *   public void insertValue(int index, BaseNode node);
    *   public void insertValue(int index, ConstSFNode node);
    *   public void insertValue(int index, SFNode node);
    }
    
    public class MFRotation extends MField
    {
    O   public MFRotation(float rotations[][]);
    O   public MFRotation(float rotations[]);
    O   public MFRotation(int size, float rotations[]);
    
    O   public void getValue(float rotations[][]);
    O   public void getValue(float rotations[]);
    
    O   public void setValue(float rotations[][])
    O   public void setValue(int size, float rotations[]);
    O   public void setValue(ConstMFRotation rotations);
    
    *   public void get1Value(int index, float rotation[]);
    *   public void get1Value(int index, SFRotation rotation);
    
    *   public void set1Value(int index, ConstSFRotation rotation);
    *   public void set1Value(int index, SFRotation rotation);
    *   public void set1Value(int index, float ax, float ay, float az, float angle);
    
    *   public void addValue(ConstSFRotation rotation);
    *   public void addValue(SFRotation rotation);
    *   public void addValue(float ax, float ay, float az, float angle);
    
    *   public void insertValue(int index, ConstSFRotation rotation);
    *   public void insertValue(int index, SFRotation rotation);
    *   public void insertValue(int index, float ax, float ay, float az, float angle);
    }
    
    public class MFString extends MField
    {
    O   public MFString(String s[]);
    
    O   public void getValue(String s[]);
    
    O   public void setValue(String s[]);
    O   public void setValue(int size, String s[]);
    O   public void setValue(ConstMFString s);
    
    *   public String get1Value(int index);
    
    *   public void set1Value(int index, String s);
    *   public void set1Value(int index, ConstSFString s);
    *   public void set1Value(int index, SFString s);
    
    *   public void addValue(String s);
    *   public void addValue(ConstSFString s);
    *   public void addValue(SFString s);
    
    *   public void insertValue(int index, String s);
    *   public void insertValue(int index, ConstSFString s);
    *   public void insertValue(int index, SFString s);
    }
    
    public class MFTime extends MField
    {
    O   public MFTime(double times[]);
    
    O   public void getValue(double times[]);
    
    O   public void setValue(double times[]);
    O   public void setValue(int size, double times[]);
    O   public void setValue(ConstMFTime times);
    
    *   public double get1Value(int index);
    
    *   public void set1Value(int index, double time);
    *   public void set1Value(int index, ConstSFTime time);
    *   public void set1Value(int index, SFTime time);
    
    *   public void addValue(double time);
    *   public void addValue(ConstSFTime time);
    *   public void addValue(SFTime time);
    
    *   public void insertValue(int index, double time);
    *   public void insertValue(int index, ConstSFTime time);
    *   public void insertValue(int index, SFTime time);
    }
    
    public class MFVec2f extends MField
    {
    O   public MFVec2f(float vecs[][]);
    O   public MFVec2f(float vecs[]);
    O   public MFVec2f(int size, float vecs[]);
    
    O   public void getValue(float vecs[][]);
    O   public void getValue(float vecs[]);
    
    O   public void setValue(float vecs[][]);
    O   public void setValue(int size, vecs[]);
    O   public void setValue(ConstMFVec2f vecs);
    
    *   public void get1Value(int index, float vec[]);
    *   public void get1Value(int index, SFVec2f vec);
    
    *   public void set1Value(int index, float x, float y);
    *   public void set1Value(int index, ConstSFVec2f vec);
    *   public void set1Value(int index, SFVec2f vec);
    
    *   public void addValue(float x, float y);
    *   public void addValue(ConstSFVec2f vec);
    *   public void addValue(SFVec2f vec);
    
    *   public void insertValue(int index, float x, float y);
    *   public void insertValue(int index, ConstSFVec2f vec);
    *   public void insertValue(int index, SFVec2f vec);
    }
    
    public class MFVec3f extends MField
    {
    O   public MFVec3f(float vecs[][]);
    O   public MFVec3f(float vecs[]);
    O   public MFVec3f(int size, float vecs[]);
    
    O   public void getValue(float vecs[][]);
    O   public void getValue(float vecs[]);
    
    O   public void setValue(float vecs[][]);
    O   public void setValue(int size, float vecs[]);
    O   public void setValue(ConstMFVec3f vecs);
    
    *   public void get1Value(int index, float vec[]);
    *   public void get1Value(int index, SFVec3f vec);
    
    *   public void set1Value(int index, float x, float y, float z);
    *   public void set1Value(int index, ConstSFVec3f vec);
    *   public void set1Value(int index, SFVec3f vec);
    
    *   public void addValue(float x, float y, float z);
    *   public void addValue(ConstSFVec3f vec);
    *   public void addValue(SFVec3f vec);
    
    *   public void insertValue(int index, float x, float y, float z);
    *   public void insertValue(int index, ConstSFVec3f vec);
    *   public void insertValue(int index, SFVec3f vec);
    }
    

    vrml.node package

    //
    // This is the general Node class
    // 
    public abstract class Node extends BaseNode { 
      
      // Get an EventIn by name. Return value is write-only.
      //   Throws an InvalidEventInException if eventInName isn't a valid
      //   event in name for a node of this type.
    O  public final Field getEventIn(String fieldName);
    
      // Get an EventOut by name. Return value is read-only.
      //   Throws an InvalidEventOutException if eventOutName isn't a valid
      //   event out name for a node of this type.
    O  public final ConstField getEventOut(String fieldName);
    
      // Get an exposed field by name. 
      //   Throws an InvalidExposedFieldException if fieldName isn't a valid
      //   exposed field name for a node of this type.
    O  public final Field getExposedField(String fieldName);
    }
    
    //
    // This is the general Script class, to be subclassed by all scripts.
    // Note that the provided methods allow the script author to explicitly
    // throw tailored exceptions in case something goes wrong in the
    // script.
    //
    public abstract class Script extends BaseNode { 
     
      // This method is called before any event is generated
    O  public void initialize();
    
      // Get a Field by name.
      //   Throws an InvalidFieldException if fieldName isn't a valid
      //   event in name for a node of this type.
    O  protected final Field getField(String fieldName);
    
      // Get an EventOut by name.
      //   Throws an InvalidEventOutException if eventOutName isn't a valid
      //   event out name for a node of this type.
    O  protected final Field getEventOut(String fieldName);
    
      // Get an EventIn by name. retrun value is write only.
      // Throws an InvalidEventInException if eventOutName isn't a valid
      // event out name for a node of this type.
    O  protected final Field getEventIn(String fieldName);
    
      // processEvents() is called automatically when the script receives 
      //   some set of events. It should not be called directly except by its subclass.
      //   count indicates the number of events delivered.
    O  public void processEvents(int count, Event events[]);
    
      // processEvent() is called automatically when the script receives 
      // an event. 
    O  public void processEvent(Event event);
    
      // eventsProcessed() is called after every invocation of processEvents().
    O  public void eventsProcessed()
    
      // shutdown() is called when this Script node is deleted.
    O  public void shutdown(); 
    }