Class CachingFeatureCollection
java.lang.Object
com.vividsolutions.jump.feature.FeatureCollectionWrapper
com.vividsolutions.jump.workbench.model.cache.CachingFeatureCollection
- All Implemented Interfaces:
FeatureCollection, Iterable<Feature>
Caches features to prevent unnecessary queries. Useful for wrapping
database-backed FeatureCollections. All calls are delegated to the cache,
except for calls to query(envelope).iterator() where (1) the envelope is not
within the cache envelope, and (2) the call is made in a non-GUI thread.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.locationtech.jts.geom.EnvelopeReturns the bounds of this collection.Returns information about this FeatureCollectionquery(org.locationtech.jts.geom.Envelope envelope) A quick search for features, using an envelope comparison.setCachingByEnvelope(boolean cachingByEnvelope) This setting is ignored if the call to query(envelope).iterator() is made on the GUI thread, because long queries would make the GUI unresponsive.Methods inherited from class FeatureCollectionWrapper
add, addAll, checkNotWrappingSameClass, clear, getFeatureCollection, getFeatures, getUltimateWrappee, getWrappee, getWrappee, hasWrapper, isEmpty, iterator, remove, remove, removeAll, setFeatureCollection, sizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
CachingFeatureCollection
-
-
Method Details
-
getEnvelope
public org.locationtech.jts.geom.Envelope getEnvelope()Description copied from interface:FeatureCollectionReturns the bounds of this collection.- Specified by:
getEnvelopein interfaceFeatureCollection- Overrides:
getEnvelopein classFeatureCollectionWrapper- Returns:
- the smallest Envelope enclosing all the Features in this collection
- See Also:
-
getFeatureSchema
Description copied from interface:FeatureCollectionReturns information about this FeatureCollection- Specified by:
getFeatureSchemain interfaceFeatureCollection- Overrides:
getFeatureSchemain classFeatureCollectionWrapper- Returns:
- the types of the attributes of the features in this collection
- See Also:
-
query
Description copied from interface:FeatureCollectionA quick search for features, using an envelope comparison.- Specified by:
queryin interfaceFeatureCollection- Overrides:
queryin classFeatureCollectionWrapper- Parameters:
envelope- the envelope to query against- Returns:
- features whose envelopes intersect the given envelope
-
setCachingByEnvelope
This setting is ignored if the call to query(envelope).iterator() is made on the GUI thread, because long queries would make the GUI unresponsive.- Parameters:
cachingByEnvelope- whether query(envelope).iterator() delegates to the cache if envelope is within the cache envelope
-
emptyCache
public void emptyCache()
-