001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.coverage.processing.operation;
017:
018: import javax.media.jai.BorderExtender;
019: import javax.media.jai.BorderExtenderCopy;
020: import javax.media.jai.Interpolation;
021: import javax.media.jai.InterpolationNearest;
022:
023: import org.geotools.coverage.processing.Operation2D;
024: import org.geotools.factory.Hints;
025: import org.geotools.metadata.iso.citation.Citations;
026: import org.geotools.parameter.DefaultParameterDescriptor;
027: import org.geotools.parameter.DefaultParameterDescriptorGroup;
028: import org.opengis.coverage.Coverage;
029: import org.opengis.parameter.ParameterDescriptor;
030: import org.opengis.parameter.ParameterValueGroup;
031:
032: /**
033: * TODO: Need documentation
034: *
035: *
036: * @author Simone Giannecchini
037: * @version $Id: SubsampleAverage.java 23157 2006-12-01 01:29:53Z desruisseaSubsampleAveragedCoverageator.SubsampleAverageDescriptor
038: * @since 2.3
039: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/coverage/src/main/java/org/geotools/coverage/processing/operation/SubsampleAverage.java $
040: * @todo Consider refactoring as a {@code OperationJAI} subclass. We could get ride of the
041: * {@code SubsampledAverageGridCoverage2D} class. The main feature to add is the
042: * copy of interpolation and border extender parameters to the hints.
043: */
044: public class SubsampleAverage extends Operation2D {
045: /**
046: *
047: */
048: public static final ParameterDescriptor scaleX = new DefaultParameterDescriptor(
049: Citations.OGC, "scaleX", Double.class, // Value class
050: // (mandatory)
051: null, // Array of valid values
052: new Double(0.5), // Default value
053: null, // Minimal value
054: null, // Maximal value
055: null, // Unit of measure
056: true); // Parameter is optional
057:
058: /**
059: *
060: */
061: public static final ParameterDescriptor scaleY = new DefaultParameterDescriptor(
062: Citations.OGC, "scaleY", Double.class, // Value class
063: // (mandatory)
064: null, // Array of valid values
065: new Double(0.5), // Default value
066: null, // Minimal value
067: null, // Maximal value
068: null, // Unit of measure
069: true); // Parameter is optional
070:
071: /**
072: *
073: */
074: public static final ParameterDescriptor Interpolation = new DefaultParameterDescriptor(
075: Citations.OGC, "Interpolation", Interpolation.class, // Value
076: // class
077: // (mandatory)
078: null, // Array of valid values
079: new InterpolationNearest(), // Default value
080: null, // Minimal value
081: null, // Maximal value
082: null, // Unit of measure
083: true); // Parameter is optional
084:
085: /**
086: *
087: */
088: public static final ParameterDescriptor BorderExtender = new DefaultParameterDescriptor(
089: Citations.OGC, "BorderExtender", BorderExtender.class, // Value
090: // class
091: // (mandatory)
092: null, // Array of valid values
093: BorderExtenderCopy
094: .createInstance(BorderExtenderCopy.BORDER_COPY), // Default
095: // value
096: null, // Minimal value
097: null, // Maximal value
098: null, // Unit of measure
099: true); // Parameter is optional
100:
101: /**
102: *
103: */
104: public SubsampleAverage() {
105: super (new DefaultParameterDescriptorGroup(Citations.OGC,
106: "SubsampleAverage", new ParameterDescriptor[] {
107: SOURCE_0, scaleX, scaleY, Interpolation,
108: BorderExtender }));
109: }
110:
111: /*
112: * (non-Javadoc)
113: *
114: * @see org.geotools.coverage.processing.AbstractOperation#doOperation(org.opengis.parameter.ParameterValueGroup,
115: * org.geotools.factory.Hints)
116: */
117: public Coverage doOperation(ParameterValueGroup parameters,
118: Hints hints) {
119: return SubsampleAveragedCoverage.create(parameters,
120: (hints instanceof Hints) ? (Hints) hints : new Hints(
121: hints));
122: }
123:
124: }
|