org.geotools.data.store
Class ReprojectingFeatureCollection

Object
  extended by DecoratingSimpleFeatureCollection
      extended by ReprojectingFeatureCollection
All Implemented Interfaces:
SimpleFeatureCollection, FeatureCollection<SimpleFeatureType,SimpleFeature>

public class ReprojectingFeatureCollection
extends DecoratingSimpleFeatureCollection

SimpleFeatureCollection decorator that reprojects the default geometry.

Author:
Justin

Field Summary
 
Fields inherited from class DecoratingSimpleFeatureCollection
delegate
 
Constructor Summary
ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate, CoordinateReferenceSystem target)
           
ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target)
           
ReprojectingFeatureCollection(SimpleFeatureCollection delegate, CoordinateReferenceSystem target)
           
ReprojectingFeatureCollection(SimpleFeatureCollection delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target)
           
 
Method Summary
 boolean add(SimpleFeature o)
           
protected  boolean canDelegate(FeatureVisitor visitor)
          Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.
 SimpleFeatureIterator features()
          Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.
 ReferencedEnvelope getBounds()
          This method computes reprojected bounds the hard way, but computing them feature by feature.
 SimpleFeatureType getSchema()
          The schema for the child feature members of this collection.
 FeatureReader<SimpleFeatureType,SimpleFeature> reader()
           
 void setTransformer(GeometryCoordinateSequenceTransformer transformer)
           
 SimpleFeatureCollection sort(SortBy order)
          Obtained sorted contents.
 SimpleFeatureCollection subCollection(Filter filter)
          SimpleFeatureCollection "view" indicated by provided filter.
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class DecoratingSimpleFeatureCollection
accepts, contains, containsAll, equals, getID, hashCode, isEmpty, size
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReprojectingFeatureCollection

public ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate,
                                     CoordinateReferenceSystem target)

ReprojectingFeatureCollection

public ReprojectingFeatureCollection(SimpleFeatureCollection delegate,
                                     CoordinateReferenceSystem target)

ReprojectingFeatureCollection

public ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate,
                                     CoordinateReferenceSystem source,
                                     CoordinateReferenceSystem target)

ReprojectingFeatureCollection

public ReprojectingFeatureCollection(SimpleFeatureCollection delegate,
                                     CoordinateReferenceSystem source,
                                     CoordinateReferenceSystem target)
Method Detail

setTransformer

public void setTransformer(GeometryCoordinateSequenceTransformer transformer)

reader

public FeatureReader<SimpleFeatureType,SimpleFeature> reader()
                                                      throws IOException
Throws:
IOException

features

public SimpleFeatureIterator features()
Description copied from interface: SimpleFeatureCollection
Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.

The implementation of FeatureIterator must adhere to the rules of fail-fast concurrent modification. In addition (to allow for resource backed collections) the SimpleFeatureIterator.close() method must be called.

Example use:


 SimpleFeatureIterator iterator=collection.features();
 try {
     while( iterator.hasNext()  ){
          SimpleFeature feature = iterator.next();
          System.out.println( feature.getID() );
     }
 }
 finally {
     iterator.close();
 }
 

Specified by:
features in interface SimpleFeatureCollection
Specified by:
features in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
features in class DecoratingSimpleFeatureCollection
Returns:
A FeatureIterator.

getSchema

public SimpleFeatureType getSchema()
Description copied from interface: FeatureCollection
The schema for the child feature members of this collection.

Represents the most general FeatureType in common to all the features in this collection.

Specified by:
getSchema in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
getSchema in class DecoratingSimpleFeatureCollection
Returns:
FeatureType describing the "common" schema to all child features of this collection

subCollection

public SimpleFeatureCollection subCollection(Filter filter)
Description copied from interface: FeatureCollection
SimpleFeatureCollection "view" indicated by provided filter.

The contents of the returned SimpleFeatureCollection are determined by applying the provider Filter to the entire contents of this FeatureCollection. The result is "live" and modifications will be shared.

This method is used cut down on the number of filter based methods required for a useful SimpleFeatureCollection construct. The FeatureCollections returned really should be considered as a temporary "view" used to control the range of a removeAll, or modify operation.

Example Use:


 collection.subCollection( filter ).clear();
 
The above recommended use is agreement with the Collections API precident of List.subList( start, end ).

The results of subCollection:

Specified by:
subCollection in interface SimpleFeatureCollection
Specified by:
subCollection in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
subCollection in class DecoratingSimpleFeatureCollection
Returns:
SimpleFeatureCollection identified as subset.
See Also:
FeatureList

sort

public SimpleFeatureCollection sort(SortBy order)
Description copied from interface: FeatureCollection
Obtained sorted contents.

This method may not be supported by all implementations, consider the use of FeatureSource.features( Query ).

Specified by:
sort in interface SimpleFeatureCollection
Specified by:
sort in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
sort in class DecoratingSimpleFeatureCollection
Parameters:
order - Sort order
Returns:
FeatureCollection sorted in the indicated order

toArray

public Object[] toArray()
Specified by:
toArray in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
toArray in class DecoratingSimpleFeatureCollection
See Also:
Collection.toArray()

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
toArray in class DecoratingSimpleFeatureCollection
See Also:
Collection.toArray(Object[])

add

public boolean add(SimpleFeature o)

getBounds

public ReferencedEnvelope getBounds()
This method computes reprojected bounds the hard way, but computing them feature by feature. This method could be faster if computed the reprojected bounds by reprojecting the original feature bounds a Shape object, thus getting the true shape of the reprojected envelope, and then computing the minimum and maximum coordinates of that new shape. The result would not a true representation of the new bounds.

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

canDelegate

protected boolean canDelegate(FeatureVisitor visitor)
Description copied from class: DecoratingSimpleFeatureCollection
Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.

The default is false and the visitor receives the decoraeted features.

Overrides:
canDelegate in class DecoratingSimpleFeatureCollection


Copyright © 1996-2014 Geotools. All Rights Reserved.