org.geotools.data.crs
Class ForceCoordinateSystemFeatureResults

Object
  extended by AbstractFeatureCollection
      extended by ForceCoordinateSystemFeatureResults
All Implemented Interfaces:
FeatureCollection<SimpleFeatureType,SimpleFeature>

public class ForceCoordinateSystemFeatureResults
extends AbstractFeatureCollection

ForceCoordinateSystemFeatureResults provides a CoordinateReferenceSystem for FeatureTypes.

ForceCoordinateSystemFeatureReader is a wrapper used to force GeometryAttributes to a user supplied CoordinateReferenceSystem rather then the default supplied by the DataStore.

Example Use:


 ForceCoordinateSystemFeatureResults results =
     new ForceCoordinateSystemFeatureResults( originalResults, forceCS );
 
 CoordinateReferenceSystem originalCS =
     originalResults.getFeatureType().getDefaultGeometry().getCoordinateSystem();
 
 CoordinateReferenceSystem newCS =
     reader.getFeatureType().getDefaultGeometry().getCoordinateSystem();
 
 assertEquals( forceCS, newCS );
 

Author:
aaime
Module:
modules/library/main (gt-main.jar)

Field Summary
 
Fields inherited from class AbstractFeatureCollection
id, listeners, open, schema
 
Constructor Summary
ForceCoordinateSystemFeatureResults(FeatureCollection<SimpleFeatureType,SimpleFeature> results, CoordinateReferenceSystem forcedCS)
           
ForceCoordinateSystemFeatureResults(FeatureCollection<SimpleFeatureType,SimpleFeature> results, CoordinateReferenceSystem forcedCS, boolean forceOnlyMissing)
           
 
Method Summary
 void closeIterator(Iterator close)
          Please override to cleanup after your own iterators, and any used resources.
 ReferencedEnvelope getBounds()
          Subclasses need to override this.
 FeatureCollection<SimpleFeatureType,SimpleFeature> getOrigin()
          Returns the feature results wrapped by this ForceCoordinateSystemFeatureResults
 Iterator openIterator()
          Open a resource based Iterator, we will call close( iterator ).
 int size()
          Returns the number of elements in this collection.
 
Methods inherited from class AbstractFeatureCollection
accepts, accepts, add, addAll, addAll, addListener, clear, close, close, contains, containsAll, features, getID, getOpenIterators, getSchema, isEmpty, iterator, purge, remove, removeAll, removeListener, retainAll, sort, subCollection, subList, toArray, toArray
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForceCoordinateSystemFeatureResults

public ForceCoordinateSystemFeatureResults(FeatureCollection<SimpleFeatureType,SimpleFeature> results,
                                           CoordinateReferenceSystem forcedCS)
                                    throws IOException,
                                           SchemaException
Throws:
IOException
SchemaException

ForceCoordinateSystemFeatureResults

public ForceCoordinateSystemFeatureResults(FeatureCollection<SimpleFeatureType,SimpleFeature> results,
                                           CoordinateReferenceSystem forcedCS,
                                           boolean forceOnlyMissing)
                                    throws IOException,
                                           SchemaException
Throws:
IOException
SchemaException
Method Detail

openIterator

public Iterator openIterator()
Description copied from class: AbstractFeatureCollection
Open a resource based Iterator, we will call close( iterator ).

Please subclass to provide your own iterator for the the ResourceCollection, note iterator() is implemented to call open() and track the results in for later purge().

Specified by:
openIterator in class AbstractFeatureCollection
Returns:
Iterator based on resource use

closeIterator

public void closeIterator(Iterator close)
Description copied from class: AbstractFeatureCollection
Please override to cleanup after your own iterators, and any used resources.

As an example if the iterator was working off a File then the inputstream should be closed.

Subclass must call super.close( close ) to allow the list of open iterators to be adjusted.

Specified by:
closeIterator in class AbstractFeatureCollection
Parameters:
close - Iterator, will not be null

size

public int size()
Description copied from class: AbstractFeatureCollection
Returns the number of elements in this collection.

Specified by:
size in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Specified by:
size in class AbstractFeatureCollection
Returns:
Number of items, or Interger.MAX_VALUE
See Also:
Collection.size()

getBounds

public ReferencedEnvelope getBounds()
Description copied from class: AbstractFeatureCollection
Subclasses need to override this.

Specified by:
getBounds in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
getBounds in class AbstractFeatureCollection
Returns:
An Envelope containing the total bounds of this collection.
See Also:
org.geotools.data.FeatureResults#getBounds()

getOrigin

public FeatureCollection<SimpleFeatureType,SimpleFeature> getOrigin()
Returns the feature results wrapped by this ForceCoordinateSystemFeatureResults



Copyright © 1996-2009 Geotools. All Rights Reserved.