org.geotools.caching.grid.featurecache.readers
Class CombiningCachingFeatureReader

java.lang.Object
  extended by org.geotools.caching.grid.featurecache.readers.CombiningCachingFeatureReader
All Implemented Interfaces:
FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

public class CombiningCachingFeatureReader
extends java.lang.Object
implements FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

This feature reader reads features from two sources. The results of either are optionally cached.

All features are read from the feature readers and cached (if requested) however only those features which pass the postFilter filter are returned.

Since:
1.2.0
Author:
Emily

Constructor Summary
CombiningCachingFeatureReader(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader1, FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader2, boolean cache1, boolean cache2, SpatialIndex cache, org.opengis.filter.Filter postFilter)
          Creates a new feature reader that combines the results from two feature reads and optionally caches the results.
 
Method Summary
 void close()
          Closes the feature reader
 org.opengis.feature.simple.SimpleFeatureType getFeatureType()
          Get type associated with reader.
 boolean hasNext()
          Query whether this FeatureReader has another Feature.
 org.opengis.feature.simple.SimpleFeature next()
          Returns the next element in the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombiningCachingFeatureReader

public CombiningCachingFeatureReader(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader1,
                                     FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader2,
                                     boolean cache1,
                                     boolean cache2,
                                     SpatialIndex cache,
                                     org.opengis.filter.Filter postFilter)
                              throws java.io.IOException
Creates a new feature reader that combines the results from two feature reads and optionally caches the results. All features are read from the feature readers and cached (if requested) however only those features which pass the postFilter filter are returned.

Parameters:
reader1 - feature reader 1
reader2 - feature reader 2
cache1 - if results from feature reader 1 should be cached
cache2 - if results from feature reader 2 should be cached
cache - cache
postFilter - the filter to be applied as feature read
Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Closes the feature reader

Specified by:
close in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Throws:
java.io.IOException - DOCUMENT ME!

getFeatureType

public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
Get type associated with reader.

This function returns the type from feature reader 1. Assumes that both feature readers have the same type.

Specified by:
getFeatureType in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
the FeatureType of the Features this FeatureReader will create.

hasNext

public boolean hasNext()
                throws java.io.IOException
Description copied from interface: FeatureReader
Query whether this FeatureReader has another Feature.

Specified by:
hasNext in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
Throws:
java.io.IOException - If an error occurs determining if there are more Features.

next

public org.opengis.feature.simple.SimpleFeature next()
                                              throws java.io.IOException,
                                                     java.lang.IllegalArgumentException,
                                                     java.util.NoSuchElementException
Returns the next element in the collection.

Specified by:
next in interface FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
The next feature in the reader.
Throws:
java.io.IOException - If an error occurs reading the Feature.
java.util.NoSuchElementException - If there are no more Features in the Reader.
java.lang.IllegalArgumentException


Copyright © 1996-2010 Geotools. All Rights Reserved.