org.geotools.renderer.lite
Class IndexedFeatureResults

java.lang.Object
  extended byorg.geotools.renderer.lite.IndexedFeatureResults
All Implemented Interfaces:
FeatureResults

public class IndexedFeatureResults
extends java.lang.Object
implements FeatureResults

IndexedFeatureReader

Author:
wolf

Constructor Summary
IndexedFeatureResults(FeatureResults results)
           
 
Method Summary
 FeatureCollection collection()
          Convert this set of results to a FeatureCollection.
 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 the contents of this collection.
 FeatureReader reader()
          Provides access to the Features, please note that FeatureReader is a blocking api.
 FeatureReader reader(com.vividsolutions.jts.geom.Envelope envelope)
           
 void setQueryBounds(com.vividsolutions.jts.geom.Envelope queryBounds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedFeatureResults

public IndexedFeatureResults(FeatureResults results)
                      throws java.io.IOException,
                             IllegalAttributeException
Method Detail

getSchema

public FeatureType getSchema()
                      throws java.io.IOException
Description copied from interface: FeatureResults
Returns the FeatureType of the contents of this collection.

Please note that for a collection with a mixed contents the FeatureType may be degenerate (ie very generic). For many applications (like shapefiles or tables) the FeatureType can safely be used to describe all the Features in the result set.

Specified by:
getSchema in interface FeatureResults
Returns:
A FeatureType that describes the contents of this collection.
Throws:
java.io.IOException - if their is a problem getting the FeatureType.
See Also:
FeatureResults.getSchema()

reader

public FeatureReader reader(com.vividsolutions.jts.geom.Envelope envelope)
                     throws java.io.IOException
Throws:
java.io.IOException
See Also:
FeatureResults.reader()

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
Description copied from interface: FeatureResults
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;  
 }
 
 

Specified by:
getBounds in interface FeatureResults
Returns:
Bounding box of this FeatureResults, or an empty Envelope
See Also:
FeatureResults.getBounds()

getCount

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

Specified by:
getCount in interface FeatureResults
Returns:
The number of Features in this FeatureResults.
Throws:
java.io.IOException - If there are problems getting the count
See Also:
FeatureResults.getCount()

collection

public FeatureCollection collection()
                             throws java.io.IOException
Description copied from interface: FeatureResults
Convert this set of results to a FeatureCollection.

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:
DOCUMENT ME!
Throws:
java.io.IOException - If any problems occur aquiring Features
See Also:
FeatureResults.collection()

reader

public FeatureReader reader()
                     throws java.io.IOException
Description copied from interface: FeatureResults
Provides access to the Features, please note that FeatureReader is a blocking api.

Specified by:
reader in interface FeatureResults
Returns:
A FeatureReader streaming over the FeatureResults
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
FeatureResults.reader()

setQueryBounds

public void setQueryBounds(com.vividsolutions.jts.geom.Envelope queryBounds)
Returns:


Copyright © GeoTools. All Rights Reserved.