org.geotools.data.crs
Class ReprojectFeatureReader

java.lang.Object
  extended by org.geotools.data.crs.ReprojectFeatureReader
All Implemented Interfaces:
DelegatingFeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

public class ReprojectFeatureReader
extends java.lang.Object
implements DelegatingFeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.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

Version:
$Id: ReprojectFeatureReader.java 31406 2008-09-05 02:11:38Z jdeolive $
Author:
jgarnett, Refractions Research, Inc., aaime, $Author: jive $ (last modification)

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

Constructor Detail

ReprojectFeatureReader

public ReprojectFeatureReader(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader,
                              org.opengis.feature.simple.SimpleFeatureType schema,
                              org.opengis.referencing.operation.MathTransform transform)

ReprojectFeatureReader

public ReprojectFeatureReader(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader,
                              org.opengis.referencing.crs.CoordinateReferenceSystem cs)
                       throws SchemaException,
                              org.opengis.referencing.operation.OperationNotFoundException,
                              java.util.NoSuchElementException,
                              org.opengis.referencing.FactoryException
Throws:
SchemaException
org.opengis.referencing.operation.OperationNotFoundException
java.util.NoSuchElementException
org.opengis.referencing.FactoryException
Method Detail

getDelegate

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

getFeatureType

public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
Implement getFeatureType.

Description ...

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

next

public org.opengis.feature.simple.SimpleFeature next()
                                              throws java.io.IOException,
                                                     IllegalAttributeException,
                                                     java.util.NoSuchElementException
Implement next.

Description ...

Specified by:
next in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
The next feature in the reader.
Throws:
java.io.IOException
IllegalAttributeException
java.util.NoSuchElementException
java.lang.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 java.io.IOException
Implement hasNext.

Description ...

Specified by:
hasNext in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.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:
java.io.IOException
java.lang.IllegalStateException - DOCUMENT ME!
See Also:
FeatureReader.hasNext()

close

public void close()
           throws java.io.IOException
Implement close.

Description ...

Specified by:
close in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Throws:
java.io.IOException
java.lang.IllegalStateException - DOCUMENT ME!
See Also:
FeatureReader.close()


Copyright © 1996-2010 Geotools. All Rights Reserved.