Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix up process-feature - no surprises here

  • Loading branch information...
commit 162bdb974ec7e8b89d6085a3d99f80330fdbfca6 1 parent 1654950
@jodygarnett jodygarnett authored
Showing with 24 additions and 105 deletions.
  1. +0 −11 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ClipProcess.java
  2. +4 −16 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/InclusionFeatureCollection.java
  3. +0 −12 ...es/unsupported/process-feature/src/main/java/org/geotools/process/vector/IntersectionFeatureCollection.java
  4. +2 −1  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSGeocodeProcess.java
  5. +2 −1  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSMeasureProcess.java
  6. +2 −2 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSSegmentProcess.java
  7. +5 −5 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/NearestProcess.java
  8. +1 −1  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointBuffers.java
  9. +1 −1  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java
  10. +0 −12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SimplifyProcess.java
  11. +5 −5 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SnapProcess.java
  12. +0 −12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/TransformProcess.java
  13. +0 −13 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UnionFeatureCollection.java
  14. +0 −12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorZonalStatistics.java
  15. +2 −1  modules/unsupported/process-feature/src/test/java/org/geotools/process/vector/PointStackerProcessTest.java
View
11 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/ClipProcess.java
@@ -136,17 +136,6 @@ public SimpleFeatureIterator features() {
return new ClippingFeatureIterator(delegate.features(), clip, getSchema());
}
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
static class ClippingFeatureIterator implements SimpleFeatureIterator {
View
20 ...es/unsupported/process-feature/src/main/java/org/geotools/process/vector/InclusionFeatureCollection.java
@@ -17,18 +17,17 @@
*/
package org.geotools.process.vector;
-import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.geotools.process.factory.DescribeParameter;
-import org.geotools.process.factory.DescribeProcess;
-import org.geotools.process.factory.DescribeResult;
-import org.geotools.process.gs.WrappingIterator;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.feature.collection.DecoratingSimpleFeatureCollection;
import org.geotools.feature.simple.SimpleFeatureBuilder;
+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.filter.Filter;
@@ -72,17 +71,6 @@ public SimpleFeatureIterator features() {
return new IncludedFeatureIterator(delegate.features(), delegate, features, getSchema());
}
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
/**
View
12 ...unsupported/process-feature/src/main/java/org/geotools/process/vector/IntersectionFeatureCollection.java
@@ -379,18 +379,6 @@ public SimpleFeatureIterator features() {
delegate.getSchema(), features.getSchema(), firstAttributes, sndAttributes,
intersectionMode, percentagesEnabled, areasEnabled,fb);
}
-
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
/**
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSGeocodeProcess.java
@@ -19,6 +19,7 @@
import java.util.logging.Logger;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureIterator;
@@ -69,7 +70,7 @@ public FeatureCollection execute(
@DescribeParameter(name = "to_measure_attb", description = "Attribute providing end measure of feature") String toMeasureAttb,
@DescribeParameter(name = "measure", description = "Measure of the point along the feature to be computed") Double measure)
throws ProcessException {
- FeatureCollection results = FeatureCollections.newCollection();
+ DefaultFeatureCollection results = new DefaultFeatureCollection();
try {
if (featureCollection == null || featureCollection.size() == 0) {
LOGGER.info("No features provided in request");
View
3  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSMeasureProcess.java
@@ -23,6 +23,7 @@
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureIterator;
@@ -81,7 +82,7 @@ public FeatureCollection execute(
@DescribeParameter(name = "point", description = "Point whose location to measure") Point point,
@DescribeParameter(name = "crs", min = 0, description = "Coordinate reference system to use for input (default is the input collection CRS)") CoordinateReferenceSystem crs)
throws ProcessException {
- FeatureCollection results = FeatureCollections.newCollection();
+ DefaultFeatureCollection results = new DefaultFeatureCollection();
try {
if (featureCollection == null || featureCollection.size() == 0) {
LOGGER.info("No features provided in request");
View
4 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/LRSSegmentProcess.java
@@ -19,8 +19,8 @@
import java.util.logging.Logger;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureIterator;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.process.ProcessException;
@@ -68,7 +68,7 @@ public FeatureCollection execute(
@DescribeParameter(name = "from_measure", description = "Measure for start of segment to extract") Double fromMeasure,
@DescribeParameter(name = "to_measure", description = "Measure for end of segment to extract") Double toMeasure)
throws ProcessException {
- FeatureCollection results = FeatureCollections.newCollection();
+ DefaultFeatureCollection results = new DefaultFeatureCollection();
try {
if (featureCollection == null || featureCollection.size() == 0) {
LOGGER.info("No features provided in request");
View
10 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/NearestProcess.java
@@ -24,8 +24,10 @@
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureCollections;
+import org.geotools.feature.FeatureIterator;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.measure.Measure;
@@ -102,7 +104,7 @@ public FeatureCollection execute(
}
MathTransform crsTransform = CRS.findMathTransform(crs, epsg4326);
- FeatureCollection results = FeatureCollections.newCollection();
+ DefaultFeatureCollection results = new DefaultFeatureCollection();
FeatureType targetFeatureType = createTargetFeatureType(featureCollection.getSchema());
Unit fromUnit = SI.METER;
Unit toUnit = Unit.valueOf("mi");
@@ -110,9 +112,8 @@ public FeatureCollection execute(
Feature nearestFeature = null;
double nearestDistance = 9e9;
double nearestBearing = 0;
- Iterator featureIterator = null;
+ FeatureIterator featureIterator = featureCollection.features();
try {
- featureIterator = featureCollection.iterator();
while (featureIterator.hasNext()) {
SimpleFeature f = (SimpleFeature) featureIterator.next();
if (f.getDefaultGeometryProperty().getValue() == null)
@@ -136,8 +137,7 @@ public FeatureCollection execute(
nearestBearing = calcBearing(co);
}
} finally {
- if (featureIterator != null)
- featureCollection.close(featureIterator);
+ featureIterator.close();
}
if (nearestFeature != null) {
nearestDistance = unitConvert.convert(nearestDistance);
View
2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointBuffers.java
@@ -87,7 +87,7 @@ public SimpleFeatureCollection execute(
}
// we don't expect million of directions, so we use a simple in memory collection
- SimpleFeatureCollection result = new ListFeatureCollection(schema);
+ ListFeatureCollection result = new ListFeatureCollection(schema);
SimpleFeatureBuilder fb = new SimpleFeatureBuilder(schema);
for (int i = 0; i < distances.length; i++) {
fb.add(generator.getBuffer(distances[i]));
View
2  modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/PointStackerProcess.java
@@ -127,7 +127,7 @@ public SimpleFeatureCollection execute(
outputEnv.getMinX(), outputEnv.getMinY());
SimpleFeatureType schema = createType(srcCRS);
- SimpleFeatureCollection result = new ListFeatureCollection(schema);
+ ListFeatureCollection result = new ListFeatureCollection(schema);
SimpleFeatureBuilder fb = new SimpleFeatureBuilder(schema);
GeometryFactory factory = new GeometryFactory(new PackedCoordinateSequenceFactory());
View
12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SimplifyProcess.java
@@ -78,18 +78,6 @@ public SimpleFeatureIterator features() {
return new SimplifyingFeatureIterator(delegate.features(), distance, preserveTopology,
getSchema());
}
-
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
static class SimplifyingFeatureIterator implements SimpleFeatureIterator {
View
10 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/SnapProcess.java
@@ -27,8 +27,10 @@
import javax.measure.unit.Unit;
import org.geotools.data.Parameter;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureCollections;
+import org.geotools.feature.FeatureIterator;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.measure.Measure;
@@ -114,7 +116,7 @@ public FeatureCollection execute(
}
MathTransform crsTransform = CRS.findMathTransform(crs, epsg4326);
- FeatureCollection results = FeatureCollections.newCollection();
+ DefaultFeatureCollection results = new DefaultFeatureCollection();
FeatureType targetFeatureType = createTargetFeatureType(featureCollection.getSchema());
Unit fromUnit = SI.METER;
Unit toUnit = Unit.valueOf("mi");
@@ -122,10 +124,9 @@ public FeatureCollection execute(
Feature nearestFeature = null;
double nearestDistance = 9e9;
double nearestBearing = 0;
- Iterator featureIterator = null;
double[] nearestPoint = new double[2];
+ FeatureIterator featureIterator = featureCollection.features();
try {
- featureIterator = featureCollection.iterator();
while (featureIterator.hasNext()) {
SimpleFeature f = (SimpleFeature) featureIterator.next();
if (f.getDefaultGeometryProperty().getValue() == null)
@@ -151,8 +152,7 @@ public FeatureCollection execute(
nearestPoint[1] = geo1[1];
}
} finally {
- if (featureIterator != null)
- featureCollection.close(featureIterator);
+ featureIterator.close();
}
if (nearestFeature != null) {
nearestDistance = unitConvert.convert(nearestDistance);
View
12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/TransformProcess.java
@@ -303,18 +303,6 @@ public SimpleFeatureType getSchema() {
public SimpleFeatureIterator features() {
return new ReshapeFeatureIterator(delegate.features(), definition, schema);
}
-
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
/**
* Process one feature at time; obtaining values by evaulating the provided list of definitions.
View
13 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/UnionFeatureCollection.java
@@ -112,19 +112,6 @@ public SimpleFeatureIterator features() {
return new UnitedFeatureIterator(delegate.features(), delegate, features.features(),
features, getSchema());
}
-
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
-
@Override
public SimpleFeatureType getSchema() {
return this.schema;
View
12 modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/VectorZonalStatistics.java
@@ -119,18 +119,6 @@ public SimpleFeatureIterator features() {
return new ZonalStatisticsIterator(delegate.features(), dataAttribute, data,
targetSchema);
}
-
- @Override
- public Iterator<SimpleFeature> iterator() {
- return new WrappingIterator(features());
- }
-
- @Override
- public void close(Iterator<SimpleFeature> close) {
- if (close instanceof WrappingIterator) {
- ((WrappingIterator) close).close();
- }
- }
}
/**
View
3  modules/unsupported/process-feature/src/test/java/org/geotools/process/vector/PointStackerProcessTest.java
@@ -20,6 +20,7 @@
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
@@ -182,7 +183,7 @@ private SimpleFeatureCollection createPoints(Coordinate[] pts, ReferencedEnvelop
SimpleFeatureType type = tb.buildFeatureType();
SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
- SimpleFeatureCollection fc = FeatureCollections.newCollection();
+ DefaultFeatureCollection fc = new DefaultFeatureCollection();
GeometryFactory factory = new GeometryFactory(new PackedCoordinateSequenceFactory());
Please sign in to comment.
Something went wrong with that request. Please try again.