Class SoSFArray2D


  • public class SoSFArray2D
    extends SoSFArray
    Field containing a 2D array value. This field contains a 2D array of values of a specified type. The setValue method allows you to specify the dimensions and type of data the array will contain. The CopyPolicy allows you to control whether Open Inventor will make a copy of the data and, if not, whether the application or Open Inventor is responsible for managing the memory.

    In ASCII format, an SoSFArray2D is written to file in the following format:

    • Two numbers define the dimensions of the array
    • One string defines the type of the data:
      • BYTE for signed bytes
      • UBYTE for unsigned bytes
      • SHORT for signed shorts
      • USHORT for unsigned shorts
      • INT32 for signed 32 bits ints
      • UINT32 for unsigned 32 bits ints
      • FLOAT for floating point values
    • A list of values in decimal, hexadecimal, or octal format for integers or in standard scientific notation for float. Numbers are separated by a blank (space, tab, return...).
    The example below shows the definition of a 2x2 array of unsigned bytes with data values 0, 1, 2 and 3:
    2 2 UBYTE
    0 1
    2 3
    
    Below is a 2x3 array of floats:
    2 3 FLOAT
    0.5 1 .72
    0.33 6.2e4 0.9
    

    EXAMPLE

     SbVec2i32 size = new SbVec2i32(2,2);
     ByteBuffer data = ByteBuffer.allocateDirect( 4 );
     data.order( ByteOrder.nativeOrder() );     
     . . .
     SoIndexedTexture2 indexedTexture = new SoIndexedTexture2();
     indexedTexture.imageIndex.SetValue(size, SoSFArray.DataTypes.UNSIGNED_BYTE, data); 

    See Also:
    SoField, SoSField
    • Method Detail

      • setValue

        public void setValue​(SbVec2i32 size,
                             SoSFArray.DataTypes dataType,
                             java.nio.ByteBuffer data)
        Calls setValue(size, dataType, data, SoSFArray.CopyPolicies.valueOf( SoSFArray.CopyPolicies.COPY.getValue() )).
      • setValue

        public void setValue​(SbVec2s size,
                             SoSFArray.DataTypes dataType,
                             java.nio.ByteBuffer data)
        Calls setValue(size, dataType, data, SoSFArray.CopyPolicies.valueOf( SoSFArray.CopyPolicies.COPY.getValue() )).
      • get2DSize

        public SbVec2i32 get2DSize()
        Returns the dimensions of the array.
      • get2DValue

        public SoSFArray2D.Array2D get2DValue()
        Returns a read-only pointer to the 2D array's values and its dimensions and data type.