vrml.eai.field
Class EventInMFColor

java.lang.Object
  extended by vrml.eai.field.BaseField
      extended by vrml.eai.field.EventIn
          extended by vrml.eai.field.EventInMFColor

public abstract class EventInMFColor
extends EventIn

Reference to a MFColor event-in slot. Use this class to write values into MFColor event-in slots.

The following example demonstrates how to write three colors (red, green and blue) into the "color" field of a Color node:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventInMFColor set_color = (vrml.eai.field.EventInMFColor)color.getEventIn("set_color");
 float[][] c = new float[3][];
 c[0] = new float[] { 1.0f, 0.0f, 0.0f }; // red color
 c[1] = new float[] { 0.0f, 1.0f, 0.0f }; // green color
 c[2] = new float[] { 0.0f, 0.0f, 1.0f }; // blue color
 set_color.setValue(c);
 


Field Summary
 
Fields inherited from class vrml.eai.field.BaseField
MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f
 
Constructor Summary
protected EventInMFColor()
          Default constructor.
 
Method Summary
abstract  void set1Value(int index, float[] value)
          Sets one element of the MFColor event-in slot.
abstract  void setValue(float[][] value)
          Sets the elements of the MFColor event-in slot.
 
Methods inherited from class vrml.eai.field.EventIn
getUserData, setUserData
 
Methods inherited from class vrml.eai.field.BaseField
getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventInMFColor

protected EventInMFColor()
Default constructor. This method is protected, i.e. you cannot create new instances of this class. The only way to get instances is via the Node.getEventIn(java.lang.String) method.

Method Detail

setValue

public abstract void setValue(float[][] value)
                       throws java.lang.IllegalArgumentException,
                              java.lang.ArrayIndexOutOfBoundsException
Sets the elements of the MFColor event-in slot.

The following example demonstrates how to write three colors (red, green and blue) into the "color" field of a Color node:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventInMFColor set_color = (vrml.eai.field.EventInMFColor)color.getEventIn("set_color");
 float[][] c = new float[3][];
 c[0] = new float[] { 1.0f, 0.0f, 0.0f }; // red color
 c[1] = new float[] { 0.0f, 1.0f, 0.0f }; // green color
 c[2] = new float[] { 0.0f, 0.0f, 1.0f }; // blue color
 set_color.setValue(c);
 

Parameters:
value - The new color values. This is an array of float arrays that contain at least three values. The first value is the red component of the color, the second value the green component, and the third value the blue component. Each component must be between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.IllegalArgumentException - when one of the color components is not between 0 and 1, inclusively.
java.lang.ArrayIndexOutOfBoundsException - when one of the arrays in the value parameter contains less than three values.

set1Value

public abstract void set1Value(int index,
                               float[] value)
                        throws java.lang.IllegalArgumentException,
                               java.lang.ArrayIndexOutOfBoundsException
Sets one element of the MFColor event-in slot.

The following example demonstrates how to write a color (red) into the first element of the "color" field of a Color node:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventInMFColor set_color = (vrml.eai.field.EventInMFColor)color.getEventIn("set_color");
 float[] c = new float[] { 1.0f, 0.0f, 0.0f }; // red color
 set_color.set1Value(0, c);
 

Parameters:
index - The index of the element, starting at 0.
value - The new color value. This is an array of at least three float values. The first value is the red component of the color, the second value the green component, and the third value the blue component. Each component must be between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.IllegalArgumentException - when one component of the value parameter is not between 0 and 1, inclusively.
java.lang.ArrayIndexOutOfBoundsException - when the index is invalid, or the value array contains less then three values.