vrml.eai.field
Class EventOutSFVec2f

java.lang.Object
  extended by vrml.eai.field.BaseField
      extended by vrml.eai.field.EventOut
          extended by vrml.eai.field.EventOutSFVec2f

public abstract class EventOutSFVec2f
extends EventOut

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

The following example demonstrates how to get the texture coordinate of the hit point from a TouchSensor node:

 vrml.eai.Node touchSensor = ...;
 vrml.eai.field.EventOutSFVec2f hitTexCoord_changed = (vrml.eai.field.EventOutSFVec2f)touchSensor.getEventOut("hitTexCoord_changed");
 float[] coord = hitTexCoord_changed.getValue();
 System.out.println("x = " + coord[0] + ", y = " + coord[1]);
 


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 EventOutSFVec2f()
          Default Constructor.
 
Method Summary
abstract  float[] getValue()
          Returns the current value of the SFVec2f event-out slot.
abstract  void getValue(float[] value)
          Returns the current value of the SFVec2f event-out slot.
 
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

EventOutSFVec2f

protected EventOutSFVec2f()
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 the SFVec2f event-out slot.

The following example demonstrates how to get the texture coordinate of the hit point from a TouchSensor node:

 vrml.eai.Node touchSensor = ...;
 vrml.eai.field.EventOutSFVec2f hitTexCoord_changed = (vrml.eai.field.EventOutSFVec2f)touchSensor.getEventOut("hitTexCoord_changed");
 float[] coord = hitTexCoord_changed.getValue();
 System.out.println("x = " + coord[0] + ", y = " + coord[1]);
 

Returns:
The vector as an array of two float elements. The first element contains the x component, and the second element the y component.

getValue

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

The following example demonstrates how to get the texture coordinate of the hit point from a TouchSensor node:

 vrml.eai.Node touchSensor = ...;
 vrml.eai.field.EventOutSFVec2f hitTexCoord_changed = (vrml.eai.field.EventOutSFVec2f)touchSensor.getEventOut("hitTexCoord_changed");
 float[] coord = new float[2];
 hitTexCoord_changed.getValue(coord);
 System.out.println("x = " + coord[0] + ", y = " + coord[1]);
 

Parameters:
value - An array of at least two float elements that gets filled with the components of the vector. The first element gets filled with the x component, and the second element with the y component.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the value array has less then two elements.