Class ReprojectingFeatureCollection
- All Implemented Interfaces:
SimpleFeatureCollection,FeatureCollection<SimpleFeatureType,SimpleFeature>
- Author:
- Justin
-
Field Summary
Fields inherited from class DecoratingSimpleFeatureCollection
delegate -
Constructor Summary
ConstructorsConstructorDescriptionReprojectingFeatureCollection(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
Modifier and TypeMethodDescriptionbooleanadd(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.features()Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.This method computes reprojected bounds the hard way, but computing them feature by feature.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 schemareader()voidsetTransformer(GeometryCoordinateSequenceTransformer transformer) Obtained sorted contents.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
-
Constructor Details
-
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 Details
-
setTransformer
-
reader
- Throws:
IOException
-
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
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
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
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
- Specified by:
toArrayin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature> - Overrides:
toArrayin classDecoratingSimpleFeatureCollection- See Also:
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceFeatureCollection<SimpleFeatureType,SimpleFeature> - Overrides:
toArrayin classDecoratingSimpleFeatureCollection- See Also:
-
add
-
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
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
Returns true if the visitor is geometryless, that is, it's not accessing a geometry field in the target schema
-