本文整理汇总了Java中org.vast.data.DataArrayImpl类的典型用法代码示例。如果您正苦于以下问题:Java DataArrayImpl类的具体用法?Java DataArrayImpl怎么用?Java DataArrayImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataArrayImpl类属于org.vast.data包,在下文中一共展示了DataArrayImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultEncoding
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
/**
* Gets the default encoding for the given data structure.<br/>
* This uses BinaryEncoding if data structure contains a large array and TextEncoding
* otherwise.
* @param dataComponents
* @return an appropriately configured encoding
*/
public static DataEncoding getDefaultEncoding(DataComponent dataComponents)
{
// check if one of the children is a large array
for (DataComponent c: new DataIterator(dataComponents))
{
if (c instanceof DataArray)
{
DataArrayImpl array = (DataArrayImpl)c;
if (array.isVariableSize() || (array.getElementCount() != null && array.getElementCount().getValue() > 10))
return getDefaultBinaryEncoding(dataComponents);
}
}
// otherwise return default text encoding
return new TextEncodingImpl();
}
示例2: findComponent
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
/**
* Finds the first component in the tree matching the given filter
* @param parent component from which to start the search
* @param filter component filter instance (must not be null)
* @return the first component matching the filter
*/
public static DataComponent findComponent(DataComponent parent, IComponentFilter filter)
{
if (parent instanceof DataArrayImpl)
parent = ((DataArrayImpl)parent).getElementType();
int childCount = parent.getComponentCount();
for (int i=0; i<childCount; i++)
{
DataComponent child = parent.getComponent(i);
if (filter.accept(child))
return child;
// try to find it recursively!
DataComponent desiredParam = findComponent(child, filter);
if (desiredParam != null)
return desiredParam;
}
return null;
}
示例3: createDs3
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
protected DataComponent createDs3(DataComponent nestedRec) throws Exception
{
DataComponent recordDesc = new DataArrayImpl(10);
recordDesc.setName("ds3");
recordDesc.setDefinition("urn:auth:blabla:array-stuff");
((DataArray)recordDesc).setElementType("elt", nestedRec);
storage.addRecordStore(recordDesc.getName(), recordDesc, new BinaryEncodingImpl());
return recordDesc;
}
示例4: init
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
@Override
protected void init() throws SensorException
{
V4LCameraParams camParams = parentSensor.camParams;
// init frame grabber
try
{
frameGrabber = parentSensor.videoDevice.getRGBFrameGrabber(camParams.imgWidth, camParams.imgHeight, 0, V4L4JConstants.STANDARD_WEBCAM);
//frameGrabber.setFrameInterval(1, camParams.frameRate);
// adjust params to what was actually set up by V4L
camParams.imgWidth = frameGrabber.getWidth();
camParams.imgHeight = frameGrabber.getHeight();
camParams.frameRate = frameGrabber.getFrameInterval().denominator / frameGrabber.getFrameInterval().numerator;
camParams.imgFormat = frameGrabber.getImageFormat().getName();
frameGrabber.setCaptureCallback(this);
if (camParams.doCapture)
frameGrabber.startCapture();
}
catch (V4L4JException e)
{
throw new SensorException("Error while initializing frame grabber", e);
}
// build output structure
camDataStruct = new DataArrayImpl(camParams.imgHeight);
camDataStruct.setName(getName());
camDataStruct.setDefinition("http://sensorml.com/ont/swe/property/VideoFrame");
DataArray imgRow = new DataArrayImpl(camParams.imgWidth);
((DataArray)camDataStruct).addComponent("row", imgRow);
DataRecord imgPixel = new DataRecordImpl(3);
imgPixel.addComponent("red", new CountImpl(DataType.BYTE));
imgPixel.addComponent("green", new CountImpl(DataType.BYTE));
imgPixel.addComponent("blue", new CountImpl(DataType.BYTE));
imgRow.addComponent("pixel", imgPixel);
}
示例5: newArray
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
/**
* Creates a variable size 1D array
* @param sizeComponent
* @param eltName
* @param elementType
* @return the new DataArray component object
*/
public DataArray newArray(Count sizeComponent, String eltName, DataComponent elementType)
{
DataArray array = newDataArray();
((DataArrayImpl)array).setElementCount(sizeComponent);
array.setElementType(eltName, elementType);
return array;
}
示例6: DISABLED_testJP2KDecompression
import org.vast.data.DataArrayImpl; //导入依赖的package包/类
public void DISABLED_testJP2KDecompression() throws Exception
{
String filePath = "F:\\Data\\ErdasTigerShark\\2008-07-21\\images\\A121665541042.jp2";//.small.jpc";
File file = new File(filePath);
FileInputStream is = new FileInputStream(file);
DataArrayImpl imgData = new DataArrayImpl();
DataRecordImpl pixelData = new DataRecordImpl(3);
pixelData.addComponent("red", new CountImpl());
pixelData.addComponent("green", new CountImpl());
pixelData.addComponent("blue", new CountImpl());
imgData.addComponent("pixel", pixelData);
JP2KStreamDecoder decoder = new JP2KStreamDecoder(file.length());
decoder.decode(new DataInputStreamBI(is), imgData);
System.out.println(imgData.getData());
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream("D:\\subset.raw"));
for (int p=0; p<imgData.getComponentCount(); p++)
{
DataBlock dataBlk = imgData.getComponent(p).getData();
/*int tmp1 = dataBlk.getIntValue(0)+128;
int tmp2 = dataBlk.getIntValue(1)+128;
int tmp3 = dataBlk.getIntValue(2)+128;
os.write(tmp1 > 255 ? 255 : (tmp1 < 0 ? 0 : tmp1));
os.write(tmp2 > 255 ? 255 : (tmp2 < 0 ? 0 : tmp2));
os.write(tmp3 > 255 ? 255 : (tmp3 < 0 ? 0 : tmp3));*/
os.write(dataBlk.getByteValue(0));
os.write(dataBlk.getByteValue(1));
os.write(dataBlk.getByteValue(2));
}
os.close();
}