Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix up gt-main - very unimpressed with app schema unsafe use of utili…

…ty classes
  • Loading branch information...
commit a870544a3a9591ca60553627446a24cd02a52c59 1 parent 84186e5
@jodygarnett jodygarnett authored
Showing with 893 additions and 647 deletions.
  1. +5 −2 ...xtension/app-schema/app-schema/src/main/java/org/geotools/data/complex/FilteringMappingFeatureIterator.java
  2. +2 −2 modules/library/api/src/main/java/org/geotools/data/FeatureStore.java
  3. +3 −1 modules/library/api/src/main/java/org/geotools/feature/FeatureCollections.java
  4. +3 −2 modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java
  5. +41 −47 modules/library/main/src/main/java/org/geotools/data/AbstractDataStoreTest.java
  6. +3 −2 modules/library/main/src/main/java/org/geotools/data/AbstractFeatureStore.java
  7. +6 −5 modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
  8. +6 −6 modules/library/main/src/main/java/org/geotools/data/DefaultFeatureResults.java
  9. +0 −57 modules/library/main/src/main/java/org/geotools/data/SimpleFeatureCollectionBridge.java
  10. +32 −36 modules/library/main/src/main/java/org/geotools/data/collection/CollectionDataStore.java
  11. +50 −46 modules/library/main/src/main/java/org/geotools/data/collection/FeatureCollectionTest.java
  12. +85 −59 modules/library/main/src/main/java/org/geotools/data/collection/TreeSetFeatureCollection.java
  13. +0 −1  modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesFeatureCollection.java
  14. +5 −5 modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java
  15. +1 −19 modules/library/main/src/main/java/org/geotools/data/store/ReTypingFeatureCollection.java
  16. +131 −0 modules/library/main/src/main/java/org/geotools/data/store/ReTypingFeatureIterator.java
  17. +7 −7 modules/library/main/src/main/java/org/geotools/data/store/ReTypingIterator.java
  18. +7 −25 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingFeatureCollection.java
  19. +141 −0 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingFeatureIterator.java
  20. +8 −9 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingIterator.java
  21. +41 −15 modules/library/main/src/main/java/org/geotools/feature/DefaultFeatureCollection.java
  22. +8 −66 modules/library/main/src/main/java/org/geotools/feature/collection/DecoratingSimpleFeatureCollection.java
  23. +16 −7 modules/library/main/src/main/java/org/geotools/feature/collection/DelegateFeatureIterator.java
  24. +24 −10 modules/library/main/src/main/java/org/geotools/feature/collection/FeatureIteratorImpl.java
  25. +16 −43 modules/library/main/src/main/java/org/geotools/feature/collection/FilteringSimpleFeatureCollection.java
  26. +90 −0 modules/library/main/src/main/java/org/geotools/feature/collection/MaxFeaturesSimpleFeatureIterator.java
  27. +13 −46 modules/library/main/src/main/java/org/geotools/feature/collection/MaxSimpleFeatureCollection.java
  28. +4 −2 modules/library/main/src/main/java/org/geotools/feature/collection/SimpleFeatureIteratorImpl.java
  29. +0 −19 modules/library/main/src/main/java/org/geotools/feature/collection/SortedSimpleFeatureCollection.java
  30. +1 −3 modules/library/main/src/main/java/org/geotools/feature/collection/SubFeatureCollection.java
  31. +21 −19 modules/library/main/src/main/java/org/geotools/feature/visitor/CollectionUtil.java
  32. +10 −5 modules/library/main/src/main/java/org/geotools/filter/FilteringIteration.java
  33. +3 −2 modules/library/main/src/main/java/org/geotools/gml/GMLReceiver.java
  34. +11 −6 modules/library/main/src/main/java/org/geotools/styling/StyleBuilder.java
  35. +4 −4 modules/library/main/src/test/java/org/geotools/data/ArrayFeatureReaderTest.java
  36. +4 −2 modules/library/main/src/test/java/org/geotools/data/collection/TreeSetFeatureCollectionTest.java
  37. +15 −9 modules/library/main/src/test/java/org/geotools/data/memory/MemoryFeatureCollectionTest.java
  38. +2 −4 modules/library/main/src/test/java/org/geotools/data/sort/SortedReaderTest.java
  39. +1 −2  modules/library/main/src/test/java/org/geotools/data/store/FeatureCollectionWrapperTestSupport.java
  40. +25 −14 modules/library/main/src/test/java/org/geotools/data/store/MaxFeaturesFeatureCollectionTest.java
  41. +31 −27 modules/library/main/src/test/java/org/geotools/data/store/ReprojectingFeatureCollectionTest.java
  42. +10 −2 modules/library/main/src/test/java/org/geotools/feature/FeatureCollectionTest.java
  43. +3 −4 modules/library/main/src/test/java/org/geotools/feature/collection/MaxSimpleFeatureCollectionTest.java
  44. +2 −3 modules/library/main/src/test/java/org/geotools/feature/collection/SubFeatureCollectionTest.java
  45. +1 −1  modules/library/main/src/test/java/org/geotools/styling/UserLayerTest.java
  46. +1 −1  ...eogit-versioned/src/main/java/org/geotools/data/versioning/decorator/DefaultVersionedFeatureCollection.java
View
7 ...nsion/app-schema/app-schema/src/main/java/org/geotools/data/complex/FilteringMappingFeatureIterator.java
@@ -27,6 +27,7 @@
import org.geotools.factory.FactoryRegistryException;
import org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer;
import org.opengis.feature.Feature;
+import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.Filter;
import org.opengis.referencing.FactoryException;
@@ -133,9 +134,11 @@ public boolean hasNext() {
if (targetCrs != null) {
List<Feature> features = new ArrayList<Feature>();
GeometryCoordinateSequenceTransformer transformer = new GeometryCoordinateSequenceTransformer();
- Iterator<Feature> reprojectedFeatures;
+ Iterator<SimpleFeature> reprojectedFeatures;
try {
- reprojectedFeatures = new ReprojectingIterator(srcFeatures.iterator(), mappedSource
+ // this is really bad, app-schema really needs general feature utility classes
+ Iterator iterator = srcFeatures.iterator();
+ reprojectedFeatures = new ReprojectingIterator(iterator, mappedSource
.getSchema().getCoordinateReferenceSystem(), targetCrs,
(SimpleFeatureType) this.sourceFeatures.getSchema(), transformer);
while (reprojectedFeatures.hasNext()) {
View
4 modules/library/api/src/main/java/org/geotools/data/FeatureStore.java
@@ -69,13 +69,13 @@
* A list of {@code FeatureIds} is returned, one for each feature in the order created.
* However, these might not be assigned until after a commit has been performed.
*
- * @param collection the collection of features to add
+ * @param featureCollection the collection of features to add
*
* @return the {@code FeatureIds} of the newly added features
*
* @throws IOException if an error occurs modifying the data source
*/
- List<FeatureId> addFeatures(FeatureCollection<T, F> collection) throws IOException;
+ List<FeatureId> addFeatures(FeatureCollection<T, F> featureCollection) throws IOException;
/**
* Removes features selected by the given filter.
View
4 modules/library/api/src/main/java/org/geotools/feature/FeatureCollections.java
@@ -30,7 +30,7 @@
* Provides a mechanism for obtaining a SimpleFeatureCollection instance.
* @author Ian Schneider
*
- *
+ * @deprecated Use DefaultFeatureCollection
* @source $URL$
*/
public abstract class FeatureCollections implements Factory {
@@ -43,6 +43,7 @@ private static FeatureCollections instance() {
/**
* create a new SimpleFeatureCollection using the current default factory.
* @return A SimpleFeatureCollection instance.
+ * @deprecated Use new DefaultFeatureCollection(null,null)
*/
public static SimpleFeatureCollection newCollection() {
return instance().createCollection();
@@ -57,6 +58,7 @@ public static SimpleFeatureCollection newCollection() {
* @return A new SimpleFeatureCollection intsance with the specified id.
*
* @since 2.4
+ * @deprecated Use new DefaultFeatureCollection( id, null )
*/
public static SimpleFeatureCollection newCollection( String id ) {
return instance().createCollection( id );
View
5 modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureStore.java
@@ -232,14 +232,15 @@ public ContentFeatureStore(ContentEntry entry,Query query) {
* <p>
* This method calls through to {@link #addFeatures(Collection)}.
* </p>
+ * @param featureCollection
*/
- public final List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
+ public final List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> featureCollection)
throws IOException {
// gather up id's
List<FeatureId> ids = new LinkedList<FeatureId>();
FeatureWriter<SimpleFeatureType, SimpleFeature> writer = getWriterAppend();
- FeatureIterator<SimpleFeature> f = collection.features();
+ FeatureIterator<SimpleFeature> f = featureCollection.features();
try {
while (f.hasNext()) {
SimpleFeature feature = (SimpleFeature) f.next();
View
88 modules/library/main/src/main/java/org/geotools/data/AbstractDataStoreTest.java
@@ -124,16 +124,11 @@ protected void setUp() throws Exception {
}
SimpleFeature[] grabArray( SimpleFeatureCollection features, int size ){
- try {
- SimpleFeature array[] = new SimpleFeature[ size ];
- array = (SimpleFeature[]) features.toArray( array );
- assertNotNull( array );
-
- return array;
- }
- finally {
- features.purge();
- }
+ SimpleFeature array[] = new SimpleFeature[ size ];
+ array = (SimpleFeature[]) features.toArray( array );
+ assertNotNull( array );
+
+ return array;
}
protected void tearDown() throws Exception {
@@ -459,7 +454,7 @@ void assertCovers(String msg, SimpleFeatureCollection c1, SimpleFeatureCollectio
public void testGetFeatureReader()
throws IOException, IllegalAttributeException {
- Query query = new DefaultQuery(roadType.getTypeName());
+ Query query = new Query(roadType.getTypeName());
FeatureReader<SimpleFeatureType, SimpleFeature> reader = data.getFeatureReader(query,
Transaction.AUTO_COMMIT);
assertCovered(roadFeatures, reader);
@@ -468,7 +463,7 @@ public void testGetFeatureReader()
public void testGetFeatureReaderMutability()
throws IOException, IllegalAttributeException {
- Query query = new DefaultQuery(roadType.getTypeName());
+ Query query = new Query(roadType.getTypeName());
FeatureReader<SimpleFeatureType, SimpleFeature> reader = data.getFeatureReader(query,
Transaction.AUTO_COMMIT);
SimpleFeature feature;
@@ -500,12 +495,12 @@ public void testGetFeatureReaderMutability()
public void testGetFeatureReaderConcurancy()
throws NoSuchElementException, IOException, IllegalAttributeException {
- Query query = new DefaultQuery(roadType.getTypeName());
+ Query query = new Query(roadType.getTypeName());
FeatureReader<SimpleFeatureType, SimpleFeature> reader1 = data.getFeatureReader(query,
Transaction.AUTO_COMMIT);
FeatureReader<SimpleFeatureType, SimpleFeature> reader2 = data.getFeatureReader(query,
Transaction.AUTO_COMMIT);
- query = new DefaultQuery(riverType.getTypeName());
+ query = new Query(riverType.getTypeName());
FeatureReader<SimpleFeatureType, SimpleFeature> reader3 = data.getFeatureReader(query,
Transaction.AUTO_COMMIT);
@@ -553,13 +548,13 @@ public void testGetFeatureReaderFilterAutoCommit()
SimpleFeatureType type = data.getSchema("ROAD");
FeatureReader<SimpleFeatureType, SimpleFeature> reader;
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertFalse(reader instanceof FilteringFeatureReader);
assertEquals(type, reader.getFeatureType());
assertEquals(roadFeatures.length, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD", Filter.EXCLUDE),
+ reader = data.getFeatureReader(new Query("ROAD", Filter.EXCLUDE),
Transaction.AUTO_COMMIT);
//TODO: This assert sucks since it EXPECTS an emptyFeatureWriter...well, we got A writer...
@@ -570,7 +565,7 @@ public void testGetFeatureReaderFilterAutoCommit()
assertEquals(type, reader.getFeatureType());
assertEquals(0, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD", rd1Filter),
+ reader = data.getFeatureReader(new Query("ROAD", rd1Filter),
Transaction.AUTO_COMMIT);
//TODO: Do we care what type it is? In fact, we'll never get FilteringFeatureReader
@@ -586,19 +581,19 @@ public void testGetFeatureReaderFilterTransaction()
SimpleFeatureType type = data.getSchema("ROAD");
FeatureReader<SimpleFeatureType, SimpleFeature> reader;
- reader = data.getFeatureReader(new DefaultQuery("ROAD", Filter.EXCLUDE), t);
+ reader = data.getFeatureReader(new Query("ROAD", Filter.EXCLUDE), t);
//TODO: remove this silly check!
//assertTrue(reader instanceof EmptyFeatureReader);
assertEquals(type, reader.getFeatureType());
assertEquals(0, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t);
+ reader = data.getFeatureReader(new Query("ROAD"), t);
assertTrue(reader instanceof DiffFeatureReader);
assertEquals(type, reader.getFeatureType());
assertEquals(roadFeatures.length, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD", rd1Filter), t);
+ reader = data.getFeatureReader(new Query("ROAD", rd1Filter), t);
//assertTrue(reader instanceof DiffFeatureReader);//Currently wrapped by a filtering feature reader
assertEquals(type, reader.getFeatureType());
@@ -608,23 +603,23 @@ public void testGetFeatureReaderFilterTransaction()
store.setTransaction(t);
store.removeFeatures(rd1Filter);
- reader = data.getFeatureReader(new DefaultQuery("ROAD", Filter.EXCLUDE), t);
+ reader = data.getFeatureReader(new Query("ROAD", Filter.EXCLUDE), t);
assertEquals(0, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t);
+ reader = data.getFeatureReader(new Query("ROAD"), t);
assertEquals(roadFeatures.length - 1, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD", rd1Filter), t);
+ reader = data.getFeatureReader(new Query("ROAD", rd1Filter), t);
assertEquals(0, count(reader));
t.rollback();
- reader = data.getFeatureReader(new DefaultQuery("ROAD", Filter.EXCLUDE), t);
+ reader = data.getFeatureReader(new Query("ROAD", Filter.EXCLUDE), t);
assertEquals(0, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t);
+ reader = data.getFeatureReader(new Query("ROAD"), t);
assertEquals(roadFeatures.length, count(reader));
- reader = data.getFeatureReader(new DefaultQuery("ROAD", rd1Filter), t);
+ reader = data.getFeatureReader(new Query("ROAD", rd1Filter), t);
assertEquals(1, count(reader));
}
@@ -663,7 +658,7 @@ boolean covers(SimpleFeatureCollection features, SimpleFeature[] array)
SimpleFeature feature;
int count = 0;
- Iterator i = features.iterator();
+ SimpleFeatureIterator i = features.features();
try {
while (i.hasNext()) {
feature = (SimpleFeature) i.next();
@@ -673,7 +668,7 @@ boolean covers(SimpleFeatureCollection features, SimpleFeature[] array)
count++;
}
} finally {
- features.close( i );
+ i.close();
}
return count == array.length;
}
@@ -877,7 +872,7 @@ public void testGetFeaturesWriterModify()
feature = null;
- FeatureReader<SimpleFeatureType, SimpleFeature> reader = data.getFeatureReader(new DefaultQuery("ROAD",
+ FeatureReader<SimpleFeatureType, SimpleFeature> reader = data.getFeatureReader(new Query("ROAD",
rd1Filter), Transaction.AUTO_COMMIT);
if (reader.hasNext()) {
@@ -979,7 +974,7 @@ public void testGetFeatureWriterTransaction() throws Exception {
FINAL[i] = newRoad;
// start of with ORIGINAL
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, ORIGIONAL));
@@ -993,12 +988,12 @@ public void testGetFeatureWriterTransaction() throws Exception {
}
// still have ORIGIONAL and t1 has REMOVE
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, ORIGIONAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t1);
+ reader = data.getFeatureReader(new Query("ROAD"), t1);
assertTrue(covers(reader, REMOVE));
// close writer1
@@ -1007,10 +1002,10 @@ public void testGetFeatureWriterTransaction() throws Exception {
writer1.close();
// We still have ORIGIONAL and t1 has REMOVE
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, ORIGIONAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t1);
+ reader = data.getFeatureReader(new Query("ROAD"), t1);
assertTrue(covers(reader, REMOVE));
// writer 2 adds road.rd4 on t2
@@ -1021,10 +1016,10 @@ public void testGetFeatureWriterTransaction() throws Exception {
writer2.write();
// We still have ORIGIONAL and t2 has ADD
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, ORIGIONAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t2);
+ reader = data.getFeatureReader(new Query("ROAD"), t2);
assertTrue(coversLax(reader, ADD));
// close writer2
@@ -1033,10 +1028,10 @@ public void testGetFeatureWriterTransaction() throws Exception {
writer2.close();
// Still have ORIGIONAL and t2 has ADD
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, ORIGIONAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t2);
+ reader = data.getFeatureReader(new Query("ROAD"), t2);
assertTrue(coversLax(reader, ADD));
// commit t1
@@ -1047,12 +1042,12 @@ public void testGetFeatureWriterTransaction() throws Exception {
// We now have REMOVE, as does t1 (which has not additional diffs)
// t2 will have FINAL
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(covers(reader, REMOVE));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t1);
+ reader = data.getFeatureReader(new Query("ROAD"), t1);
assertTrue(covers(reader, REMOVE));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t2);
+ reader = data.getFeatureReader(new Query("ROAD"), t2);
assertTrue(coversLax(reader, FINAL));
// commit t2
@@ -1061,14 +1056,14 @@ public void testGetFeatureWriterTransaction() throws Exception {
t2.commit();
// We now have Number( remove one and add one)
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
- reader = data.getFeatureReader(new DefaultQuery("ROAD"),
+ reader = data.getFeatureReader(new Query("ROAD"),
Transaction.AUTO_COMMIT);
assertTrue(coversLax(reader, FINAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t1);
+ reader = data.getFeatureReader(new Query("ROAD"), t1);
assertTrue(coversLax(reader, FINAL));
- reader = data.getFeatureReader(new DefaultQuery("ROAD"), t2);
+ reader = data.getFeatureReader(new Query("ROAD"), t2);
assertTrue(coversLax(reader, FINAL));
}
@@ -1105,8 +1100,7 @@ public void atestGetFeatureSourceRoad() throws IOException {
//We need to fetch "GEOM" since we'll need to create the bounds based
//on the geometry later on (getting the geom from the DB is expensive and
//so far unsupported
- DefaultQuery query = new DefaultQuery("ROAD", rd12Filter,
- new String[] { "NAME", });
+ Query query = new Query("ROAD", rd12Filter, new String[] { "NAME", });
SimpleFeatureCollection half = road.getFeatures(query);
assertEquals(2, half.size());
View
5 modules/library/main/src/main/java/org/geotools/data/AbstractFeatureStore.java
@@ -26,6 +26,7 @@
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.factory.Hints;
import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureIterator;
import org.geotools.feature.IllegalAttributeException;
import org.geotools.feature.NameImpl;
import org.geotools.filter.identity.FeatureIdImpl;
@@ -301,7 +302,7 @@ public void modifyFeatures(Name[] attributeNames, Object[] attributeValues, Filt
FeatureWriter<SimpleFeatureType, SimpleFeature> writer = getDataStore()
.getFeatureWriterAppend(typeName, getTransaction());
- Iterator iterator = collection.iterator();
+ FeatureIterator iterator = collection.features();
try {
while (iterator.hasNext()) {
@@ -324,7 +325,7 @@ public void modifyFeatures(Name[] attributeNames, Object[] attributeValues, Filt
addedFids.add(newFeature.getIdentifier());
}
} finally {
- collection.close( iterator );
+ iterator.close();
writer.close();
}
return addedFids;
View
11 modules/library/main/src/main/java/org/geotools/data/DataUtilities.java
@@ -1226,7 +1226,8 @@ public static SimpleFeatureCollection results(final SimpleFeatureCollection coll
* @return FeatureCollection
*/
public static SimpleFeatureCollection collection(SimpleFeature[] features) {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ // JG: There may be some performance to be gained by using ListFeatureCollection here
+ DefaultFeatureCollection collection = new DefaultFeatureCollection(null,null);
final int length = features.length;
for (int i = 0; i < length; i++) {
collection.add(features[i]);
@@ -1497,7 +1498,7 @@ public void visit(Feature feature) {
* @return FeatureCollection
*/
public static SimpleFeatureCollection collection(List<SimpleFeature> list) {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ DefaultFeatureCollection collection = new DefaultFeatureCollection( null, null);
for (SimpleFeature feature : list) {
collection.add(feature);
}
@@ -1520,7 +1521,7 @@ public static SimpleFeatureCollection collection(List<SimpleFeature> list) {
* @return FeatureCollection
*/
public static SimpleFeatureCollection collection(SimpleFeature feature) {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ DefaultFeatureCollection collection = new DefaultFeatureCollection( null, null);
collection.add(feature);
return collection;
}
@@ -1540,7 +1541,7 @@ public static SimpleFeatureCollection collection(SimpleFeature feature) {
*/
public static SimpleFeatureCollection collection(
FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ DefaultFeatureCollection collection = new DefaultFeatureCollection(null,null);
try {
while (reader.hasNext()) {
try {
@@ -1572,7 +1573,7 @@ public static SimpleFeatureCollection collection(
*/
public static SimpleFeatureCollection collection(SimpleFeatureIterator reader)
throws IOException {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ DefaultFeatureCollection collection = new DefaultFeatureCollection( null,null);
try {
while (reader.hasNext()) {
try {
View
12 modules/library/main/src/main/java/org/geotools/data/DefaultFeatureResults.java
@@ -27,12 +27,13 @@
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.data.store.DataFeatureCollection;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollections;
-import org.geotools.feature.IllegalAttributeException;
import org.geotools.feature.SchemaException;
import org.geotools.feature.type.GeometryDescriptorImpl;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.geotools.referencing.CRS;
+import org.opengis.feature.IllegalAttributeException;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
@@ -346,10 +347,9 @@ public int getCount() throws IOException {
public SimpleFeatureCollection collection() throws IOException {
try {
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
- //Feature feature;
+ DefaultFeatureCollection collection = new DefaultFeatureCollection(null,null);
+
FeatureReader<SimpleFeatureType, SimpleFeature> reader = reader();
- //SimpleFeatureType type = reader.getFeatureType();
try {
while (reader.hasNext()) {
collection.add(reader.next());
@@ -358,8 +358,8 @@ public SimpleFeatureCollection collection() throws IOException {
reader.close();
}
- return collection;
- } catch (IllegalAttributeException e) {
+ return collection;
+ } catch (org.opengis.feature.IllegalAttributeException e) {
throw new DataSourceException("Could not read feature ", e);
}
}
View
57 modules/library/main/src/main/java/org/geotools/data/SimpleFeatureCollectionBridge.java
@@ -57,9 +57,6 @@ public SimpleFeatureCollectionBridge(
if( featureCollection instanceof SimpleFeatureCollection){
throw new IllegalArgumentException("Already a SimpleFeatureCollection");
}
- if( featureCollection == null ){
- throw new NullPointerException("FeatureCollection required");
- }
this.collection = featureCollection;
}
@@ -92,35 +89,6 @@ public void accepts(FeatureVisitor visitor, ProgressListener progress) throws IO
collection.accepts(visitor, progress);
}
- public boolean add(SimpleFeature feature) {
- return collection.add(feature);
- }
-
- public boolean addAll(Collection<? extends SimpleFeature> toAdd) {
- return collection.addAll(toAdd);
- }
-
- public boolean addAll(
- FeatureCollection<? extends SimpleFeatureType, ? extends SimpleFeature> resource) {
- return collection.addAll(resource);
- }
-
- public void addListener(CollectionListener listener) throws NullPointerException {
- collection.addListener(listener);
- }
-
- public void clear() {
- collection.clear();
- }
-
- public void close(FeatureIterator<SimpleFeature> close) {
- collection.close(close);
- }
-
- public void close(Iterator<SimpleFeature> close) {
- collection.close(close);
- }
-
public boolean contains(Object o) {
return collection.contains(o);
}
@@ -145,31 +113,6 @@ public boolean isEmpty() {
return collection.isEmpty();
}
- public Iterator<SimpleFeature> iterator() {
- return collection.iterator();
- }
-
- @SuppressWarnings("deprecation")
- public void purge() {
- collection.purge();
- }
-
- public boolean remove(Object o) {
- return collection.remove(o);
- }
-
- public boolean removeAll(Collection<?> c) {
- return collection.removeAll(c);
- }
-
- public void removeListener(CollectionListener listener) throws NullPointerException {
- collection.removeListener(listener);
- }
-
- public boolean retainAll(Collection<?> c) {
- return collection.retainAll(c);
- }
-
public int size() {
return collection.size();
}
View
68 modules/library/main/src/main/java/org/geotools/data/collection/CollectionDataStore.java
@@ -17,17 +17,13 @@
package org.geotools.data.collection;
import java.io.IOException;
-import java.util.Iterator;
import org.geotools.data.AbstractDataStore;
import org.geotools.data.DataSourceException;
import org.geotools.data.FeatureReader;
import org.geotools.data.Query;
import org.geotools.data.SchemaNotFoundException;
-import org.geotools.data.Transaction;
import org.geotools.data.simple.SimpleFeatureCollection;
-import org.geotools.feature.CollectionEvent;
-import org.geotools.feature.CollectionListener;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureIterator;
@@ -59,7 +55,7 @@
public CollectionDataStore(SimpleFeatureType schema) {
this.collection = FeatureCollections.newCollection();
this.featureType = schema;
- collection.addListener(new FeatureCollectionListener());
+ //collection.addListener(new FeatureCollectionListener());
}
/**
@@ -82,7 +78,7 @@ public CollectionDataStore(FeatureCollection<SimpleFeatureType,SimpleFeature> co
// collection.close(iter);
// }
}
- collection.addListener(new FeatureCollectionListener());
+ //collection.addListener(new FeatureCollectionListener());
}
/**
@@ -192,34 +188,34 @@ protected int getCount(Query query)
return count;
}
- /**
- * Simple listener that forwards collection events into data store events
- *
- * @author aaime
- */
- private class FeatureCollectionListener implements CollectionListener {
- public void collectionChanged(CollectionEvent tce) {
- String typeName = featureType.getTypeName();
- ReferencedEnvelope bounds = null;
-
- bounds = getBoundsInternal(Query.ALL);
-
- switch (tce.getEventType()) {
- case CollectionEvent.FEATURES_ADDED:
- listenerManager.fireFeaturesAdded(typeName, Transaction.AUTO_COMMIT, bounds, false);
-
- break;
-
- case CollectionEvent.FEATURES_CHANGED:
- listenerManager.fireFeaturesChanged(typeName, Transaction.AUTO_COMMIT, bounds, false);
-
- break;
-
- case CollectionEvent.FEATURES_REMOVED:
- listenerManager.fireFeaturesRemoved(typeName, Transaction.AUTO_COMMIT, bounds, false);
-
- break;
- }
- }
- }
+// /**
+// * Simple listener that forwards collection events into data store events
+// *
+// * @author aaime
+// */
+// private class FeatureCollectionListener implements CollectionListener {
+// public void collectionChanged(CollectionEvent tce) {
+// String typeName = featureType.getTypeName();
+// ReferencedEnvelope bounds = null;
+//
+// bounds = getBoundsInternal(Query.ALL);
+//
+// switch (tce.getEventType()) {
+// case CollectionEvent.FEATURES_ADDED:
+// listenerManager.fireFeaturesAdded(typeName, Transaction.AUTO_COMMIT, bounds, false);
+//
+// break;
+//
+// case CollectionEvent.FEATURES_CHANGED:
+// listenerManager.fireFeaturesChanged(typeName, Transaction.AUTO_COMMIT, bounds, false);
+//
+// break;
+//
+// case CollectionEvent.FEATURES_REMOVED:
+// listenerManager.fireFeaturesRemoved(typeName, Transaction.AUTO_COMMIT, bounds, false);
+//
+// break;
+// }
+// }
+// }
}
View
96 modules/library/main/src/main/java/org/geotools/data/collection/FeatureCollectionTest.java
@@ -19,6 +19,7 @@
package org.geotools.data.collection;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
@@ -34,8 +35,10 @@
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureComparators;
import org.geotools.feature.FeatureComparators.Name;
+import org.geotools.feature.FeatureIterator;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
+import org.opengis.feature.Feature;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -70,11 +73,14 @@ protected void setUp() throws Exception {
SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
tb.setName("Dummy");
SimpleFeatureType schema = tb.buildFeatureType();
- features = newCollection(schema);
+
SimpleFeatureBuilder b = new SimpleFeatureBuilder(schema);
+ List<SimpleFeature> list = new ArrayList<SimpleFeature>();
for (int i = 0; i < 100; i++) {
- features.add(b.buildFeature(null));
+ list.add(b.buildFeature(null));
}
+
+ features = newCollection(schema, list);
}
/**
@@ -89,9 +95,10 @@ protected void setUp() throws Exception {
* </pre>
*
* @param schema
+ * @param list
* @return a new feature collection
*/
- protected abstract SimpleFeatureCollection newCollection(SimpleFeatureType schema);
+ protected abstract SimpleFeatureCollection newCollection(SimpleFeatureType schema, List<SimpleFeature> list);
public Collection randomPiece(Collection original) {
LinkedList next = new LinkedList();
@@ -106,9 +113,9 @@ public Collection randomPiece(Collection original) {
return next;
}
- public Collection randomPiece(FeatureCollection original) {
- LinkedList next = new LinkedList();
- Iterator og = original.iterator();
+ public <F extends Feature> Collection<F> randomPiece(FeatureCollection<?,F> original) {
+ LinkedList<F> next = new LinkedList<F>();
+ FeatureIterator<F> og = original.features();
try {
while (og.hasNext()) {
if (Math.random() > .5) {
@@ -119,7 +126,7 @@ public Collection randomPiece(FeatureCollection original) {
}
return next;
} finally {
- original.close(og);
+ og.close();
}
}
@@ -142,9 +149,8 @@ public void testBounds() throws Exception {
SimpleFeatureType t = tb.buildFeatureType();
- SimpleFeatureCollection fc = FeatureCollections.newCollection();
+ TreeSetFeatureCollection fc = new TreeSetFeatureCollection( null, t );
SimpleFeatureBuilder b = new SimpleFeatureBuilder(t);
-
for (int i = 0; i < g.length; i++) {
b.add(g[i]);
fc.add(b.buildFeature(null));
@@ -154,43 +160,50 @@ public void testBounds() throws Exception {
public void testSetAbilities() {
int size = features.size();
- features.addAll(randomPiece(features));
- assertEquals(features.size(), size);
+ if( features instanceof Collection ){
+ ((Collection<SimpleFeature>)features).addAll(randomPiece(features));
+ assertEquals(features.size(), size);
+ }
}
public void testAddRemoveAllAbilities() throws Exception {
Collection half = randomPiece(features);
Collection otherHalf = DataUtilities.list(features);
- otherHalf.removeAll(half);
- features.removeAll(half);
- assertTrue(features.containsAll(otherHalf));
- assertTrue(!features.containsAll(half));
- features.removeAll(otherHalf);
- assertTrue(features.size() == 0);
- features.addAll(half);
- assertTrue(features.containsAll(half));
- features.addAll(otherHalf);
- assertTrue(features.containsAll(otherHalf));
- features.retainAll(otherHalf);
- assertTrue(features.containsAll(otherHalf));
- assertTrue(!features.containsAll(half));
- features.addAll(otherHalf);
- Iterator i = features.iterator();
- while (i.hasNext()) {
- i.next();
- i.remove();
+
+ if( features instanceof Collection){
+ Collection<SimpleFeature> collection = (Collection<SimpleFeature>) features;
+
+ otherHalf.removeAll(half);
+ collection.removeAll(half);
+ assertTrue(features.containsAll(otherHalf));
+ assertTrue(!features.containsAll(half));
+ collection.removeAll(otherHalf);
+ assertTrue(features.size() == 0);
+ collection.addAll(half);
+ assertTrue(features.containsAll(half));
+ collection.addAll(otherHalf);
+ assertTrue(features.containsAll(otherHalf));
+ collection.retainAll(otherHalf);
+ assertTrue(features.containsAll(otherHalf));
+ assertTrue(!features.containsAll(half));
+ collection.addAll(otherHalf);
+ Iterator<SimpleFeature> i = collection.iterator();
+ while (i.hasNext()) {
+ i.next();
+ i.remove();
+ }
+ assertEquals(features.size(), 0);
+
+ SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
+ tb.setName("XXX");
+ SimpleFeatureBuilder b = new SimpleFeatureBuilder(tb.buildFeatureType());
+
+ assertTrue(!collection.remove(b.buildFeature(null)));
}
- assertEquals(features.size(), 0);
-
- SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder();
- tb.setName("XXX");
- SimpleFeatureBuilder b = new SimpleFeatureBuilder(tb.buildFeatureType());
-
- assertTrue(!features.remove(b.buildFeature(null)));
}
public void testAssorted() {
- SimpleFeatureCollection copy = FeatureCollections.newCollection();
+ TreeSetFeatureCollection copy = new TreeSetFeatureCollection();
copy.addAll(features);
copy.clear();
assertTrue(copy.isEmpty());
@@ -209,15 +222,6 @@ public void testAssorted() {
while (copyIterator.hasNext() && featuresIterator.hasNext()) {
assertEquals(copyIterator.next(), featuresIterator.next());
}
-
- SimpleFeatureCollection listen = FeatureCollections.newCollection();
- ListenerProxy counter = new ListenerProxy();
- listen.addListener(counter);
- listen.addAll(features);
- assertEquals(1, counter.changeEvents);
- listen.removeListener(counter);
- listen.removeAll(DataUtilities.list(features));
- assertEquals(1, counter.changeEvents);
}
/**
View
144 modules/library/main/src/main/java/org/geotools/data/collection/TreeSetFeatureCollection.java
@@ -17,6 +17,7 @@
package org.geotools.data.collection;
// J2SE interfaces
+import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -97,7 +98,7 @@
/**
* listeners
*/
- protected List<CollectionListener> listeners = new ArrayList<CollectionListener>();
+ // protected List<CollectionListener> listeners = new ArrayList<CollectionListener>();
/**
* id used when serialized to gml
@@ -110,6 +111,13 @@
protected SimpleFeatureType schema;
/**
+ * FeatureCollection schema will be defined by the first added feature.
+ */
+ public TreeSetFeatureCollection(){
+ this( (String) null, (SimpleFeatureType) null);
+ }
+
+ /**
* This constructor should not be used by client code.
*
* @param collection
@@ -164,25 +172,25 @@ public ReferencedEnvelope getBounds() {
/**
* To let listeners know that something has changed.
*/
- protected void fireChange(SimpleFeature[] features, int type) {
- bounds = null;
-
- CollectionEvent cEvent = new CollectionEvent(this, features, type);
-
- for (int i = 0, ii = listeners.size(); i < ii; i++) {
- ((CollectionListener) listeners.get(i)).collectionChanged(cEvent);
- }
- }
-
- protected void fireChange(SimpleFeature feature, int type) {
- fireChange(new SimpleFeature[] { feature }, type);
- }
-
- protected void fireChange(Collection<SimpleFeature> coll, int type) {
- SimpleFeature[] features = new SimpleFeature[coll.size()];
- features = (SimpleFeature[]) coll.toArray(features);
- fireChange(features, type);
- }
+// protected void fireChange(SimpleFeature[] features, int type) {
+// bounds = null;
+//
+// CollectionEvent cEvent = new CollectionEvent(this, features, type);
+//
+// for (int i = 0, ii = listeners.size(); i < ii; i++) {
+// ((CollectionListener) listeners.get(i)).collectionChanged(cEvent);
+// }
+// }
+//
+// protected void fireChange(SimpleFeature feature, int type) {
+// fireChange(new SimpleFeature[] { feature }, type);
+// }
+//
+// protected void fireChange(Collection<SimpleFeature> coll, int type) {
+// SimpleFeature[] features = new SimpleFeature[coll.size()];
+// features = (SimpleFeature[]) coll.toArray(features);
+// fireChange(features, type);
+// }
/**
* Ensures that this collection contains the specified element (optional operation). Returns
@@ -212,7 +220,13 @@ protected void fireChange(Collection<SimpleFeature> coll, int type) {
public boolean add(SimpleFeature o) {
return add(o, true);
}
-
+ /**
+ * Add a feature (safely to the internal collection).
+ *
+ * @param feature
+ * @param fire ignored (formally used to control events)
+ * @return true of feature was added
+ */
protected boolean add(SimpleFeature feature, boolean fire) {
// This cast is neccessary to keep with the contract of Set!
@@ -237,9 +251,9 @@ protected boolean add(SimpleFeature feature, boolean fire) {
// }
// TODO check inheritance with FeatureType here!!!
contents.put(ID, feature);
- if (fire) {
- fireChange(feature, CollectionEvent.FEATURES_ADDED);
- }
+// if (fire) {
+// fireChange(feature, CollectionEvent.FEATURES_ADDED);
+// }
return true;
}
@@ -273,24 +287,28 @@ public boolean addAll(Collection collection) {
featuresAdded.add(f);
}
- if (changed) {
- fireChange(featuresAdded, CollectionEvent.FEATURES_ADDED);
- }
+// if (changed) {
+// fireChange(featuresAdded, CollectionEvent.FEATURES_ADDED);
+// }
return changed;
} finally {
- if (collection instanceof FeatureCollection) {
- ((SimpleFeatureCollection) collection).close(iterator);
+ if( iterator instanceof Closeable ){
+ try {
+ ((Closeable)iterator).close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
}
}
@SuppressWarnings("unchecked")
- public boolean addAll(FeatureCollection collection) {
+ public boolean addAll(FeatureCollection<?,?> collection) {
// TODO check inheritance with FeatureType here!!!
boolean changed = false;
- Iterator<?> iterator = collection.iterator();
+ FeatureIterator<?> iterator = collection.features();
try {
List<SimpleFeature> featuresAdded = new ArrayList<SimpleFeature>(collection.size());
while (iterator.hasNext()) {
@@ -302,13 +320,13 @@ public boolean addAll(FeatureCollection collection) {
featuresAdded.add(f);
}
- if (changed) {
- fireChange(featuresAdded, CollectionEvent.FEATURES_ADDED);
- }
+// if (changed) {
+// fireChange(featuresAdded, CollectionEvent.FEATURES_ADDED);
+// }
return changed;
} finally {
- collection.close(iterator);
+ iterator.close();
}
}
@@ -324,7 +342,7 @@ public void clear() {
oldFeatures = (SimpleFeature[]) contents.values().toArray(oldFeatures);
contents.clear();
- fireChange(oldFeatures, CollectionEvent.FEATURES_REMOVED);
+ //fireChange(oldFeatures, CollectionEvent.FEATURES_REMOVED);
}
/**
@@ -368,8 +386,12 @@ public boolean containsAll(Collection collection) {
}
return true;
} finally {
- if (collection instanceof FeatureCollection) {
- ((SimpleFeatureCollection) collection).close(iterator);
+ if (iterator instanceof Closeable ){
+ try {
+ ((Closeable)iterator).close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
}
}
@@ -407,7 +429,7 @@ public SimpleFeature next() {
public void remove() {
iterator.remove();
- fireChange(currFeature, CollectionEvent.FEATURES_REMOVED);
+ bounds = null; // recalc
}
};
}
@@ -419,7 +441,7 @@ public void remove() {
* @return the SimpleFeatureIterator for this collection.
*/
public SimpleFeatureIterator features() {
- return new SimpleFeatureIteratorImpl(this);
+ return new SimpleFeatureIteratorImpl( contents.values() );
}
/**
@@ -442,9 +464,9 @@ public boolean remove(Object o) {
SimpleFeature f = (SimpleFeature) o;
boolean changed = contents.values().remove(f);
- if (changed) {
- fireChange(f, CollectionEvent.FEATURES_REMOVED);
- }
+// if (changed) {
+// fireChange(f, CollectionEvent.FEATURES_REMOVED);
+// }
return changed;
}
@@ -477,14 +499,18 @@ public boolean removeAll(Collection collection) {
}
}
- if (changed) {
- fireChange(removedFeatures, CollectionEvent.FEATURES_REMOVED);
- }
+// if (changed) {
+// fireChange(removedFeatures, CollectionEvent.FEATURES_REMOVED);
+// }
return changed;
} finally {
- if (collection instanceof FeatureCollection) {
- ((SimpleFeatureCollection) collection).close(iterator);
+ if( iterator instanceof Closeable ){
+ try {
+ ((Closeable)iterator).close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
}
}
@@ -516,9 +542,9 @@ public boolean retainAll(Collection collection) {
}
}
- if (modified) {
- fireChange(removedFeatures, CollectionEvent.FEATURES_REMOVED);
- }
+// if (modified) {
+// fireChange(removedFeatures, CollectionEvent.FEATURES_REMOVED);
+// }
return modified;
}
@@ -643,7 +669,7 @@ public int getCount() throws IOException {
}
public SimpleFeatureCollection collection() throws IOException {
- SimpleFeatureCollection copy = new TreeSetFeatureCollection(null, getSchema());
+ TreeSetFeatureCollection copy = new TreeSetFeatureCollection(null, getSchema());
List<SimpleFeature> list = new ArrayList<SimpleFeature>(contents.size());
SimpleFeatureIterator iterator = features();
try {
@@ -735,13 +761,13 @@ public String getID() {
return id;
}
- public final void addListener(CollectionListener listener) throws NullPointerException {
- listeners.add(listener);
- }
-
- public final void removeListener(CollectionListener listener) throws NullPointerException {
- listeners.remove(listener);
- }
+// public final void addListener(CollectionListener listener) throws NullPointerException {
+// listeners.add(listener);
+// }
+//
+// public final void removeListener(CollectionListener listener) throws NullPointerException {
+// listeners.remove(listener);
+// }
public SimpleFeatureType getSchema() {
return schema;
View
1  modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesFeatureCollection.java
@@ -28,7 +28,6 @@
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.geotools.feature.collection.DecoratingFeatureCollection;
-import org.geotools.feature.collection.DelegateFeatureIterator;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.feature.Feature;
import org.opengis.feature.type.FeatureType;
View
10 modules/library/main/src/main/java/org/geotools/data/store/MaxFeaturesIterator.java
@@ -58,14 +58,10 @@ public MaxFeaturesIterator(FeatureIterator<F> delegate, long start, long max) {
counter = 0;
}
- public Iterator<F> getDelegate() {
+ public FeatureIterator<F> getDelegate() {
return delegate;
}
- public void remove() {
- delegate.remove();
- }
-
public boolean hasNext() {
if (counter < start) {
// skip to just before start if needed
@@ -96,4 +92,8 @@ private void skip() {
}
}
+ @Override
+ public void close() {
+ delegate.close();
+ }
}
View
20 modules/library/main/src/main/java/org/geotools/data/store/ReTypingFeatureCollection.java
@@ -17,7 +17,6 @@
package org.geotools.data.store;
import java.io.IOException;
-import java.util.Iterator;
import org.geotools.data.DataUtilities;
import org.geotools.data.FeatureReader;
@@ -26,7 +25,6 @@
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.collection.DecoratingSimpleFeatureCollection;
-import org.geotools.feature.collection.DelegateSimpleFeatureIterator;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -35,10 +33,6 @@
* its schema based on attributes specified in a query.
*
* @author Justin Deoliveira, The Open Planning Project
- *
- *
- *
- *
* @source $URL$
*/
public class ReTypingFeatureCollection extends DecoratingSimpleFeatureCollection {
@@ -62,19 +56,7 @@ public SimpleFeatureType getSchema() {
}
public SimpleFeatureIterator features() {
- return new DelegateSimpleFeatureIterator( this, iterator() );
- }
-
- public void close(SimpleFeatureIterator close) {
- close.close();
- }
-
- public Iterator<SimpleFeature> iterator() {
- return new ReTypingIterator( delegate.iterator(), delegate.getSchema(), featureType );
+ return new ReTypingFeatureIterator( delegate.features(), delegate.getSchema(), featureType );
}
- public void close(Iterator close) {
- ReTypingIterator reType = (ReTypingIterator) close;
- delegate.close( reType.getDelegate() );
- }
}
View
131 modules/library/main/src/main/java/org/geotools/data/store/ReTypingFeatureIterator.java
@@ -0,0 +1,131 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2002-2008, 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.data.store;
+
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.opengis.feature.IllegalAttributeException;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.AttributeDescriptor;
+
+/**
+ * FeatureIterator wrapper which re-types features on the fly based on a target feature type.
+ *
+ * @author Justin Deoliveira, The Open Planning Project
+ * @source $URL$
+ */
+public class ReTypingFeatureIterator implements SimpleFeatureIterator {
+
+ /**
+ * The delegate iterator
+ */
+ SimpleFeatureIterator delegate;
+
+ /**
+ * The target feature type
+ */
+ SimpleFeatureType target;
+
+ /**
+ * The matching types from target
+ */
+ AttributeDescriptor[] types;
+
+ SimpleFeatureBuilder builder;
+
+ public ReTypingFeatureIterator(SimpleFeatureIterator delegate, SimpleFeatureType source,
+ SimpleFeatureType target) {
+ this.delegate = delegate;
+ this.target = target;
+ types = typeAttributes(source, target);
+ this.builder = new SimpleFeatureBuilder(target);
+ }
+
+ public SimpleFeatureIterator getDelegate() {
+ return delegate;
+ }
+
+ public boolean hasNext() {
+ return delegate.hasNext();
+ }
+
+ public SimpleFeature next() {
+ SimpleFeature next = delegate.next();
+ String id = next.getID();
+
+ try {
+ for (int i = 0; i < types.length; i++) {
+ final String xpath = types[i].getLocalName();
+ builder.add(next.getAttribute(xpath));
+ }
+
+ return builder.buildFeature(id);
+ } catch (IllegalAttributeException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Supplies mapping from origional to target FeatureType.
+ *
+ * <p>
+ * Will also ensure that origional can cover target
+ * </p>
+ *
+ * @param target Desired FeatureType
+ * @param origional Origional FeatureType
+ *
+ * @return Mapping from originoal to target FeatureType
+ *
+ * @throws IllegalArgumentException if unable to provide a mapping
+ */
+ protected AttributeDescriptor[] typeAttributes(SimpleFeatureType original,
+ SimpleFeatureType target) {
+ if (target.equals(original)) {
+ throw new IllegalArgumentException(
+ "FeatureReader allready produces contents with the correct schema");
+ }
+
+ if (target.getAttributeCount() > original.getAttributeCount()) {
+ throw new IllegalArgumentException(
+ "Unable to retype FeatureReader<SimpleFeatureType, SimpleFeature> (origional does not cover requested type)");
+ }
+
+ String xpath;
+ AttributeDescriptor[] types = new AttributeDescriptor[target.getAttributeCount()];
+
+ for (int i = 0; i < target.getAttributeCount(); i++) {
+ AttributeDescriptor attrib = target.getDescriptor(i);
+ xpath = attrib.getLocalName();
+ types[i] = attrib;
+
+ if (!attrib.equals(original.getDescriptor(xpath))) {
+ throw new IllegalArgumentException(
+ "Unable to retype FeatureReader<SimpleFeatureType, SimpleFeature> (origional does not cover "
+ + xpath + ")");
+ }
+ }
+
+ return types;
+ }
+
+ @Override
+ public void close() {
+ delegate.close();
+ }
+}
View
14 modules/library/main/src/main/java/org/geotools/data/store/ReTypingIterator.java
@@ -18,8 +18,8 @@
import java.util.Iterator;
-import org.geotools.feature.IllegalAttributeException;
import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.opengis.feature.IllegalAttributeException;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
@@ -32,15 +32,15 @@
*
*
*
- *
+ * @deprecated Please use {@link ReTypingFeatureIterator}
* @source $URL$
*/
-public class ReTypingIterator implements Iterator {
+public class ReTypingIterator implements Iterator<SimpleFeature> {
/**
* The delegate iterator
*/
- Iterator delegate;
+ Iterator<SimpleFeature> delegate;
/**
* The target feature type
@@ -54,14 +54,14 @@
SimpleFeatureBuilder builder;
- public ReTypingIterator( Iterator delegate, SimpleFeatureType source, SimpleFeatureType target ) {
+ public ReTypingIterator( Iterator<SimpleFeature> delegate, SimpleFeatureType source, SimpleFeatureType target ) {
this.delegate = delegate;
this.target = target;
types = typeAttributes( source, target );
this.builder = new SimpleFeatureBuilder(target);
}
- public Iterator getDelegate() {
+ public Iterator<SimpleFeature> getDelegate() {
return delegate;
}
@@ -73,7 +73,7 @@ public boolean hasNext() {
return delegate.hasNext();
}
- public Object next() {
+ public SimpleFeature next() {
SimpleFeature next = (SimpleFeature) delegate.next();
String id = next.getID();
View
32 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingFeatureCollection.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.geotools.data.DataUtilities;
@@ -28,13 +27,9 @@
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureIterator;
import org.geotools.feature.FeatureTypes;
import org.geotools.feature.SchemaException;
-import org.geotools.feature.collection.DecoratingFeatureCollection;
import org.geotools.feature.collection.DecoratingSimpleFeatureCollection;
-import org.geotools.feature.collection.DelegateFeatureIterator;
-import org.geotools.feature.collection.DelegateSimpleFeatureIterator;
import org.geotools.filter.spatial.DefaultCRSFilterVisitor;
import org.geotools.filter.spatial.ReprojectingFilterVisitor;
import org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer;
@@ -147,26 +142,13 @@ private SimpleFeatureType reType(SimpleFeatureType type,
}
public SimpleFeatureIterator features() {
- return new DelegateSimpleFeatureIterator(this, iterator());
- }
-
- public void close(SimpleFeatureIterator close) {
- close.close();
- }
-
- public Iterator<SimpleFeature> iterator() {
try {
- return new ReprojectingIterator(delegate.iterator(), transform, schema, transformer);
+ return new ReprojectingFeatureIterator(features(), transform, schema, transformer);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
- public void close(Iterator close) {
- Iterator iterator = ((ReprojectingIterator) close).getDelegate();
- delegate.close(iterator);
- }
-
public SimpleFeatureType getSchema() {
return this.schema;
}
@@ -196,17 +178,17 @@ public SimpleFeatureCollection sort(SortBy order) {
return toArray(new Object[size()]);
}
- public Object[] toArray(Object[] a) {
- List list = new ArrayList();
- Iterator i = iterator();
+ @SuppressWarnings("unchecked")
+ public <T> T[] toArray(T[] a) {
+ List<T> list = new ArrayList<T>();
+ SimpleFeatureIterator i = features();
try {
while (i.hasNext()) {
- list.add(i.next());
+ list.add((T) i.next());
}
-
return list.toArray(a);
} finally {
- close(i);
+ i.close();
}
}
View
141 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingFeatureIterator.java
@@ -0,0 +1,141 @@
+/*
+ * GeoTools - The Open Source Java GIS Toolkit
+ * http://geotools.org
+ *
+ * (C) 2002-2008, 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.data.store;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.geotools.data.simple.SimpleFeatureIterator;
+import org.geotools.factory.FactoryRegistryException;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer;
+import org.geotools.referencing.ReferencingFactoryFinder;
+import org.opengis.feature.IllegalAttributeException;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.referencing.FactoryException;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransform2D;
+import org.opengis.referencing.operation.OperationNotFoundException;
+import org.opengis.referencing.operation.TransformException;
+
+import com.vividsolutions.jts.geom.Geometry;
+
+/**
+ *
+ *
+ * @source $URL$
+ */
+public class ReprojectingFeatureIterator implements SimpleFeatureIterator {
+
+ /**
+ * decorated iterator
+ */
+ SimpleFeatureIterator delegate;
+
+ /**
+ * The target coordinate reference system
+ */
+ CoordinateReferenceSystem target;
+
+ /**
+ * schema of reprojected features
+ */
+ SimpleFeatureType schema;
+
+ /**
+ * Transformer
+ */
+ GeometryCoordinateSequenceTransformer tx;
+
+ public ReprojectingFeatureIterator(
+ SimpleFeatureIterator delegate, MathTransform transform, SimpleFeatureType schema,
+ GeometryCoordinateSequenceTransformer transformer
+ ) throws OperationNotFoundException, FactoryRegistryException, FactoryException {
+ this.delegate = delegate;
+
+ this.schema = schema;
+
+ tx = transformer;
+ tx.setMathTransform((MathTransform2D) transform);
+ }
+
+ public ReprojectingFeatureIterator(
+ SimpleFeatureIterator delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target,
+ SimpleFeatureType schema, GeometryCoordinateSequenceTransformer transformer
+ ) throws OperationNotFoundException, FactoryRegistryException, FactoryException {
+ this.delegate = delegate;
+ this.target = target;
+ this.schema = schema;
+ tx = transformer;
+
+ MathTransform transform = ReferencingFactoryFinder.getCoordinateOperationFactory(
+ null).createOperation(source, target).getMathTransform();
+ tx.setMathTransform(transform);
+ }
+
+ public SimpleFeatureIterator getDelegate() {
+ return delegate;
+ }
+
+ public boolean hasNext() {
+ return delegate.hasNext();
+ }
+
+ public SimpleFeature next() {
+ SimpleFeature feature = (SimpleFeature) delegate.next();
+ try {
+ return reproject(feature);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ SimpleFeature reproject(SimpleFeature feature) throws IOException {
+
+ List<Object> attributes = feature.getAttributes();
+
+ for (int i = 0; i < attributes.size(); i++) {
+ Object object = attributes.get(i);
+ if (object instanceof Geometry) {
+ // do the transformation
+ Geometry geometry = (Geometry) object;
+ try {
+ attributes.set(i, tx.transform(geometry));
+ } catch (TransformException e) {
+ String msg = "Error occured transforming "
+ + geometry.toString();
+ throw (IOException) new IOException(msg).initCause(e);
+ }
+ }
+ }
+
+ try {
+ return SimpleFeatureBuilder.build(schema, attributes, feature.getID());
+ } catch (IllegalAttributeException e) {
+ String msg = "Error creating reprojeced feature";
+ throw (IOException) new IOException(msg).initCause(e);
+ }
+ }
+
+ @Override
+ public void close() {
+ delegate.close();
+ }
+
+}
View
17 modules/library/main/src/main/java/org/geotools/data/store/ReprojectingIterator.java
@@ -21,10 +21,10 @@
import java.util.List;
import org.geotools.factory.FactoryRegistryException;
-import org.geotools.feature.IllegalAttributeException;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.geometry.jts.GeometryCoordinateSequenceTransformer;
import org.geotools.referencing.ReferencingFactoryFinder;
+import org.opengis.feature.IllegalAttributeException;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.FactoryException;
@@ -41,12 +41,12 @@
*
* @source $URL$
*/
-public class ReprojectingIterator implements Iterator {
+public class ReprojectingIterator implements Iterator<SimpleFeature> {
/**
* decorated iterator
*/
- Iterator delegate;
+ Iterator<SimpleFeature> delegate;
/**
* The target coordinate reference system
@@ -64,11 +64,10 @@
GeometryCoordinateSequenceTransformer tx;
public ReprojectingIterator(
- Iterator delegate, MathTransform transform, SimpleFeatureType schema,
+ Iterator<SimpleFeature> delegate, MathTransform transform, SimpleFeatureType schema,
GeometryCoordinateSequenceTransformer transformer
) throws OperationNotFoundException, FactoryRegistryException, FactoryException {
this.delegate = delegate;
-
this.schema = schema;
tx = transformer;
@@ -76,7 +75,7 @@ public ReprojectingIterator(
}
public ReprojectingIterator(
- Iterator delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target,
+ Iterator<SimpleFeature> delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target,
SimpleFeatureType schema, GeometryCoordinateSequenceTransformer transformer
) throws OperationNotFoundException, FactoryRegistryException, FactoryException {
this.delegate = delegate;
@@ -89,7 +88,7 @@ public ReprojectingIterator(
tx.setMathTransform(transform);
}
- public Iterator getDelegate() {
+ public Iterator<SimpleFeature> getDelegate() {
return delegate;
}
@@ -101,7 +100,7 @@ public boolean hasNext() {
return delegate.hasNext();
}
- public Object next() {
+ public SimpleFeature next() {
SimpleFeature feature = (SimpleFeature) delegate.next();
try {
return reproject(feature);
@@ -112,7 +111,7 @@ public Object next() {
SimpleFeature reproject(SimpleFeature feature) throws IOException {
- List attributes = feature.getAttributes();
+ List<Object> attributes = feature.getAttributes();
for (int i = 0; i < attributes.size(); i++) {
Object object = attributes.get(i);
View
56 modules/library/main/src/main/java/org/geotools/feature/DefaultFeatureCollection.java
@@ -81,30 +81,38 @@
//private String id; /// fid
/**
- * This constructor should not be used by client code.
+ * Default implementation of Feature collection.
+ * <p>
+ * feature type determined by the first feature added.
+ */
+ public DefaultFeatureCollection() {
+ this( null, null );
+ }
+
+ /**
+ * Used to stage content in memory.
+ * <p>
+ * Client code is encouraged to use DataUtilities.collection( collection )
* @param collection SimpleFeatureCollection to copy into memory
*/
public DefaultFeatureCollection( FeatureCollection<SimpleFeatureType,SimpleFeature> collection ) {
this( collection.getID(), collection.getSchema() );
addAll(collection);
}
-
+
/**
- * Default implementation of Feature collection.
+ * Used to create a feature collection to stage content in memory.
* <p>
- * feature type determined by the first feature added.
+ * The feature type will be determined by the first feature added.
+ *
+ * @param id may be null ... feature id
*/
- public DefaultFeatureCollection() {
- this( null, null );
+ public DefaultFeatureCollection(String id) {
+ this( id, null );
}
+
/**
- * This constructor should not be used by client code.
- * <p>
- * Opportunistic reuse is encouraged, but only for the purposes
- * of testing or other specialized uses. Normal creation should
- * occur through <code>org.geotools.core.FeatureCollections.newCollection()</code>
- * allowing applications to customize any generated collections.
- * </p>
+ * Used to create a feature collection to stage content in memory.
*
* @param id may be null ... feature id
* @param featureType optional, may be null
@@ -320,7 +328,25 @@ public boolean isEmpty() {
* @return an <tt>Iterator</tt> over the elements in this collection
*/
public Iterator<SimpleFeature> iterator() {
- return contents.values().iterator();
+ //return contents.values().iterator();
+ final Iterator<SimpleFeature> iterator = contents.values().iterator();
+ return new Iterator<SimpleFeature>() {
+ SimpleFeature currFeature = null;
+
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ public SimpleFeature next() {
+ currFeature = (SimpleFeature) iterator.next();
+ return currFeature;
+ }
+
+ public void remove() {
+ iterator.remove();
+ bounds = null; // recalc
+ }
+ };
}
/**
@@ -330,7 +356,7 @@ public boolean isEmpty() {
* @return the SimpleFeatureIterator for this collection.
*/
public SimpleFeatureIterator features() {
- return new SimpleFeatureIteratorImpl(this);
+ return new SimpleFeatureIteratorImpl( contents.values() );
}
/**
View
74 modules/library/main/src/main/java/org/geotools/feature/collection/DecoratingSimpleFeatureCollection.java
@@ -17,14 +17,11 @@
package org.geotools.feature.collection;
import java.util.Collection;
-import java.util.Iterator;
import org.geotools.data.DataUtilities;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
-import org.geotools.feature.CollectionListener;
import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureIterator;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -32,7 +29,7 @@
import org.opengis.filter.sort.SortBy;
/**
- * A FeatureCollection which completley delegates to another FeatureCollection.
+ * A FeatureCollection which completely delegates to another FeatureCollection.
* <p>
* This class should be subclasses by classes which must somehow decorate
* another SimpleFeatureCollection and override the relevant methods.
@@ -40,9 +37,6 @@
* @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
* @since 2.5
*
- *
- *
- *
* @source $URL$
*/
public class DecoratingSimpleFeatureCollection implements SimpleFeatureCollection {
@@ -83,44 +77,16 @@ public void accepts(org.opengis.feature.FeatureVisitor visitor,
}
}
} finally {
- close(it);
+ it.close();
}
}
- public boolean add(SimpleFeature o) {
- return delegate.add(o);
- }
-
- public boolean addAll(Collection c) {
- return delegate.addAll(c);
- }
-
- public boolean addAll(FeatureCollection c) {
- return delegate.addAll(c);
- }
-
- public void addListener(CollectionListener listener)
- throws NullPointerException {
- delegate.addListener(listener);
- }
-
- public void clear() {
- delegate.clear();
- }
-
- public void close(FeatureIterator<SimpleFeature> close) {
- delegate.close(close);
- }
-
- public void close(Iterator<SimpleFeature> close) {
- delegate.close(close);
- }
public boolean contains(Object o) {
return delegate.contains(o);
}
- public boolean containsAll(Collection c) {
+ public boolean containsAll(Collection<?> c) {
return delegate.containsAll(c);
}
@@ -148,31 +114,6 @@ public boolean isEmpty() {
return delegate.isEmpty();
}
- public Iterator iterator() {
- return delegate.iterator();
- }
-
- public void purge() {
- delegate.purge();
- }
-
- public boolean remove(Object o) {
- return delegate.remove(o);
- }
-
- public boolean removeAll(Collection c) {
- return delegate.removeAll(c);
- }
-
- public void removeListener(CollectionListener listener)
- throws NullPointerException {
- delegate.removeListener(listener);
- }
-
- public boolean retainAll(Collection c) {
- return delegate.retainAll(c);
- }
-
public int size() {
return delegate.size();
}
@@ -189,10 +130,11 @@ public SimpleFeatureCollection subCollection(Filter filter) {
return delegate.toArray();
}
- public Object[] toArray(Object[] a) {
+ public <F> F[] toArray(F[] a) {
return delegate.toArray(a);
}
- public String getID() {
- return delegate.getID();
- }
+
+ public String getID() {
+ return delegate.getID();
+ }
}
View
23 modules/library/main/src/main/java/org/geotools/feature/collection/DelegateFeatureIterator.java
@@ -16,8 +16,12 @@
*/
package org.geotools.feature.collection;
+import java.io.Closeable;
+import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
@@ -29,9 +33,9 @@
* Iterator, simply allowing Java 1.4 code to escape the caste (sic)
* system.
* <p>
- * This implementation is not suitable for use with collections
- * that make use of system resources. As an alterantive please
- * see ResourceFetaureIterator.
+ * This implementation checks the iterator to see if it implements
+ * {@link Closeable} in order to allow for collections that
+ * make use of system resources.
* </p>
* @author Jody Garnett, Refractions Research, Inc.
*
@@ -66,9 +70,14 @@ public F next() throws NoSuchElementException {
return delegate.next();
}
public void close() {
- if( delegate!=null && delegate instanceof FeatureIterator ){
- ((FeatureIterator<?>)delegate).close();
- }
- delegate = null;
+ if( delegate instanceof Closeable){
+ try {
+ ((Closeable)delegate).close();
+ } catch (IOException e) {
+ Logger log = Logger.getLogger(delegate.getClass().getPackage().toString() );
+ log.log(Level.FINER, e.getMessage(), e);
+ }
+ }
+ delegate = null;
}
}
View
34 modules/library/main/src/main/java/org/geotools/feature/collection/FeatureIteratorImpl.java
@@ -16,33 +16,40 @@
*/
package org.geotools.feature.collection;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.opengis.feature.Feature;
import org.opengis.feature.type.FeatureType;
/**
- * A convenience class for dealing with FeatureCollection Iterators
+ * A convenience class for dealing with wrapping a Collection Iterator up
+ * as a FeatureIterator.
* <p>
* Note this does not implement Iterator (FeatureIterator is a separate class).
- *
+ * <p>
+ * This class will check to see if the provided Iterator implements {@link Closeable}.
* @author Ian Schneider
*
- *
* @source $URL$
*/
public class FeatureIteratorImpl<F extends Feature> implements FeatureIterator<F> {
- /** The iterator from the SimpleFeatureCollecti