|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.caching.featurecache.AbstractFeatureCache
org.geotools.caching.grid.featurecache.GridFeatureCache
public class GridFeatureCache
An implementation of a feature cache.
This implementation holds a write lock on the cache while it access features from the feature source. As a result during this time no other features can read or write to the cache.
Field Summary | |
---|---|
protected int |
capacity
|
protected int |
max_tiles
|
protected GridSpatialIndex |
tracker
|
Fields inherited from class org.geotools.caching.featurecache.AbstractFeatureCache |
---|
ff, fs, lock, logger, source_feature_reads, source_hits |
Constructor Summary | |
---|---|
GridFeatureCache(FeatureSource fs,
int indexcapacity,
int capacity,
Storage store)
|
|
GridFeatureCache(FeatureSource fs,
ReferencedEnvelope env,
int gridsize,
int capacity,
Storage store)
Creates a new grid feature cache. |
Method Summary | |
---|---|
void |
clear()
Clears the cache. |
void |
dispose()
Disposes of the cache. |
ReferencedEnvelope |
getBounds()
Gets the bounds of the cache. |
ReferencedEnvelope |
getBounds(Query query)
Gets the bounds of the data that match a given query. |
int |
getCount(Query query)
Gets the count of the data that match a given query. |
protected static ReferencedEnvelope |
getFeatureBounds(FeatureSource fs)
Private function used to get the bounds of a feature collection and convert the IOException to a FeatureCacheException |
SpatialIndex |
getIndex()
returns the spatial index that is used to implement the cache |
org.opengis.feature.simple.SimpleFeatureType |
getSchema()
Returns the feature schema of the underlying feature source; checks the feature store first to see if it's in there |
java.lang.String |
getStats()
Gets the feature cache statistics |
java.util.Set |
getSupportedHints()
Returns the set of hints this FeatureSource is able to support. |
protected void |
isOversized(FeatureCollection fc)
Determines if the given feature collection is too big to put into the cache. |
java.util.List<com.vividsolutions.jts.geom.Envelope> |
match(com.vividsolutions.jts.geom.Envelope e)
This function looks in the cache for missing tiles. |
java.util.List<NodeIdentifier>[] |
matchNodeIds(com.vividsolutions.jts.geom.Envelope e)
Converts and envelope into a list of nodes that the envelope covers. |
FeatureCollection |
peek(com.vividsolutions.jts.geom.Envelope e)
Looks in the cache for any elements within the given envelope. |
void |
put(FeatureCollection fc)
Adds a feature collection to the cache. |
void |
put(FeatureCollection fc,
com.vividsolutions.jts.geom.Envelope e)
Adds a feature collection to the cache. |
void |
register(java.util.Collection<NodeIdentifier> nodes)
Registers a collection of nodes as valid. |
protected void |
register(com.vividsolutions.jts.geom.Envelope e)
Registers a given envelope in the cache. |
void |
remove(com.vividsolutions.jts.geom.Envelope e)
Removes an area from the cache. |
java.lang.String |
toString()
|
void |
unregister(java.util.Collection<NodeIdentifier> nodes)
Un-registers a collection of nodes. |
protected void |
unregister(com.vividsolutions.jts.geom.Envelope e)
Unregisters all nodes in a given envelope. |
Methods inherited from class org.geotools.caching.featurecache.AbstractFeatureCache |
---|
_getFeatures, addFeatureListener, changed, get, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, readLock, readUnLock, register, register, removeFeatureListener, sourceAccessStats, unregister, unregister, writeLock, writeUnLock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int max_tiles
protected GridSpatialIndex tracker
protected int capacity
Constructor Detail |
---|
public GridFeatureCache(FeatureSource fs, int indexcapacity, int capacity, Storage store) throws FeatureCacheException
FeatureStore
- from which to cache featuresindexcapacity
- = number of tiles in indexcapacity
- = max number of features to cache; Integer.MAX_VALUE will cache all features
FeatureCacheException
java.io.IOException
public GridFeatureCache(FeatureSource fs, ReferencedEnvelope env, int gridsize, int capacity, Storage store)
fs
- FeatureStore from which to cache featuresenv
- The size of the feature cache; once defined features outside this bounds cannot be added to the featurestore/cachegridsize
- number of tiles in the indexcapacity
- maximum number of features to cachestore
- the cache storageMethod Detail |
---|
public SpatialIndex getIndex()
protected static ReferencedEnvelope getFeatureBounds(FeatureSource fs) throws FeatureCacheException
fs
-
FeatureCacheException
public org.opengis.feature.simple.SimpleFeatureType getSchema()
getSchema
in interface FeatureSource
getSchema
in class AbstractFeatureCache
public java.util.List<com.vividsolutions.jts.geom.Envelope> match(com.vividsolutions.jts.geom.Envelope e)
match
in class AbstractFeatureCache
e
-
public java.util.List<NodeIdentifier>[] matchNodeIds(com.vividsolutions.jts.geom.Envelope e)
e
- envelope to search
public void clear()
public void dispose()
public FeatureCollection peek(com.vividsolutions.jts.geom.Envelope e)
Returns a in-memory feature collection.
public void put(FeatureCollection fc, com.vividsolutions.jts.geom.Envelope e) throws CacheOversizedException
fc
- the feature collection to add to the cachee
- the envelope that encompasses the feature collection added
CacheOversizedException
protected void isOversized(FeatureCollection fc) throws CacheOversizedException
AbstractFeatureCache
isOversized
in class AbstractFeatureCache
CacheOversizedException
- if feature collection is to big for cachepublic void remove(com.vividsolutions.jts.geom.Envelope e)
public ReferencedEnvelope getBounds() throws java.io.IOException
This maybe be larger than the data bounds.
java.io.IOException
- if there are errors getting the bounding box.public ReferencedEnvelope getBounds(Query query) throws java.io.IOException
This function is passed along to the feature source.
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the bounds for.
java.io.IOException
- DOCUMENT ME!public int getCount(Query query) throws java.io.IOException
This function is passed along to the feature source.
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the count for.
-1
if count is too expensive to calculate or any errors or occur.
java.io.IOException
- if there are errors getting the countpublic void put(FeatureCollection fc) throws CacheOversizedException
fc
- the feature collection to add to the cache
CacheOversizedException
- if the feature collection has too many features for the cache.protected void register(com.vividsolutions.jts.geom.Envelope e)
register
in class AbstractFeatureCache
public void register(java.util.Collection<NodeIdentifier> nodes)
nodes
- public void unregister(java.util.Collection<NodeIdentifier> nodes)
nodes
- protected void unregister(com.vividsolutions.jts.geom.Envelope e)
unregister
in class AbstractFeatureCache
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Set getSupportedHints()
FeatureSource
FeatureSource
is able to support.
Hints are to be specified in the Query
, for each data access where they
may be required.
Depending on the actual value provide by the user, the FeatureSource
may decide not to honor the hint.
RenderingHints#Key
objects (eventually empty, never null).public java.lang.String getStats()
AbstractFeatureCache
getStats
in class AbstractFeatureCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |