01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2005, Institut de Recherche pour le Développement
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.coverage.processing.operation;
18:
19: // JAI dependencies (for javadoc)
20: import javax.media.jai.operator.ExpDescriptor;
21:
22: // Geotools dependencies
23: import org.geotools.util.NumberRange;
24: import org.geotools.coverage.processing.OperationJAI;
25:
26: /**
27: * Takes the exponential of the sample values of a coverage.
28: *
29: * <P><STRONG>Name:</STRONG> <CODE>"Exp"</CODE><BR>
30: * <STRONG>JAI operator:</STRONG> <CODE>"{@linkplain ExpDescriptor Exp}"</CODE><BR>
31: * <STRONG>Parameters:</STRONG></P>
32: * <table border='3' cellpadding='6' bgcolor='F4F8FF'>
33: * <tr bgcolor='#B9DCFF'>
34: * <th>Name</th>
35: * <th>Class</th>
36: * <th>Default value</th>
37: * <th>Minimum value</th>
38: * <th>Maximum value</th>
39: * </tr>
40: * <tr>
41: * <td>{@code "Source"}</td>
42: * <td>{@link org.geotools.coverage.grid.GridCoverage2D}</td>
43: * <td align="center">N/A</td>
44: * <td align="center">N/A</td>
45: * <td align="center">N/A</td>
46: * </tr>
47: * </table>
48: *
49: * @since 2.2
50: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/Exp.java $
51: * @version $Id: Exp.java 20970 2006-08-11 07:53:22Z jgarnett $
52: * @author Martin Desruisseaux
53: *
54: * @see org.geotools.coverage.processing.Operations#exp
55: * @see ExpDescriptor
56: */
57: public class Exp extends OperationJAI {
58: /**
59: * Serial number for interoperability with different versions.
60: */
61: private static final long serialVersionUID = 6136918309949539525L;
62:
63: /**
64: * Constructs a default {@code "Exp"} operation.
65: */
66: public Exp() {
67: super ("Exp");
68: }
69:
70: /**
71: * Returns the expected range of values for the resulting image.
72: */
73: protected NumberRange deriveRange(final NumberRange[] ranges,
74: final Parameters parameters) {
75: final NumberRange range = ranges[0];
76: final double min = Math.exp(range.getMinimum());
77: final double max = Math.exp(range.getMaximum());
78: return new NumberRange(min, max);
79: }
80: }
|