@Override public void setAlgorithm(Expression name) { if (name != null) { String algorithm = name.evaluate(null, String.class); if (algorithm != null && !ALGORITHM_NAMES.contains(algorithm)) { throw new IllegalArgumentException( "Unsupported Algorithm has been specified: " + algorithm); } } super.setAlgorithm(name); } }
private AbstractContrastMethodStrategy parseContrastEnhancementMethod( ContrastMethod method, Map<String, Expression> options) { String name = method.name().toUpperCase(); AbstractContrastMethodStrategy ceMethod = null; if ("NORMALIZE".equals(name)) { Expression algorithm = options.get(AbstractContrastMethodStrategy.ALGORITHM); ceMethod = new NormalizeContrastMethodStrategy(); if (algorithm != null) { ceMethod.setAlgorithm(algorithm); } } else if ("LOGARITHMIC".equalsIgnoreCase(name)) { ceMethod = new LogarithmicContrastMethodStrategy(); } else if ("EXPONENTIAL".equalsIgnoreCase(name)) { ceMethod = new ExponentialContrastMethodStrategy(); } else if ("HISTOGRAM".equalsIgnoreCase(name)) { ceMethod = new HistogramContrastMethodStrategy(); } else { throw new IllegalArgumentException( Errors.format(ErrorKeys.UNSUPPORTED_METHOD_$1, method)); } ceMethod.setOptions(options); return ceMethod; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { AbstractContrastMethodStrategy ret = new HistogramContrastMethodStrategy(); if (node.getChildValue("Algorithm") != null) { Expression algor = (Expression) node.getChildValue("Algorithm"); ret.setAlgorithm(algor); } List<Node> params = node.getChildren("Parameter"); for (Node param : params) { String key = (String) param.getAttributeValue("name"); ret.addParameter(key, (Expression) param.getValue()); } return ret; } }
method_6.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_6.addOption("minValue", sldBuilder.literalExpression(50)); final AbstractContrastMethodStrategy method_7 = new NormalizeContrastMethodStrategy(); method_7.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7.addParameter("minValue", sldBuilder.literalExpression(50)); final AbstractContrastMethodStrategy method_7f = new NormalizeContrastMethodStrategy(); method_7f.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7f.addParameter("minValue", sldBuilder.literalExpression(50)); final AbstractContrastMethodStrategy method_7g = new NormalizeContrastMethodStrategy(); method_7g.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7g.addParameter("minValue", sldBuilder.literalExpression(50));