vrml.eai.field
Class EventOutMFColor

java.lang.Object
  extended by vrml.eai.field.BaseField
      extended by vrml.eai.field.EventOut
          extended by vrml.eai.field.EventOutMField
              extended by vrml.eai.field.EventOutMFColor

public abstract class EventOutMFColor
extends EventOutMField

Reference to a MFColor event-out slot. Use this class to read values from MFColor event-out slots.

The following example gets the color values from the "color" field of a Color node and prints them to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 float[][] c = color_changed.getValue();
 for (int i = 0; i < c.length; ++i)
     System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
 


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 EventOutMFColor()
          Default Constructor.
 
Method Summary
abstract  float[] get1Value(int index)
          Returns one element of a MFColor event-out slot.
abstract  void get1Value(int index, float[] value)
          Returns one element of a MFColor event-out slot.
abstract  float[][] getValue()
          Returns the current value of a MFColor event-out slot.
abstract  void getValue(float[] value)
          Returns the current value of a MFColor event-out slot.
abstract  void getValue(float[][] value)
          Returns the current value of a MFColor event-out slot.
 
Methods inherited from class vrml.eai.field.EventOutMField
size
 
Methods inherited from class vrml.eai.field.EventOut
addVrmlEventListener, getUserData, removeVrmlEventListener, 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

EventOutMFColor

protected EventOutMFColor()
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.getEventOut(java.lang.String) method.

Method Detail

getValue

public abstract float[][] getValue()
Returns the current value of a MFColor event-out slot.

The following example gets the color values from the "color" field of a Color node and prints them to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 float[][] c = color_changed.getValue();
 for (int i = 0; i < c.length; ++i)
     System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
 

Returns:
The current color values. This is an array of float arrays that contain 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 is between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.

getValue

public abstract void getValue(float[][] value)
                       throws java.lang.ArrayIndexOutOfBoundsException
Returns the current value of a MFColor event-out slot.

The following example gets the color values from the "color" field of a Color node and prints them to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 int size = color_changed.size();
 float[][] c = new float[size][];
 for (int i = 0; i < size; ++i)
     c[i] = new float[3];
 color_changed.getValue(c);
 for (int i = 0; i < c.length; ++i)
     System.out.println("red = " + c[i][0] + ", green = " + c[i][1] + ", blue = " + c[i][2]);
 

Parameters:
value - An array of float arrays that contain at least three values. This array gets filled with the current color values. The first element of each array gets filled with the red color component, the second element with the green component, and the third element with the blue component. Each component is between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when either the value array is too small, or one of the arrays contained in the value array has less then three elements.

getValue

public abstract void getValue(float[] value)
                       throws java.lang.ArrayIndexOutOfBoundsException
Returns the current value of a MFColor event-out slot.

The following example gets the color values from the "color" field of a Color node and prints them to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 float[] c = new float[color_changed.size() * 3];
 color_changed.getValue(c);
 for (int i = 0; i < c.length; i += 3)
     System.out.println("red = " + c[i] + ", green = " + c[i + 1] + ", blue = " + c[i + 2]);
 

Parameters:
value - An array of float values that gets filled with the current color values. The number of elements in this array must be at least three times the number of color values. The elements at the positions [i x 3] get filled with the red color components, the elements at [i x 3 + 1] with the green components, and the elements at [i x 3 + 2] with the blue components (for 0 <= i < EventOutMField.size()). Each component is between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the value array is too small.

get1Value

public abstract float[] get1Value(int index)
                           throws java.lang.ArrayIndexOutOfBoundsException
Returns one element of a MFColor event-out slot.

The following example gets the first color value from the "color" field of a Color node and prints it to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 float[] c = color_changed.get1Value(0);
 System.out.println("red = " + c[0] + ", green = " + c[1] + ", blue = " + c[2]);
 

Parameters:
index - The index of the element, starting at 0.
Returns:
The color value. This is an array of three float values. The first value contains the red color component, the second value the green component, and the third value the blue component. Each component is between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the index is invalid.

get1Value

public abstract void get1Value(int index,
                               float[] value)
                        throws java.lang.ArrayIndexOutOfBoundsException
Returns one element of a MFColor event-out slot.

The following example gets the first color value from the "color" field of a Color node and prints it to the console:

 vrml.eai.Node color = ...;
 vrml.eai.field.EventOutMFColor color_changed = (vrml.eai.field.EventOutMFColor)color.getEventOut("color_changed");
 float[] c = new float[3];
 color_changed.get1Value(0, 5);
 System.out.println("red = " + c[0] + ", green = " + c[1] + ", blue = " + c[2]);
 

Parameters:
index - The index of the element, starting at 0.
value - An array of at least three float values that gets filled with the color components. The first value gets filled with the red color component, the second value with the green component, and the third value with the blue component. Each component is between 0 and 1, inclusively. 0 means no intensity, and 1 means full intensity.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the index is invalid, or the value array has less than three elements.