Class ReprojectingFeatureCollection
- Object
-
- DecoratingSimpleFeatureCollection
-
- ReprojectingFeatureCollection
-
- All Implemented Interfaces:
SimpleFeatureCollection,FeatureCollection<SimpleFeatureType,SimpleFeature>
public class ReprojectingFeatureCollection extends DecoratingSimpleFeatureCollection
SimpleFeatureCollection decorator that reprojects all geometries of the features within the feature collection.- Author:
- Justin
-
-
Field Summary
-
Fields inherited from class DecoratingSimpleFeatureCollection
delegate
-
-
Constructor Summary
Constructors Constructor Description ReprojectingFeatureCollection(SimpleFeatureCollection delegate, CoordinateReferenceSystem target)ReprojectingFeatureCollection(SimpleFeatureCollection delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target)ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate, CoordinateReferenceSystem target)ReprojectingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate, CoordinateReferenceSystem source, CoordinateReferenceSystem target)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(SimpleFeature o)protected booleancanDelegate(FeatureVisitor visitor)Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.SimpleFeatureIteratorfeatures()Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.ReferencedEnvelopegetBounds()This method computes reprojected bounds the hard way, but computing them feature by feature.SimpleFeatureTypegetSchema()The schema for the child feature members of this collection.static booleanisGeometryless(FeatureVisitor visitor, SimpleFeatureType schema)Returns true if the visitor is geometryless, that is, it's not accessing a geometry field in the target schemaFeatureReader<SimpleFeatureType,SimpleFeature>reader()voidsetTransformer(GeometryCoordinateSequenceTransformer transformer)SimpleFeatureCollectionsort(SortBy order)Obtained sorted contents.SimpleFeatureCollectionsubCollection(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
-
-
-
-
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:SimpleFeatureCollectionObtain 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:
featuresin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Specified by:
featuresin interfaceSimpleFeatureCollection- Overrides:
featuresin classDecoratingSimpleFeatureCollection- Returns:
- A FeatureIterator.
-
getSchema
public SimpleFeatureType getSchema()
Description copied from interface:FeatureCollectionThe schema for the child feature members of this collection.Represents the most general FeatureType in common to all the features in this collection.
- For a collection backed by a shapefiles (or database tables) the FeatureType returned by getSchema() will complete describe each and every child in the collection.
- For mixed content FeatureCollections you will need to check the FeatureType of each Feature as it is retrived from the collection
- The degenerate case returns the "_Feature" FeatureType, where the only thing known is that the contents are Features.
- Specified by:
getSchemain interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Overrides:
getSchemain classDecoratingSimpleFeatureCollection- Returns:
- FeatureType describing the "common" schema to all child features of this collection
-
subCollection
public SimpleFeatureCollection subCollection(Filter filter)
Description copied from interface:FeatureCollectionSimpleFeatureCollection "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:
The above recommended use is agreement with the Collections API precident of List.subList( start, end ).collection.subCollection( filter ).clear();The results of subCollection:
- are to be considered unordered
- may be an ordered FeatureList if requested when sortBy is indicated
- Specified by:
subCollectionin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Specified by:
subCollectionin interfaceSimpleFeatureCollection- Overrides:
subCollectionin classDecoratingSimpleFeatureCollection- Returns:
- SimpleFeatureCollection identified as subset.
- See Also:
FeatureList
-
sort
public SimpleFeatureCollection sort(SortBy order)
Description copied from interface:FeatureCollectionObtained sorted contents.This method may not be supported by all implementations, consider the use of FeatureSource.features( Query ).
- Specified by:
sortin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Specified by:
sortin interfaceSimpleFeatureCollection- Overrides:
sortin classDecoratingSimpleFeatureCollection- Parameters:
order- Sort order- Returns:
- FeatureCollection sorted in the indicated order
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Overrides:
toArrayin classDecoratingSimpleFeatureCollection- See Also:
Collection.toArray()
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Overrides:
toArrayin classDecoratingSimpleFeatureCollection- 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:
getBoundsin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature>- Overrides:
getBoundsin classDecoratingSimpleFeatureCollection- 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:DecoratingSimpleFeatureCollectionMethods 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:
canDelegatein classDecoratingSimpleFeatureCollection
-
isGeometryless
public static boolean isGeometryless(FeatureVisitor visitor, SimpleFeatureType schema)
Returns true if the visitor is geometryless, that is, it's not accessing a geometry field in the target schema
-
-