com.esri.sde.sdk.client
Class SeRasterData

java.lang.Object
  extended by com.esri.sde.sdk.client.SeRasterData

public class SeRasterData
extends java.lang.Object

For constructing image data and can be use to pass around between the client application and the ArcSDE Java API. Callback function from SeInsert and SeUpdate accept image data through the use of this object.

Since:
ArcSDE 9.0
See Also:
SeRasterAttr, SeRasterConsumer, SeRasterRenderedImage

Constructor Summary
SeRasterData(int bandWidth, int bitsPerPixel, boolean maskMode)
          Constructs SeRasterData object.
 
Method Summary
 void clear()
          Removes all image scan line data and bit mask from this object.
static void decodePixelsConvertToObject(int srcPixelType, byte[] src, int srcPos, double srcStatsMin, double srcStatsMax, java.lang.Object dstObj, int dstPos, double dstMax, int dstLen)
          Decode source byte[] array as srcPixelType and try to convert it value to the destination Object type.
 byte[] getBitMaskData()
          Gets scan line's bit mask data, if exist.
 int getNumLines()
          Gets number of scan lines.
 byte[] getScanLineData()
          Gets scan lines pixel data.
 boolean hasBitMask()
          Return true if bit mask exist.
 int setScanLine(int num_lines, byte[] i_line, int i_lineLen, byte[] i_mask, int i_maskLen)
          Sets one or more image scan line of pixel data for any supported pixel depth and each scan line end on a byte boundary, and any existing data in current object will be overwrite.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeRasterData

public SeRasterData(int bandWidth,
                    int bitsPerPixel,
                    boolean maskMode)
Constructs SeRasterData object.

Top of SeRasterData class.

Method Detail

clear

public void clear()
Removes all image scan line data and bit mask from this object.

See Also:
setScanLine(int, byte[], int, byte[], int)

getBitMaskData

public byte[] getBitMaskData()
Gets scan line's bit mask data, if exist. Else return null

Returns:
an byte[] value
See Also:
hasBitMask(), getScanLineData(), setScanLine(int, byte[], int, byte[], int)

getNumLines

public int getNumLines()
Gets number of scan lines.

Returns:
an int value of number of scan lines.
See Also:
getScanLineData(), setScanLine(int, byte[], int, byte[], int)

getScanLineData

public byte[] getScanLineData()
Gets scan lines pixel data.

Returns:
an byte[] value
See Also:
getNumLines(), getBitMaskData(), hasBitMask(), setScanLine(int, byte[], int, byte[], int)

hasBitMask

public boolean hasBitMask()
Return true if bit mask exist.

Returns:
a boolean value
See Also:
getBitMaskData(), setScanLine(int, byte[], int, byte[], int)

setScanLine

public int setScanLine(int num_lines,
                       byte[] i_line,
                       int i_lineLen,
                       byte[] i_mask,
                       int i_maskLen)
Sets one or more image scan line of pixel data for any supported pixel depth and each scan line end on a byte boundary, and any existing data in current object will be overwrite.

For instance, if the space needed for a scan line doesn't end on a byte boundary, then the remaining bit(s) on the last byte is/are not use, and the next scan line is starting on the next byte boundary.

If mask_mode is set, then also sets bit_mask which is always ONE bit per pixel and fully packed byte array.

For example:

 // Assumes
 int mBitsPerPixel = 1;  
 int mBandWidth    = 3;  

 int num_lines     = 3;

 // Expected i_line and i_lineLen parameters would have the 
 // following format and layout
 mBytesPerLine = (mBandWidth * mBitsPerPixel + 7) / 8;
 i_lineLen = 3;                               // mBytesPerLine * num_lines
 i_line    = [aaa?????][bbb?????][ccc?????];

 // where [ ]  --  Indicate a byte. Each char within represent one bit value
 //       abc  --  Indicate pixel value. In this case a 1 or a 0.
 //                a-values for line 1, b-values for line 2 and etc ...
 //        ?   --  Indicate non-pixel value which will be discarded.
 
 // If mask_mode is set, 
 // then the expected i_mask and i_maskLen parameters would have the
 // following format and layout
 i_maskLen = 2;                        // (mBandWidth * num_lines + 7) / 8
 i_mask    = [AAABBBCC][C???????]
 

Parameters:
num_lines - an int value
i_line - a byte[] value, input scan_line.
i_lineLen - input scan_line's length. Starting from i_line[0], and i_lineLen can be <= i_line.length
i_mask - Optionally input bit_mask data.
i_maskLen - an int value
Returns:
an int value of SeError code
See Also:
getScanLineData(), getNumLines(), getBitMaskData(), hasBitMask(), clear()

decodePixelsConvertToObject

public static void decodePixelsConvertToObject(int srcPixelType,
                                               byte[] src,
                                               int srcPos,
                                               double srcStatsMin,
                                               double srcStatsMax,
                                               java.lang.Object dstObj,
                                               int dstPos,
                                               double dstMax,
                                               int dstLen)
                                        throws java.lang.Exception
Decode source byte[] array as srcPixelType and try to convert it value to the destination Object type.

Covert input value as is (if srcStatsMin == srcStatsMax) or stretch/shrink input value (if srcStatsMin != srcStatsMax) base on srcStatsMin, srcStatsMax and dstMax with the following formula.

   double f = dstMax / (srcStatsMax - srcStatsMin);
   for (int i=0; i < dstLen; i++) {
     dstObj_val[i] = (src_value[i] - srcStatsMin) * f;
   }
 
if (srcStatsMin == srcStatsMax)

Convert input value as is and try to cast it to the output Object's type. Thrown an ClassCastException if the input value may not be able to cast it into the output Object type.

if (srcStatsMin != srcStatsMax)

Stretch or shrink input value with (srcStatsMax - srcStatsMin) as the input range to the output range of (0.0 to dstMax).

if (dstMax == 0.0) set dstMax = dstObj.MAX_VALUE;

if (dstMax != 0.0) then (dstMax <= dstObj.MAX_VALUE) must be TRUE

Parameters:
srcPixelType - source's pixel_type.
src - the input source byte[] array, with the packed pixel values.
srcPos - start position on the source array (value in byte).
srcStatsMin - source array's statistic min value.
srcStatsMax - source array's statistic max value.
dstObj - pre-allocated destination Object array. The Object's type determine how we map the ouput value. Supported Object type are byte[], int[], float[] and double[].
dstPos - start position on the destination Object array.
dstMax - destination Object's maximum value. Is ignore if (srcStatsMin == srcStatsMax)
dstLen - number of elements to put out as dstObj type.
Throws:
java.lang.Exception - if an error occurs.
See Also:
SeRasterTile.getPixels(byte[]), SeRasterTile.getPixels(double, double, byte[])