org.opengis.feature
Interface FeatureCollection

All Superinterfaces:
Attribute, ComplexAttribute, Feature, Property
All Known Subinterfaces:
DataFeatureCollection, SimpleFeatureCollection

@XmlElement(value="FeatureCollection")
public interface FeatureCollection
extends Feature

Represents a FeatureCollection (explicitly a Collection.

Note the "attributes" available in a FeatureCollection are to be considered a derrived quality based on the contents (or members) of the collection. An "empty" FeatureCollection should not exist.

Implementations and client code should adhere to the rules set forth by Collection. That is, some methods are optional to implement, and may throw an UnsupportedOperationException.

Since:
GeoAPI 2.0
Version:
GeoAPI 2.1
See Also:
Collection

Method Summary
 void accepts(FeatureVisitor visitor, ProgressListener progress)
          Will visit the contents of the feature collection.
 void close(Iterator<Feature> iterator)
          You are required to close iterators after use.
 FeatureCollectionType getType()
          Restricted to return a FeatureCollectionType.
 Iterator<Feature> iterator()
          Access contents of this collection, you are required to close iterators after use.
 Collection<FeatureType> memberTypes()
          Convenience method for obtaining the collection of member types in which members of this collection may implement.
 FeatureCollection sort(SortBy order)
          A sorted "view" of this collection in the order indicated.
 FeatureCollection subCollection(Filter filter)
          FeatureCollection "view" indicated by provided filter.
 
Methods inherited from interface Feature
getBounds, getCRS, getDefaultGeometry, getID, getUserData, putUserData, setCRS, setDefaultGeometry
 
Methods inherited from interface ComplexAttribute
associations, attributes, get, getDescriptor, getValue, setValue
 
Methods inherited from interface Attribute
nillable, operation, setValue
 
Methods inherited from interface Property
descriptor, name
 

Method Detail

getType

FeatureCollectionType getType()
Restricted to return a FeatureCollectionType.

Specified by:
getType in interface Attribute
Specified by:
getType in interface ComplexAttribute
Specified by:
getType in interface Feature
Specified by:
getType in interface Property
Returns:
AttributeType information describing allowable content

iterator

Iterator<Feature> iterator()
Access contents of this collection, you are required to close iterators after use.

Two points to using iterator successfully:

Common Problems

The first common mistake is trying to store Features obtained from an iterator. This is a mistake as you may get the same instance returned each time with different content and fid). The solution is to store the IDs in a Set and and use a Feature ID Filter to produce the needed collection.

Please note you will be limited to a single worker thread to access an iterator, this is a consequence of a feature only being valid until next is called. For an alternative please use visitor. Conversly plit you request into sections with one for each worker thread.

XPath Conventions

Conventions for XPath Access: the contents of a GML collection are represented by either featureMember or featureMembers. When interpretting an XPath expression, you should consider this function to visit both elements for you.

XPath Mapping:

Returns:
Iterator over the contents of this feature collection.

close

void close(Iterator<Feature> iterator)
You are required to close iterators after use.

Many FeatureCollections are backed by IO resources that need to be returned to the opperating system after use.


subCollection

FeatureCollection subCollection(Filter filter)
FeatureCollection "view" indicated by provided filter.

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

This method is used cut down on the number of filter based methods required for a useful FeatureCollection 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 ).removeAll();
 
The above recommended use is agreement with the Collections API precident of List.subList( start, end ).

The results of subCollection:

Parameters:
filter -
Returns:
FeatureCollection identified as subset.
See Also:
FeatureList

sort

FeatureCollection sort(SortBy order)
A sorted "view" of this collection in the order indicated.

Parameters:
order -
Returns:
FeatureList in requested order

memberTypes

Collection<FeatureType> memberTypes()
Convenience method for obtaining the collection of member types in which members of this collection may implement.

Equivalent to calling the following:

        
                getType().getMemberTypes()
        
 


accepts

void accepts(FeatureVisitor visitor,
             ProgressListener progress)
Will visit the contents of the feature collection.

Parameters:
visitor -
Throws:
IOException
See Also:
For more comparison with iterator based access


Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.