org.geotools.data
Interface FeatureResults

All Known Implementing Classes:
DefaultFeatureResults

public interface FeatureResults

Highlevel API for Features from a specific Query.

The can opperate as as a kind of Prepaired Query. It is a Query that knows enough information to be rerun. We may wish to rename this class as QueryResults.

Differences from FeatureCollection:

Ideas:

Version:
$Id: FeatureResults.java,v 1.4 2003/11/13 17:56:33 jive Exp $
Author:
Jody Garnett, Ray Gallagher, Rob Hranac, TOPP, Chris Holmes, TOPP

Method Summary
 FeatureCollection collection()
          Provides a stop-gap bridge to our existing Renderers.
 com.vividsolutions.jts.geom.Envelope getBounds()
          Returns the bounding box of this FeatureResults.
 int getCount()
          Returns the number of Features in this FeatureResults.
 FeatureType getSchema()
          Returns the FeatureType of this FeatureResuls.
 FeatureReader reader()
          Provides access to the Features, please note that FeatureReader is a blocking api.
 

Method Detail

getSchema

public FeatureType getSchema()
                      throws java.io.IOException
Returns the FeatureType of this FeatureResuls.

Returns:
A FeatureType for
Throws:
java.io.IOException - if their is a problem getting the FeatureType.

reader

public FeatureReader reader()
                     throws java.io.IOException
Provides access to the Features, please note that FeatureReader is a blocking api.

Returns:
A FeatureReader streaming over the FeatureResults
Throws:
java.io.IOException

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
                                               throws java.io.IOException
Returns the bounding box of this FeatureResults.

This opperation may be expensive. Consider FeatureSource.getBounds( Query ) as an alternative.

This method is logically the same as:
 
 public Envelope getBounds() throws IOException {
     Envelope newBBox = new Envelope();
     Envelope internal;
     Feature feature;
 
     for (FeatureReader r = reader(); r.hasNext();) {
         feature = r.next();
         internal = feature.getDefaultGeometry().getEnvelopeInternal();
         newBBox.expandToInclude(internal);
     }
     return newBBox;  
 }
 
 

Returns:
Bounding box of this FeatureResults
Throws:
java.io.IOException

getCount

public int getCount()
             throws java.io.IOException
Returns the number of Features in this FeatureResults.

This opperation may be expensive. Consider FeatureSource.getCount( Query ) as an alternative.

This method is logically the same as:
 
 public int getCount() throws IOException {
     int count = 0;
     for (FeatureReader r = reader(); r.hasNext(); count++) {
         r.next();
     }
     return count;  
 }
 
 

Returns:
The number of Features in this FeatureResults.
Throws:
java.io.IOException - If there are problems getting the count

collection

public FeatureCollection collection()
                             throws java.io.IOException
Provides a stop-gap bridge to our existing Renderers.

This method is logically the same as:

 
 public FeatureCollection collection() throws IOException {
     FeatureCollection collection = FeatureCollections.newCollection()
     for (FeatureReader r = reader(); r.hasNext();) {
         collection.add( r.next() );
     }
     return collection;  
 }
 
 

Returns:
An In-Memory FeatureCollection for existing Renderers
Throws:
java.io.IOException - If any problems occur aquiring Features


Copyright © 1996-2003 GeoTools. All Rights Reserved.