Example usage for java.awt.image.renderable ParameterBlock getSources

List of usage examples for java.awt.image.renderable ParameterBlock getSources

Introduction

In this page you can find the example usage for java.awt.image.renderable ParameterBlock getSources.

Prototype

public Vector<Object> getSources() 

Source Link

Document

Returns the entire Vector of sources.

Usage

From source file:org.mrgeo.mapalgebra.RenderedImageMapOp.java

private RenderedOp _createRenderedOp() throws IOException {
    if (_factory == null) {
        throw new IllegalArgumentException("The RenderedImageFactory must be specified.");
    }/*  w ww . java  2  s.co  m*/

    // Reuse the parameters that the caller has already set up. But at
    // the end of the parameter list, we need to include the NoData value
    // for each source followed by the NoData value for this map op's
    // output (which for now will be the same as the NoData value for
    // the first input).
    // TODO: We assume the use of band 0 at this point, but that will change...
    ParameterBlock jaiParams = (ParameterBlock) _param.clone();
    if (jaiParams.getSources().size() == 0) {
        for (MapOp op : _inputs) {
            jaiParams.addSource(((RasterMapOp) op).getRasterOutput());
        }
    }
    if (includeFunctionNameInParameters()) {
        jaiParams.add(getFunctionName());
    }
    // The ConstantOpImage requires a tilesize in its constructor, but
    // the MapAlgebraParser does not have enough information at the time
    // this map was constructed (to set the tilesize), so we pass the tilesize
    // on the fly here when creating the ConstantOpImage.
    if (_factory instanceof ConstantDescriptor) {
        int tilesize = MapAlgebraExecutioner.calculateTileSize(findRoot());
        if (tilesize <= 0) {
            tilesize = Integer.parseInt(MrGeoProperties.getInstance().getProperty("tilesize", "512"));
        }
        jaiParams.add(tilesize);
    }

    // Need to add dependencies for OpImage descriptors so that required JARs
    // are pushed to the data node side during a map/reduce. Otherwise,
    // a NullPointerException will be thrown when the OpChainDriver attempts
    // to instantiate the operation chain on the mapper side.
    DependencyLoader.addDependencies(getConf(), _factory.getClass());
    return JAI.create(_factory.getClass().getName(), jaiParams, _hints);
}