org.geotools.data
Class DefaultFeatureResults

java.lang.Object
  extended byorg.geotools.data.DefaultFeatureResults
All Implemented Interfaces:
FeatureResults

public class DefaultFeatureResults
extends java.lang.Object
implements FeatureResults

Description

Details

Author:
Jody Garnett, Refractions Research

Field Summary
protected  FeatureSource featureSource
           
protected  Query query
           
 
Constructor Summary
DefaultFeatureResults(FeatureSource source, Query query)
          FeatureResults query against featureSource.
 
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()
          Number of Features in this query.
 FeatureType getSchema()
          FeatureSchema for provided query.
protected  Transaction getTransaction()
          Returns transaction from featureSource (if it is a FeatureStore), or Transaction.AUTO_COMMIT if it is not.
 FeatureReader reader()
          Retrieve a FeatureReader for this Query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected Query query

featureSource

protected FeatureSource featureSource
Constructor Detail

DefaultFeatureResults

public DefaultFeatureResults(FeatureSource source,
                             Query query)
FeatureResults query against featureSource.

Please note that is object will not be valid after the transaction has closed.

Parameters:
source -
query -
Method Detail

getSchema

public FeatureType getSchema()
                      throws java.io.IOException
FeatureSchema for provided query.

If query.retrieveAllProperties() is true the FeatureSource getSchema() will be returned.

If query.getPropertyNames() is used to limit the result of the Query a sub type will be returned based on FeatureSource.getSchema().

Specified by:
getSchema in interface FeatureResults
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
DataSourceException - DOCUMENT ME!

getTransaction

protected Transaction getTransaction()
Returns transaction from featureSource (if it is a FeatureStore), or Transaction.AUTO_COMMIT if it is not.

Returns:
Transacstion this FeatureResults opperates against

reader

public FeatureReader reader()
                     throws java.io.IOException
Retrieve a FeatureReader for this Query

Specified by:
reader in interface FeatureResults
Returns:
FeatureReader for this Query
Throws:
java.io.IOException - If results could not be obtained

getBounds

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

This implementation will generate the correct results from reader() if the provided FeatureSource does not provide an optimized result via FeatureSource.getBounds( Query ).

If the feature has no geometry, then an empty envelope is returned.

Specified by:
getBounds in interface FeatureResults
Returns:
Throws:
java.io.IOException - If bounds could not be obtained
DataSourceException - See IOException
See Also:
FeatureResults.getBounds()

getCount

public int getCount()
             throws java.io.IOException
Number of Features in this query.

This implementation will generate the correct results from reader() if the provided FeatureSource does not provide an optimized result via FeatureSource.getCount( Query ).

Specified by:
getCount in interface FeatureResults
Returns:
Throws:
java.io.IOException - If feature could not be read
DataSourceException - See IOException
See Also:
FeatureResults.getCount()

collection

public FeatureCollection collection()
                             throws java.io.IOException
Description copied from interface: FeatureResults
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;  
 }
 
 

Specified by:
collection in interface FeatureResults
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.