/** * Returns {@code true} if the parameters are valids. This implementation check that the number * of bands in the source src1 is equals to the number of bands of source src2. * * @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 validateParameters( final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } if (!(param.getObjectParameter(0) instanceof IndexColorModel)) return false; final int numColors = ((Integer) param.getObjectParameter(1)).intValue(); final int alphaThreashold = ((Integer) param.getObjectParameter(2)).intValue(); if (alphaThreashold < 0 || alphaThreashold > 255) return false; if (numColors <= 0 || (numColors > 256)) return false; return true; } }
/** * 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; }
@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; }
/** * Validates the input source and parameters. * * <p> * In addition to the standard checks performed by the superclass method, this method checks that "colorMap" and "ditherMask" are valid for the * given source image. */ public boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg) { if (!super.validateArguments(modeName, args, msg)) { return false; } if (!modeName.equalsIgnoreCase("rendered")) return true; // Retrieve the operation source and parameters. RenderedImage src = args.getRenderedSource(0); ColorCube colorMap = (ColorCube) args.getObjectParameter(0); KernelJAI[] ditherMask = (KernelJAI[]) args.getObjectParameter(1); // Check color map validity. if (!isValidColorMap(src, colorMap, msg)) { return false; } // Check dither mask validity. if (!isValidDitherMask(src, ditherMask, msg)) { return false; } return true; }
/** * Returns {@code true} if the parameters are valids. This implementation check that the number * of bands in the source src1 is equals to the number of bands of source src2. * * @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 validateParameters( final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } final int numColors = ((Integer) param.getObjectParameter(0)).intValue(); final int alphaThreashold = ((Integer) param.getObjectParameter(1)).intValue(); final int ssx = ((Integer) param.getObjectParameter(2)).intValue(); final int ssy = ((Integer) param.getObjectParameter(3)).intValue(); final RenderedImage source = (RenderedImage) param.getSource(0); if (ssx <= 1 && ssx >= source.getWidth()) return false; if (ssy <= 1 && ssy >= source.getHeight()) return false; if (alphaThreashold < 0 || alphaThreashold > 255) return false; if (numColors <= 0 || (numColors > 256)) return false; return true; } }
/** * 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; }
/** * Validates the input source and parameters. * * <p> * In addition to the standard checks performed by the superclass method, this method checks that "colorMap" and "ditherMask" are valid for the * given source image. */ public boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg) { if (!super.validateArguments(modeName, args, msg)) { return false; } if (!modeName.equalsIgnoreCase("rendered")) return true; // Retrieve the operation source and parameters. RenderedImage src = args.getRenderedSource(0); ColorCube colorMap = (ColorCube) args.getObjectParameter(0); KernelJAI[] ditherMask = (KernelJAI[]) args.getObjectParameter(1); // Check color map validity. if (!isValidColorMap(src, colorMap, msg)) { return false; } // Check dither mask validity. if (!isValidDitherMask(src, ditherMask, msg)) { return false; } return true; }
/** * Returns {@code true} if the parameters are valids. This implementation check * that the number of bands in the source image is equals to the number of supplied * sample dimensions, and that all sample dimensions has categories. * * @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 validateParameters(final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } try{ // param. // final RenderedImage source = (RenderedImage) param.getSource(0); // final Number oldNoData= (Number) param.getObjectParameter(0); // final Number newNoData= (Number) param.getObjectParameter(1); // final Double EPS= (Double) param.getObjectParameter(1); } catch(Exception e){ message.append(e.getMessage()); return false; } return true; } }
/** * Returns <code>true</code> if there is at least one source and the first source is a <code>RenderedImage</code> or <code>RenderableImage</code>. * * @throws IllegalArgumentException if <code>args</code> is <code>null</code>. * @throws IllegalArgumentException if <code>msg</code> is <code>null</code> and the validation fails. */ protected boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg) { if (args == null || msg == null) { throw new IllegalArgumentException("No parameterBlock or StringBuffer present"); } return super.validateSources(modeName, foolSourceValidation(args), msg); }
if (!super.validateArguments(modeName, args, message)) { return false;
@Override protected boolean validateParameters(String modeName, ParameterBlock pb, StringBuffer msg) { boolean ok = super.validateParameters(modeName, pb, msg); if (ok) { Object obj = pb.getObjectParameter(GEOM_ARG); if (!(obj instanceof Polygonal || obj instanceof PreparedGeometry)) { ok = false; msg.append("The reference geometry must be either Polygon, MultiPolygon, or a " + "polygonal PreparedGeometry"); } } return ok; } }
/** * Returns <code>true</code> if there is at least one source and the first source is a <code>RenderedImage</code> or <code>RenderableImage</code>. * * @throws IllegalArgumentException if <code>args</code> is <code>null</code>. * @throws IllegalArgumentException if <code>msg</code> is <code>null</code> and the validation fails. */ protected boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg) { if (args == null || msg == null) { throw new IllegalArgumentException("No parameterBlock or StringBuffer present"); } return super.validateSources(modeName, foolSourceValidation(args), msg); }
if (!super.validateArguments(modeName, args, message)) { return false;
/** * Returns {@code true} if the parameters are valids. This implementation check that the number of bands in the source src1 is equals to the * number of bands of source src2. * * @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 validateParameters(final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } if (!(param.getObjectParameter(0) instanceof ColorIndexer)) return false; return true; }
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; }
if (!super.validateArguments(modeName, args, message)) { return false;
/** * Returns {@code true} if the parameters are valids. This implementation check that the number of bands in the source src1 is equals to the * number of bands of source src2. * * @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 validateParameters(final String modeName, final ParameterBlock param, final StringBuffer message) { if (!super.validateParameters(modeName, param, message)) { return false; } if (!(param.getObjectParameter(0) instanceof ColorIndexer)) return false; return true; }
/** * 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; }
/** * Validates supplied parameters. * * @param modeName the rendering mode * @param pb the parameter block * @param msg a {@code StringBuffer} to receive error messages * * @return {@code true} if parameters are valid; {@code false} otherwise */ @Override protected boolean validateParameters(String modeName, ParameterBlock pb, StringBuffer msg) { boolean ok = super.validateParameters(modeName, pb, msg); if (ok) { Object obj = pb.getObjectParameter(GEOM_ARG); if (!(obj instanceof Polygonal || obj instanceof PreparedGeometry)) { ok = false; msg.append("The reference geometry must be either Polygon, MultiPolygon, or a " + "polygonal PreparedGeometry"); } } return ok; } }
/** * 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; }