Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some refactorying to make raster and vector process factories extensi…

…ble.

Deprecated GSProcess interface in favor of VectorProcess and RasterProcess
interfaces/extension points loaded via spi.
  • Loading branch information...
commit 240ec22f9d9973b694fcf58490a29dbe62772b80 1 parent d544b50
jdeolive authored
Showing with 319 additions and 120 deletions.
  1. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/AggregateProcess.java
  2. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BarnesSurfaceProcess.java
  3. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BoundsProcess.java
  4. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BufferFeatureCollection.java
  5. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CentroidProcess.java
  6. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ClipProcess.java
  7. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CollectGeometries.java
  8. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CountProcess.java
  9. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/FeatureProcess.java
  10. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/GridProcess.java
  11. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/HeatmapProcess.java
  12. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/InclusionFeatureCollection.java
  13. +1 −2  ...es/unsupported/process-feature/src/main/java/org/geotools/process/vector/IntersectionFeatureCollection.java
  14. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSGeocodeProcess.java
  15. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSMeasureProcess.java
  16. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSSegmentProcess.java
  17. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/NearestProcess.java
  18. +2 −2 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointBuffers.java
  19. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java
  20. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/QueryProcess.java
  21. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/RectangularClipProcess.java
  22. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ReprojectProcess.java
  23. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SimplifyProcess.java
  24. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SnapProcess.java
  25. +1 −1  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/TransformProcess.java
  26. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UnionFeatureCollection.java
  27. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UniqueProcess.java
  28. +28 −0 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorProcess.java
  29. +19 −30 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorProcessFactory.java
  30. +2 −2 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorToRasterProcess.java
  31. +1 −2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorZonalStatistics.java
  32. +29 −0 .../unsupported/process-feature/src/main/resources/META-INF/services/org.geotools.process.vector.VectorProcess
  33. +61 −0 modules/unsupported/process-feature/src/test/java/org/geotools/process/vector/VectorProcessFactoryTest.java
  34. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/AddCoveragesProcess.java
  35. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/AreaGridProcess.java
  36. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/ContourProcess.java
  37. +1 −1  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/CropCoverage.java
  38. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/MultiplyCoveragesProcess.java
  39. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/PolygonExtractionProcess.java
  40. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RangeLookupProcess.java
  41. +1 −2  ...es/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterAsPointCollectionProcess.java
  42. +28 −0 modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterProcess.java
  43. +14 −12 modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterProcessFactory.java
  44. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterZonalStatistics.java
  45. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/ScaleCoverage.java
  46. +1 −2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/StyleCoverage.java
  47. +11 −0 ...s/unsupported/process-raster/src/main/resources/META-INF/services/org.geotools.process.raster.RasterProcess
  48. +61 −0 modules/unsupported/process-raster/src/test/java/org/geotools/process/raster/RasterProcessFactoryTest.java
  49. +25 −0 modules/unsupported/process/src/main/java/org/geotools/process/factory/AnnotatedBeanProcessFactory.java
  50. +1 −0  modules/unsupported/process/src/main/java/org/geotools/process/gs/GSProcess.java
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/AggregateProcess.java
@@ -39,7 +39,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.util.NullProgressListener;
import org.opengis.feature.Feature;
import org.opengis.feature.type.AttributeDescriptor;
@@ -53,7 +52,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Aggregate", description = "Computes one or more aggregation functions on a feature attribute. Functions include Count, Average, Max, Median, Min, StdDev, and Sum.")
-public class AggregateProcess implements GSProcess {
+public class AggregateProcess implements VectorProcess {
// the functions this process can handle
public enum AggregationFunction {
Count, Average, Max, Median, Min, StdDev, Sum;
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BarnesSurfaceProcess.java
@@ -38,7 +38,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.coverage.grid.GridGeometry;
@@ -138,7 +137,7 @@
*/
@DescribeProcess(title = "BarnesSurface", description = "Uses Barnes Analysis to compute an interpolated surface over a set of irregular data points.")
-public class BarnesSurfaceProcess implements GSProcess {
+public class BarnesSurfaceProcess implements VectorProcess {
// no process state is defined, since RenderingTransformation processes must be stateless
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BoundsProcess.java
@@ -22,7 +22,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
/**
* Simple process with a {@link ReferencedEnvelope} as the output
@@ -32,7 +31,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Bounds", description = "Computes the bounding box of the input features.")
-public class BoundsProcess implements GSProcess {
+public class BoundsProcess implements VectorProcess {
@DescribeResult(name = "bounds", description = "Bounding box of input features")
public ReferencedEnvelope execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/BufferFeatureCollection.java
@@ -23,7 +23,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
@@ -52,7 +51,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Buffer", description = "Buffers features by a distance value supplied either as a parameter or by a feature attribute. Calculates buffers based on Cartesian distances.")
-public class BufferFeatureCollection implements GSProcess {
+public class BufferFeatureCollection implements VectorProcess {
@DescribeResult(description = "Buffered feature collection")
public SimpleFeatureCollection execute(
@DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features,
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CentroidProcess.java
@@ -29,7 +29,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
@@ -48,7 +47,7 @@
* @source $URL: http://svn.osgeo.org/geotools/trunk/modules/unsupported/process-feature/src/main/java/org/geotools/process/feature/gs/CentroidProcess.java $
*/
@DescribeProcess(title = "Centroid", description = "Computes the geometric centroids of features")
-public class CentroidProcess implements GSProcess {
+public class CentroidProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Centroids of input features")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ClipProcess.java
@@ -25,7 +25,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.data.simple.SimpleFeatureCollection;
@@ -63,7 +62,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Clip", description = "Clips (crops) features to a given geometry")
-public class ClipProcess implements GSProcess {
+public class ClipProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Clipped feature collection")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CollectGeometries.java
@@ -25,7 +25,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.opengis.util.ProgressListener;
import com.vividsolutions.jts.geom.Geometry;
@@ -40,7 +39,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Collect Geometries", description = "Collects the deafult geometries of the input features and combines them into a single geometry collection")
-public class CollectGeometries implements GSProcess {
+public class CollectGeometries implements VectorProcess {
@DescribeResult(name = "result", description = "Geometry collection of all input geometries")
public GeometryCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/CountProcess.java
@@ -20,7 +20,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.data.simple.SimpleFeatureCollection;
/**
@@ -31,7 +30,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Count Features", description = "Computes the number of features in a feature collection.")
-public class CountProcess implements GSProcess {
+public class CountProcess implements VectorProcess {
/** The functions this process can handle */
public enum AggregationFunction {
Average, Max, Median, Min, StdDev, Sum;
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/FeatureProcess.java
@@ -7,7 +7,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -21,7 +20,7 @@
*
* @source $URL$
*/
-public class FeatureProcess implements GSProcess {
+public class FeatureProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Output feature collection")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/GridProcess.java
@@ -34,7 +34,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -48,7 +47,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Grid", description = "Generates a georeferenced regular grid of cells. Output contains the attributes: cell - the cell polygon; id - a unique identifier; centerX and centerY - the ordinates of the cell center.")
-public class GridProcess implements GSProcess {
+public class GridProcess implements VectorProcess {
enum GridMode {
Rectangular, HexagonFlat, HexagonAngled
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/HeatmapProcess.java
@@ -35,7 +35,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.opengis.coverage.grid.GridCoverage;
import org.opengis.coverage.grid.GridGeometry;
@@ -118,7 +117,7 @@
*
*/
@DescribeProcess(title = "Heatmap", description = "Computes a heatmap surface over a set of data points and outputs as a single-band raster.")
-public class HeatmapProcess implements GSProcess {
+public class HeatmapProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Output raster")
public GridCoverage2D execute(
View
3  ...es/unsupported/process-feature/src/main/java/org/geotools/process/vector/InclusionFeatureCollection.java
@@ -23,7 +23,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
@@ -46,7 +45,7 @@
* @author Pietro Arena - Sinergis
*/
@DescribeProcess(title = "Inclusion of Feature Collections", description = "Returns a feature collection consisting of the features from the first collection which are spatially contained in at least one feature of the second collection.")
-public class InclusionFeatureCollection implements GSProcess {
+public class InclusionFeatureCollection implements VectorProcess {
@DescribeResult(description = "Output feature collection")
public SimpleFeatureCollection execute(
@DescribeParameter(name = "first", description = "First feature collection") SimpleFeatureCollection firstFeatures,
View
3  ...unsupported/process-feature/src/main/java/org/geotools/process/vector/IntersectionFeatureCollection.java
@@ -34,7 +34,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.referencing.CRS;
import org.opengis.feature.simple.SimpleFeature;
@@ -68,7 +67,7 @@
* @author Luca Paolino - GeoSolutions
*/
@DescribeProcess(title = "Intersection of Feature Collections", description = "Spatial intersection of two feature collections, incuding combining attributes from both.")
-public class IntersectionFeatureCollection implements GSProcess {
+public class IntersectionFeatureCollection implements VectorProcess {
private static final Logger logger = Logger
.getLogger("org.geotools.process.feature.gs.IntersectionFeatureCollection");
public static enum IntersectionMode {
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSGeocodeProcess.java
@@ -28,7 +28,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.util.logging.Logging;
import org.opengis.feature.Feature;
import org.opengis.feature.simple.SimpleFeature;
@@ -49,7 +48,7 @@
*
* @source $URL: http://svn.osgeo.org/geotools/trunk/modules/unsupported/process-feature/src/main/java/org/geotools/process/feature/gs/NearestProcess.java $
*/
-public class LRSGeocodeProcess implements GSProcess {
+public class LRSGeocodeProcess implements VectorProcess {
private static final Logger LOGGER = Logging.getLogger(LRSGeocodeProcess.class);
private final GeometryFactory geometryFactory = new GeometryFactory();
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSMeasureProcess.java
@@ -33,7 +33,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.util.logging.Logging;
@@ -60,7 +59,7 @@
*
* @source $URL: http://svn.osgeo.org/geotools/trunk/modules/unsupported/process-feature/src/main/java/org/geotools/process/feature/gs/NearestProcess.java $
*/
-public class LRSMeasureProcess implements GSProcess {
+public class LRSMeasureProcess implements VectorProcess {
private static final Logger LOGGER = Logging.getLogger(LRSMeasureProcess.class);
private final GeometryFactory geometryFactory = new GeometryFactory();
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSSegmentProcess.java
@@ -27,7 +27,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.util.logging.Logging;
import org.opengis.feature.Feature;
import org.opengis.feature.simple.SimpleFeature;
@@ -47,7 +46,7 @@
*
* @source $URL: http://svn.osgeo.org/geotools/trunk/modules/unsupported/process-feature/src/main/java/org/geotools/process/feature/gs/NearestProcess.java $
*/
-public class LRSSegmentProcess implements GSProcess {
+public class LRSSegmentProcess implements VectorProcess {
private static final Logger LOGGER = Logging.getLogger(LRSSegmentProcess.class);
private final GeometryFactory geometryFactory = new GeometryFactory();
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/NearestProcess.java
@@ -33,7 +33,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.util.logging.Logging;
@@ -59,7 +58,7 @@
*
* @source $URL$
*/
-public class NearestProcess implements GSProcess {
+public class NearestProcess implements VectorProcess {
private static final Logger LOGGER = Logging.getLogger(NearestProcess.class);
private GeometryFactory geometryFactory = new GeometryFactory();
View
4 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointBuffers.java
@@ -31,7 +31,7 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
+
import org.geotools.referencing.CRS;
import org.geotools.referencing.GeodeticCalculator;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -52,7 +52,7 @@
* be a point layer, the reference layer must be a polygonal one"
*/
@DescribeProcess(title = "Point Buffers", description = "Returns a collection of circular buffer polygons with specified radii centered on a given point")
-public class PointBuffers implements GSProcess {
+public class PointBuffers implements VectorProcess {
@DescribeResult(name = "buffers", description = "Features for the circular buffer polygons around the point, with attributes geom and radius")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java
@@ -33,7 +33,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -78,7 +77,7 @@
*
*/
@DescribeProcess(title = "Point Stacker", description = "Aggregates a collection of points over a grid into one point per grid cell.")
-public class PointStackerProcess implements GSProcess {
+public class PointStackerProcess implements VectorProcess {
public static final String ATTR_GEOM = "geom";
public static final String ATTR_COUNT = "count";
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/QueryProcess.java
@@ -22,7 +22,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.store.ReTypingFeatureCollection;
import org.geotools.feature.collection.FilteringSimpleFeatureCollection;
@@ -37,7 +36,7 @@
*
* @source $URL$
*/
-public class QueryProcess implements GSProcess {
+public class QueryProcess implements VectorProcess {
@DescribeResult(name = "result", description = "The filtered feature collection")
public SimpleFeatureCollection execute(
@DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features,
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/RectangularClipProcess.java
@@ -24,7 +24,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
/**
* A process clipping the geometries in the input feature collection to a specified rectangle
@@ -35,7 +34,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Rectangular Clip", description = "Clips (crops) features to the specified rectangular extent")
-public class RectangularClipProcess implements GSProcess {
+public class RectangularClipProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Clipped feature collection")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ReprojectProcess.java
@@ -20,7 +20,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.data.crs.ForceCoordinateSystemFeatureResults;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.store.ReprojectingFeatureCollection;
@@ -35,7 +34,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Reproject Features", description = "Reprojects features into a supplied coordinate reference system. Can also force a feature collection to have a given CRS.")
-public class ReprojectProcess implements GSProcess {
+public class ReprojectProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Input feature collection")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SimplifyProcess.java
@@ -28,7 +28,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -47,7 +46,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Simplify", description = "Simplifies feature geometry by reducing vertices using Douglas-Peucker simplification.")
-public class SimplifyProcess implements GSProcess {
+public class SimplifyProcess implements VectorProcess {
@DescribeResult(name = "result", description = "The simplified feature collection")
public SimpleFeatureCollection execute(
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SnapProcess.java
@@ -36,7 +36,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.text.Text;
@@ -63,7 +62,7 @@
*
* @source $URL$
*/
-public class SnapProcess implements GSProcess {
+public class SnapProcess implements VectorProcess {
private static final Logger LOGGER = Logging.getLogger(SnapProcess.class);
private GeometryFactory geometryFactory = new GeometryFactory();
View
2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/TransformProcess.java
@@ -105,7 +105,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Transform", description = "Computes a new feature collection from the input one by renaming, deleting, and computing new attributes. Attribute values are specified as ECQL expressions in the form name=expression.")
-public class TransformProcess implements GSProcess {
+public class TransformProcess implements VectorProcess {
/**
* Definition of an attribute used during transform
* <p>
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UnionFeatureCollection.java
@@ -24,7 +24,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.data.simple.SimpleFeatureCollection;
@@ -46,7 +45,7 @@
* @author Pietro Arena - Sinergis
*/
@DescribeProcess(title = "Union Feature Collections", description = "Returns single feature collection containing all features from two input feature collections. The output attribute schema is a combination of the attributes from the inputs. Attributes with same name but different types will be converted to strings.")
-public class UnionFeatureCollection implements GSProcess {
+public class UnionFeatureCollection implements VectorProcess {
static final String SCHEMA_NAME = "Union_Layer";
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UniqueProcess.java
@@ -28,7 +28,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.util.ProgressListener;
@@ -41,7 +40,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Unique", description = "Returns the unique values of a given attribute in a feature collection.")
-public class UniqueProcess implements GSProcess {
+public class UniqueProcess implements VectorProcess {
@DescribeResult(name = "result", description = "Feature collection with an attribute containing the unique values")
public SimpleFeatureCollection execute(
View
28 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorProcess.java
@@ -0,0 +1,28 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2012, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ */
+package org.geotools.process.vector;
+
+import org.geotools.process.gs.GSProcess;
+
+/**
+ * Marker interface for processes that should be grouped into the "vector" family.
+ *
+ * @author Justin Deoliveira, OpenGeo
+ */
+public interface VectorProcess extends GSProcess {
+
+}
View
49 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorProcessFactory.java
@@ -1,5 +1,10 @@
package org.geotools.process.vector;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.geotools.factory.FactoryRegistry;
import org.geotools.process.factory.AnnotatedBeanProcessFactory;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.vector.AggregateProcess;
@@ -37,37 +42,21 @@
*/
public class VectorProcessFactory extends AnnotatedBeanProcessFactory {
+ static volatile BeanFactoryRegistry<VectorProcess> registry;
+
+ public static BeanFactoryRegistry<VectorProcess> getRegistry() {
+ if (registry == null) {
+ synchronized (VectorProcessFactory.class) {
+ if (registry == null) {
+ registry = new BeanFactoryRegistry<VectorProcess>(VectorProcess.class);
+ }
+ }
+ }
+ return registry;
+ }
+
public VectorProcessFactory() {
- super(Text.text("Vector processes"), "vec",
- AggregateProcess.class,
- BarnesSurfaceProcess.class,
- BoundsProcess.class,
- BufferFeatureCollection.class,
- CentroidProcess.class,
- ClipProcess.class,
- CollectGeometries.class,
- CountProcess.class,
- FeatureProcess.class,
- GridProcess.class,
- HeatmapProcess.class,
- InclusionFeatureCollection.class,
- IntersectionFeatureCollection.class,
- NearestProcess.class,
- PointBuffers.class,
- PointStackerProcess.class,
- QueryProcess.class,
- RectangularClipProcess.class,
- ReprojectProcess.class,
- SimplifyProcess.class,
- SnapProcess.class,
- UnionFeatureCollection.class,
- UniqueProcess.class,
- VectorZonalStatistics.class,
- TransformProcess.class,
- LRSGeocodeProcess.class,
- LRSMeasureProcess.class,
- LRSSegmentProcess.class,
- VectorToRasterProcess.class);
+ super(Text.text("Vector processes"), "vec", getRegistry().lookupBeanClasses());
}
}
View
4 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorToRasterProcess.java
@@ -1,5 +1,5 @@
/*
- * GeoTools - The Open Source Java GIS Toolkit
+ * GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2008-2011, Open Source Geospatial Foundation (OSGeo)
@@ -104,7 +104,7 @@
*
*/
@DescribeProcess(title = "Transform", description = "Converts some or all of a feature collection to a raster grid, using an attribute to specify cell values.")
-public class VectorToRasterProcess {
+public class VectorToRasterProcess implements VectorProcess {
private static final int COORD_GRID_CHUNK_SIZE = 1000;
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorZonalStatistics.java
@@ -26,7 +26,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.process.vector.AggregateProcess.AggregationFunction;
import org.geotools.process.vector.AggregateProcess.Results;
@@ -54,7 +53,7 @@
* The data layer must be a point layer, the reference layer must be a polygonal one
*/
@DescribeProcess(title = "Vector Zonal Statistics", description = "Computes statistics for the distribution of a given attribute in a set of polygonal zones. Input must be points.")
-public class VectorZonalStatistics implements GSProcess {
+public class VectorZonalStatistics implements VectorProcess {
@DescribeResult(name = "statistics", description = "A feature collection with the attributes of the zone layer (prefixed by 'z_') and the statistics fields count,min,max,sum,avg,stddev")
public SimpleFeatureCollection execute(
View
29 ...supported/process-feature/src/main/resources/META-INF/services/org.geotools.process.vector.VectorProcess
@@ -0,0 +1,29 @@
+org.geotools.process.vector.AggregateProcess
+org.geotools.process.vector.BarnesSurfaceProcess
+org.geotools.process.vector.BoundsProcess
+org.geotools.process.vector.BufferFeatureCollection
+org.geotools.process.vector.CentroidProcess
+org.geotools.process.vector.ClipProcess
+org.geotools.process.vector.CollectGeometries
+org.geotools.process.vector.CountProcess
+org.geotools.process.vector.FeatureProcess
+org.geotools.process.vector.GridProcess
+org.geotools.process.vector.HeatmapProcess
+org.geotools.process.vector.InclusionFeatureCollection
+org.geotools.process.vector.IntersectionFeatureCollection
+org.geotools.process.vector.NearestProcess
+org.geotools.process.vector.PointBuffers
+org.geotools.process.vector.PointStackerProcess
+org.geotools.process.vector.QueryProcess
+org.geotools.process.vector.RectangularClipProcess
+org.geotools.process.vector.ReprojectProcess
+org.geotools.process.vector.SimplifyProcess
+org.geotools.process.vector.SnapProcess
+org.geotools.process.vector.UnionFeatureCollection
+org.geotools.process.vector.UniqueProcess
+org.geotools.process.vector.VectorZonalStatistics
+org.geotools.process.vector.TransformProcess
+org.geotools.process.vector.LRSGeocodeProcess
+org.geotools.process.vector.LRSMeasureProcess
+org.geotools.process.vector.LRSSegmentProcess
+org.geotools.process.vector.VectorToRasterProcess
View
61 modules/unsupported/process-feature/src/test/java/org/geotools/process/vector/VectorProcessFactoryTest.java
@@ -0,0 +1,61 @@
+package org.geotools.process.vector;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.geotools.factory.FactoryIteratorProvider;
+import org.geotools.factory.GeoTools;
+import org.geotools.feature.NameImpl;
+import org.geotools.process.Processors;
+import org.geotools.process.factory.DescribeProcess;
+import org.geotools.process.factory.DescribeResult;
+import org.junit.Test;
+import org.opengis.feature.type.Name;
+
+public class VectorProcessFactoryTest {
+
+ VectorProcessFactory factory = new VectorProcessFactory();
+
+ @Test
+ public void testLookup() {
+ Set<Name> names = factory.getNames();
+ assertFalse(names.isEmpty());
+ assertTrue(names.contains(new NameImpl("vec", "Aggregate")));
+ }
+
+ @Test
+ public void testAddCustomProcess() {
+ assertNull(Processors.createProcess(new NameImpl("vec", "Custom")));
+
+ FactoryIteratorProvider p = new FactoryIteratorProvider() {
+ @Override
+ public <T> Iterator<T> iterator(Class<T> category) {
+ if (category == VectorProcess.class) {
+ return (Iterator<T>) Arrays.asList(new CustomProcess()).iterator();
+ }
+ return null;
+ }
+ };
+ GeoTools.addFactoryIteratorProvider(p);
+ try {
+ Processors.reset();
+ assertNotNull(Processors.createProcess(new NameImpl("vec", "Custom")));
+ }
+ finally {
+ GeoTools.removeFactoryIteratorProvider(p);
+ }
+ }
+
+ @DescribeProcess(title = "Custom", description = "Custom mock process")
+ public static class CustomProcess implements VectorProcess {
+ @DescribeResult(name = "result", description = "The result")
+ public void execute() {
+ }
+ }
+}
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/AddCoveragesProcess.java
@@ -23,7 +23,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.opengis.coverage.processing.Operation;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.util.ProgressListener;
@@ -37,7 +36,7 @@
* @author Daniele Romagnoli - GeoSolutions
*/
@DescribeProcess(title = "Add Coverages", description = "Returns a raster generated by pixel-by-pixel addition of two source rasters. Source rasters must have the same bounding box and resolution.")
-public class AddCoveragesProcess implements GSProcess {
+public class AddCoveragesProcess implements RasterProcess {
private static final CoverageProcessor PROCESSOR = CoverageProcessor.getInstance();
private static final Operation ADD = PROCESSOR.getOperation("Add");
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/AreaGridProcess.java
@@ -32,7 +32,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.referencing.CRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -55,7 +54,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Area Grid", description = "Computes a raster grid of given geographic extent with cell values equal to the area the cell represents on the surface of the earth. Area is computed using the EckertIV projection.")
-public class AreaGridProcess implements GSProcess {
+public class AreaGridProcess implements RasterProcess {
private static final String targetCRSWKT = "PROJCS[\"World_Eckert_IV\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Eckert_IV\"],PARAMETER[\"Central_Meridian\",0.0],UNIT[\"Meter\",1.0]]";
@DescribeResult(name = "result", description = "Output raster")
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/ContourProcess.java
@@ -47,7 +47,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.resources.i18n.Vocabulary;
import org.geotools.resources.i18n.VocabularyKeys;
import org.geotools.util.NumberRange;
@@ -78,7 +77,7 @@
* @version $Id$
*/
@DescribeProcess(title = "Contour", description = "Computes contour lines at specified intervals or levels for the values in a raster.")
-public class ContourProcess implements GSProcess {
+public class ContourProcess implements RasterProcess {
private static final InternationalString NO_DATA = Vocabulary
.formatInternational(VocabularyKeys.NODATA);
View
2  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/CropCoverage.java
@@ -44,7 +44,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Crop Coverage", description = "Returns the portion of a raster bounded by a given geometry.")
-public class CropCoverage implements GSProcess {
+public class CropCoverage implements RasterProcess {
private static final CoverageProcessor PROCESSOR = CoverageProcessor.getInstance();
private static final Operation CROP = PROCESSOR.getOperation("CoverageCrop");
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/MultiplyCoveragesProcess.java
@@ -20,7 +20,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.processing.CoverageProcessor;
import org.geotools.process.ProcessException;
@@ -37,7 +36,7 @@
* @author Daniele Romagnoli - GeoSolutions
*/
@DescribeProcess(title = "Multiply Coverages", description = "Returns a raster generated by pixel-by-pixel multiplication of two source rasters. Source rasters must have the same bounding box and resolution.")
-public class MultiplyCoveragesProcess implements GSProcess {
+public class MultiplyCoveragesProcess implements RasterProcess {
private static final CoverageProcessor PROCESSOR = CoverageProcessor.getInstance();
private static final Operation MULTIPLY = PROCESSOR.getOperation("Multiply");
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/PolygonExtractionProcess.java
@@ -38,7 +38,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.data.collection.ListFeatureCollection;
import org.geotools.data.simple.SimpleFeatureCollection;
@@ -70,7 +69,7 @@
* @version $Id$
*/
@DescribeProcess(title = "Polygon Extraction", description = "Extracts vector polygons from a raster, based on regions which are equal or in given ranges")
-public class PolygonExtractionProcess implements GSProcess {
+public class PolygonExtractionProcess implements RasterProcess {
static {
Registry.registerRIF(JAI.getDefaultInstance(), new VectorizeDescriptor(), new VectorizeRIF(), Registry.JAI_TOOLS_PRODUCT);
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RangeLookupProcess.java
@@ -31,7 +31,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.coverage.Category;
import org.geotools.coverage.CoverageFactoryFinder;
@@ -63,7 +62,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Reclassify", description = "Reclassifies a continous raster into integer values defined by a set of ranges")
-public class RangeLookupProcess implements GSProcess {
+public class RangeLookupProcess implements RasterProcess {
private final static double DEFAULT_NODATA = 0d;
View
3  ...unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterAsPointCollectionProcess.java
@@ -30,7 +30,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.data.simple.SimpleFeatureCollection;
@@ -66,7 +65,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Raster As Point Collection", description = "Returns a collection of point features for the pixels of a raster. The band values are provided as attributes.")
-public class RasterAsPointCollectionProcess implements GSProcess {
+public class RasterAsPointCollectionProcess implements RasterProcess {
@DescribeResult(name = "result", description = "Point features")
public SimpleFeatureCollection execute(
View
28 modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterProcess.java
@@ -0,0 +1,28 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2012, Open Source Geospatial Foundation (OSGeo)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ */
+package org.geotools.process.raster;
+
+import org.geotools.process.gs.GSProcess;
+
+/**
+ * Marker interface for processes that should be grouped into the "raster" family.
+ *
+ * @author Justin Deoliveira, OpenGeo
+ */
+public interface RasterProcess extends GSProcess {
+
+}
View
26 modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterProcessFactory.java
@@ -5,19 +5,21 @@
public class RasterProcessFactory extends AnnotatedBeanProcessFactory {
+ static volatile BeanFactoryRegistry<RasterProcess> registry;
+
+ public static BeanFactoryRegistry<RasterProcess> getRegistry() {
+ if (registry == null) {
+ synchronized (RasterProcessFactory.class) {
+ if (registry == null) {
+ registry = new BeanFactoryRegistry<RasterProcess>(RasterProcess.class);
+ }
+ }
+ }
+ return registry;
+ }
+
public RasterProcessFactory() {
- super(Text.text("Raster processes"), "ras",
- AddCoveragesProcess.class,
- AreaGridProcess.class,
- ContourProcess.class,
- CropCoverage.class,
- MultiplyCoveragesProcess.class,
- PolygonExtractionProcess.class,
- RangeLookupProcess.class,
- RasterAsPointCollectionProcess.class,
- RasterZonalStatistics.class,
- ScaleCoverage.class,
- StyleCoverage.class);
+ super(Text.text("Raster processes"), "ras", getRegistry().lookupBeanClasses());
}
}
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/RasterZonalStatistics.java
@@ -32,7 +32,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.process.gs.WrappingIterator;
import org.geotools.coverage.Category;
@@ -86,7 +85,7 @@
* @author Andrea Aime - GeoSolutions
*/
@DescribeProcess(title = "Raster Zonal Statistics", description = "Computes statistics for the distribution of a certain quantity in a set of polygonal zones.")
-public class RasterZonalStatistics implements GSProcess {
+public class RasterZonalStatistics implements RasterProcess {
private final static CoverageProcessor PROCESSOR = CoverageProcessor.getInstance();
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/ScaleCoverage.java
@@ -24,7 +24,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.processing.CoverageProcessor;
import org.opengis.coverage.processing.Operation;
@@ -39,7 +38,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Scale Coverage", description = "Returns a scaled and translated version of a given raster")
-public class ScaleCoverage implements GSProcess {
+public class ScaleCoverage implements RasterProcess {
private static final CoverageProcessor PROCESSOR = CoverageProcessor.getInstance();
private static final Operation SCALE = PROCESSOR.getOperation("Scale");
View
3  modules/unsupported/process-raster/src/main/java/org/geotools/process/raster/StyleCoverage.java
@@ -22,7 +22,6 @@
import org.geotools.process.factory.DescribeParameter;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.GSProcess;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper;
@@ -39,7 +38,7 @@
* @source $URL$
*/
@DescribeProcess(title = "Style Coverage", description = "Styles a raster using a given SLD and raster symbolizer.")
-public class StyleCoverage implements GSProcess {
+public class StyleCoverage implements RasterProcess {
@DescribeResult(name = "result", description = "Styled image")
public GridCoverage2D execute(
View
11 ...nsupported/process-raster/src/main/resources/META-INF/services/org.geotools.process.raster.RasterProcess
@@ -0,0 +1,11 @@
+org.geotools.process.raster.AddCoveragesProcess
+org.geotools.process.raster.AreaGridProcess
+org.geotools.process.raster.ContourProcess
+org.geotools.process.raster.CropCoverage
+org.geotools.process.raster.MultiplyCoveragesProcess
+org.geotools.process.raster.PolygonExtractionProcess
+org.geotools.process.raster.RangeLookupProcess
+org.geotools.process.raster.RasterAsPointCollectionProcess
+org.geotools.process.raster.RasterZonalStatistics
+org.geotools.process.raster.ScaleCoverage
+org.geotools.process.raster.StyleCoverage
View
61 modules/unsupported/process-raster/src/test/java/org/geotools/process/raster/RasterProcessFactoryTest.java
@@ -0,0 +1,61 @@
+package org.geotools.process.raster;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.geotools.factory.FactoryIteratorProvider;
+import org.geotools.factory.GeoTools;
+import org.geotools.feature.NameImpl;
+import org.geotools.process.Processors;
+import org.geotools.process.factory.DescribeProcess;
+import org.geotools.process.factory.DescribeResult;
+import org.junit.Test;
+import org.opengis.feature.type.Name;
+
+public class RasterProcessFactoryTest {
+
+ RasterProcessFactory factory = new RasterProcessFactory();
+
+ @Test
+ public void testLookup() {
+ Set<Name> names = factory.getNames();
+ assertFalse(names.isEmpty());
+ assertTrue(names.contains(new NameImpl("ras", "AddCoverages")));
+ }
+
+ @Test
+ public void testAddCustomProcess() {
+ assertNull(Processors.createProcess(new NameImpl("ras", "Custom")));
+
+ FactoryIteratorProvider p = new FactoryIteratorProvider() {
+ @Override
+ public <T> Iterator<T> iterator(Class<T> category) {
+ if (category == RasterProcess.class) {
+ return (Iterator<T>) Arrays.asList(new CustomProcess()).iterator();
+ }
+ return null;
+ }
+ };
+ GeoTools.addFactoryIteratorProvider(p);
+ try {
+ Processors.reset();
+ assertNotNull(Processors.createProcess(new NameImpl("ras", "Custom")));
+ }
+ finally {
+ GeoTools.removeFactoryIteratorProvider(p);
+ }
+ }
+
+ @DescribeProcess(title = "Custom", description = "Custom mock process")
+ public static class CustomProcess implements RasterProcess {
+ @DescribeResult(name = "result", description = "The result")
+ public void execute() {
+ }
+ }
+}
View
25 modules/unsupported/process/src/main/java/org/geotools/process/factory/AnnotatedBeanProcessFactory.java
@@ -20,11 +20,13 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.geotools.factory.FactoryRegistry;
import org.geotools.feature.NameImpl;
import org.opengis.feature.type.Name;
import org.opengis.util.InternationalString;
@@ -160,4 +162,27 @@ protected Object createProcessBean(Name name) {
}
}
+ /**
+ * Subclass of FactoryRegistry meant for convenience of looking up all the classes
+ * that implement a specific bean interface.
+ */
+ public static class BeanFactoryRegistry<T> extends FactoryRegistry {
+
+ public BeanFactoryRegistry(Class<T> clazz) {
+ super(clazz);
+ }
+
+ public Class<T> getBeanClass() {
+ return (Class<T>) getCategories().next();
+ }
+
+ public Class<? extends T>[] lookupBeanClasses() {
+ Iterator<T> it = getServiceProviders(getBeanClass(), null, null);
+ List<Class> list = new ArrayList();
+ while(it.hasNext()) {
+ list.add((Class<? extends T>) it.next().getClass());
+ }
+ return list.toArray(new Class[list.size()]);
+ }
+ }
}
View
1  modules/unsupported/process/src/main/java/org/geotools/process/gs/GSProcess.java
@@ -23,6 +23,7 @@
* @author Andrea Aime - OpenGeo
*
* @source $URL$
+ * @deprecated Not longer needed.
*/
public interface GSProcess {
Please sign in to comment.
Something went wrong with that request. Please try again.