org.geotools.data.crs
Class ReprojectFeatureReader

Object
  extended by ReprojectFeatureReader
All Implemented Interfaces:
DelegatingFeatureReader<SimpleFeatureType,SimpleFeature>, FeatureReader<SimpleFeatureType,SimpleFeature>

public class ReprojectFeatureReader
extends Object
implements DelegatingFeatureReader<SimpleFeatureType,SimpleFeature>

ReprojectFeatureReader provides a reprojection for FeatureTypes.

ReprojectFeatureReader is a wrapper used to reproject GeometryAttributes to a user supplied CoordinateReferenceSystem from the original CoordinateReferenceSystem supplied by the original FeatureReader.

Example Use:


 ReprojectFeatureReader reader =
     new ReprojectFeatureReader( originalReader, reprojectCS );
 
 CoordinateReferenceSystem originalCS =
     originalReader.getFeatureType().getDefaultGeometry().getCoordinateSystem();
 
 CoordinateReferenceSystem newCS =
     reader.getFeatureType().getDefaultGeometry().getCoordinateSystem();
 
 assertEquals( reprojectCS, newCS );
 

TODO: handle the case where there is more than one geometry and the other geometries have a different CS than the default geometry

Author:
jgarnett, Refractions Research, Inc., aaime, $Author: jive $ (last modification)
Module:
modules/library/main (gt-main.jar)

Constructor Summary
ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader, CoordinateReferenceSystem cs)
           
ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader, SimpleFeatureType schema, MathTransform transform)
           
 
Method Summary
 void close()
          Implement close.
 FeatureReader<SimpleFeatureType,SimpleFeature> getDelegate()
           
 SimpleFeatureType getFeatureType()
          Implement getFeatureType.
 boolean hasNext()
          Implement hasNext.
 SimpleFeature next()
          Implement next.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReprojectFeatureReader

public ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader,
                              SimpleFeatureType schema,
                              MathTransform transform)

ReprojectFeatureReader

public ReprojectFeatureReader(FeatureReader<SimpleFeatureType,SimpleFeature> reader,
                              CoordinateReferenceSystem cs)
                       throws SchemaException,
                              OperationNotFoundException,
                              NoSuchElementException,
                              FactoryException
Throws:
SchemaException
OperationNotFoundException
NoSuchElementException
FactoryException
Method Detail

getDelegate

public FeatureReader<SimpleFeatureType,SimpleFeature> getDelegate()
Specified by:
getDelegate in interface DelegatingFeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
The delegate feature reader.

getFeatureType

public SimpleFeatureType getFeatureType()
Implement getFeatureType.

Description ...

Specified by:
getFeatureType in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
the FeatureType of the Features this FeatureReader will create.
Throws:
IllegalStateException - DOCUMENT ME!
See Also:
FeatureReader.getFeatureType()

next

public SimpleFeature next()
                   throws IOException,
                          IllegalAttributeException,
                          NoSuchElementException
Implement next.

Description ...

Specified by:
next in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
The next feature in the reader.
Throws:
IOException
IllegalAttributeException
NoSuchElementException
IllegalStateException - DOCUMENT ME!
DataSourceException - DOCUMENT ME!
IllegalAttributeException - If the attributes read do not comply with the FeatureType.
See Also:
FeatureReader.next()

hasNext

public boolean hasNext()
                throws IOException
Implement hasNext.

Description ...

Specified by:
hasNext in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
IOException
IllegalStateException - DOCUMENT ME!
See Also:
FeatureReader.hasNext()

close

public void close()
           throws IOException
Implement close.

Description ...

Specified by:
close in interface FeatureReader<SimpleFeatureType,SimpleFeature>
Throws:
IOException
IllegalStateException - DOCUMENT ME!
See Also:
FeatureReader.close()


Copyright © 1996-2009 Geotools. All Rights Reserved.