/** * Returns {@code true} if this operation supports the specified mode, and is capable of * handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources( final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0; ) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
/** * Returns {@code true} if this operation supports the specified mode, and is capable of * handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources( final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0; ) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
private Rectangle getSourceBounds(ParameterBlock pb) { Rectangle boundsUnion = null; if (pb.getNumSources() > 0) { boundsUnion = getSourceBounds(pb, 0); for (int i = 1; i < pb.getNumSources(); i++) { Rectangle imageBounds = getSourceBounds(pb, i); boundsUnion = boundsUnion.union(imageBounds); } } return boundsUnion; }
private Rectangle getSourceBounds(ParameterBlock pb) { Rectangle boundsUnion = null; if (pb.getNumSources() > 0) { boundsUnion = getSourceBounds(pb, 0); for (int i = 1; i < pb.getNumSources(); i++) { Rectangle imageBounds = getSourceBounds(pb, i); boundsUnion = boundsUnion.union(imageBounds); } } return boundsUnion; }
protected boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg) { if (! super.validateSources(modeName, args, msg)){ return false; } if (args.getNumSources() == 0 && args.getObjectParameter(1) == null) { msg.append("For a mosaik without sources, image bounds must be set."); return false; } return true; }
@Override public boolean validateArguments(String modeName, ParameterBlock pb, StringBuffer msg) { if (!super.validateArguments(modeName, pb, msg)) { return false; } int band = pb.getIntParameter(BAND_ARG_INDEX); if (band < 0 || band >= pb.getNumSources()) { msg.append("band arg out of bounds for source image: " + band); return false; } return true; }
if (oldParamBlock.getNumSources() < 1 || newParamBlock.getNumSources() < 1) {
/** * If the PB has more than one source, replace it with a new PB which has only one source equal to the first source of the input. We want to * support an arbitrary number of sources but only care that there is at least one of the appropriate class. */ private static ParameterBlock foolSourceValidation(ParameterBlock args) { if (args.getNumSources() > 1) { Vector singleSource = new Vector(); singleSource.add(args.getSource(0)); args = new ParameterBlock(singleSource, args.getParameters()); } return args; }
if (oldParamBlock.getNumSources() < 1 || newParamBlock.getNumSources() < 1) {
/** * If the PB has more than one source, replace it with a new PB which has only one source equal to the first source of the input. We want to * support an arbitrary number of sources but only care that there is at least one of the appropriate class. */ private static ParameterBlock foolSourceValidation(ParameterBlock args) { if (args.getNumSources() > 1) { Vector singleSource = new Vector(); singleSource.add(args.getSource(0)); args = new ParameterBlock(singleSource, args.getParameters()); } return args; }
/** * Returns {@code true} if this operation supports the specified mode, and is capable of handling the given input source(s) for the specified * mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
/** * Returns {@code true} if this operation supports the specified mode, and is capable of handling the given input source(s) for the specified * mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
/** * Returns {@code true} if this operation supports the specified mode, and * is capable of handling the given input source(s) for the specified mode. * * @param modeName * The mode name (usually "Rendered"). * @param param * The parameter block for the operation to performs. * @param message * A buffer for formatting an error message if any. */ protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
/** * Returns {@code true} if this operation supports the specified mode, and * is capable of handling the given input source(s) for the specified mode. * * @param modeName * The mode name (usually "Rendered"). * @param param * The parameter block for the operation to performs. * @param message * A buffer for formatting an error message if any. */ protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i = param.getNumSources(); --i >= 0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { return false; } } return true; } return false; }
/** * Returns {@code true} if this operation supports the specified mode, and * is capable of handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. */ protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i=param.getNumSources(); --i>=0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { message.append(Errors.format(ErrorKeys.BAD_PARAMETER_TYPE_$2, "source"+i, Utilities.getShortClassName(source))); return false; } } return true; } return false; }
for (int i=param.getNumSources(); --i>=0;) { numSamples += ((RenderedImage) param.getSource(i)).getSampleModel().getNumBands();
/** * Returns {@code true} if this operation supports the specified mode, and * is capable of handling the given input source(s) for the specified mode. * * @param modeName The mode name (usually "Rendered"). * @param param The parameter block for the operation to performs. * @param message A buffer for formatting an error message if any. * @return {@code true} if this operation can handle the given input sources. */ @Override protected boolean validateSources(final String modeName, final ParameterBlock param, final StringBuffer message) { if (super.validateSources(modeName, param, message)) { for (int i=param.getNumSources(); --i>=0;) { final Object source = param.getSource(i); if (!(source instanceof RenderedImage)) { message.append(Errors.format(Errors.Keys.IllegalParameterType_2, "source"+i, Classes.getClass(source))); return false; } } return true; } return false; }
int numSources = paramBlock.getNumSources();
int numSources = paramBlock.getNumSources();
/** * Creates a new instance of <code>AlgebraOpImage</code> in the rendered layer. This method satisfies the implementation of RIF. * * @param paramBlock The two source images to be added. * @param renderHints Optionally contains destination image layout. */ public RenderedImage create(ParameterBlock pb, RenderingHints renderHints) { // Get ImageLayout from renderHints if any. ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints); int numSrc = pb.getNumSources(); RenderedImage[] sources = new RenderedImage[numSrc]; for (int i = 0; i < numSrc; i++) { sources[i] = pb.getRenderedSource(i); } Operator op = (Operator) pb.getObjectParameter(0); ROI roi = (ROI) pb.getObjectParameter(1); Range noData = (Range) pb.getObjectParameter(2); double destinationNoData = pb.getDoubleParameter(3); return new AlgebraOpImage(renderHints, layout, op, roi, noData, destinationNoData, sources); }