public abstract class BaseFeatureCollection<T extends FeatureType,F extends Feature> extends Object implements FeatureCollection<T,F>
FeatureIterator.
This implementation asks you to implement:
features()AbstractFeatureCollection
and represents the easiest way to package your content as a FeatureCollection.
As this class provides no optimization, it is strongly recommended that you implement the following methods (which require a whole collection traversal):
size()| Modifier and Type | Field and Description |
|---|---|
protected String |
id
id used when serialized to gml
|
protected T |
schema |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseFeatureCollection() |
protected |
BaseFeatureCollection(T schema) |
protected |
BaseFeatureCollection(T schema,
String id) |
| Modifier and Type | Method and Description |
|---|---|
void |
accepts(FeatureVisitor visitor,
ProgressListener progress)
Visit the contents of a feature collection.
|
boolean |
contains(Object o)
Returns true if this collection contains the specified element.
|
boolean |
containsAll(Collection<?> c)
Returns true if this collection contains all of the elements in the specified
collection.
|
abstract FeatureIterator<F> |
features()
Subclasses required to implement this method to traverse FeatureCollection contents.
|
ReferencedEnvelope |
getBounds()
Full collection traversal to obtain bounds of FeatureCollection.
|
String |
getID()
ID used when serializing to GML
|
T |
getSchema()
The schema for the child feature members of this collection.
|
boolean |
isEmpty()
Returns true if this feature collection contains no features.
|
int |
size()
Returns the number of elements in this collection.
|
FeatureCollection<T,F> |
sort(SortBy order)
Obtained sorted contents, only implemented for SimpleFeature at present.
|
FeatureCollection<T,F> |
subCollection(Filter filter)
Convenience implementation that just wraps this collection into a
FilteringFeatureCollection. |
Object[] |
toArray()
Array of all the elements.
|
<O> O[] |
toArray(O[] a) |
protected String id
protected T extends FeatureType schema
protected BaseFeatureCollection()
protected BaseFeatureCollection(T schema)
public String getID()
FeatureCollectiongetID in interface FeatureCollection<T extends FeatureType,F extends Feature>public T getSchema()
FeatureCollectionRepresents the most general FeatureType in common to all the features in this collection.
getSchema in interface FeatureCollection<T extends FeatureType,F extends Feature>public abstract FeatureIterator<F> features()
Note that FeatureIterator is available to clean up after any resource
use required during traversal.
features in interface FeatureCollection<T extends FeatureType,F extends Feature>public boolean contains(Object o)
This implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
contains in interface FeatureCollection<T extends FeatureType,F extends Feature>o - object to be checked for containment in this collection.Collection.contains(Object)public boolean containsAll(Collection<?> c)
containsAll in interface FeatureCollection<T extends FeatureType,F extends Feature>c - collection to be checked for containment in this collection.NullPointerException - if the specified collection is null.contains(Object)public boolean isEmpty()
FeatureCollectionisEmpty in interface FeatureCollection<T extends FeatureType,F extends Feature>public Object[] toArray()
toArray in interface FeatureCollection<T extends FeatureType,F extends Feature>Collection.toArray()public <O> O[] toArray(O[] a)
toArray in interface FeatureCollection<T extends FeatureType,F extends Feature>Collection.toArray(Object[])public void accepts(FeatureVisitor visitor, ProgressListener progress) throws IOException
FeatureCollectionThe order of traversal is dependent on the FeatureCollection implementation; some collections are able to make efficient use of an internal index in order to quickly visit features located in the same region.
accepts in interface FeatureCollection<T extends FeatureType,F extends Feature>visitor - Closure applied to each feature in turn.progress - Used to report progress, may be used to interrupt the operationIOExceptionpublic FeatureCollection<T,F> subCollection(Filter filter)
FilteringFeatureCollection. Subclasses might want to override this in case the filter can be
cascaded to their data sources.subCollection in interface FeatureCollection<T extends FeatureType,F extends Feature>filter - FeatureListpublic FeatureCollection<T,F> sort(SortBy order)
This method only supports SimpleFeature at present, consider use of FeatureSource.features( Query ).
sort in interface FeatureCollection<T extends FeatureType,F extends Feature>order - Sort orderpublic int size()
size in interface FeatureCollection<T extends FeatureType,F extends Feature>Collection.size()public ReferencedEnvelope getBounds()
getBounds in interface FeatureCollection<T extends FeatureType,F extends Feature>Copyright © 1996–2019 Geotools. All rights reserved.