com.vividsolutions.jump.feature
Class IndexedFeatureCollection

java.lang.Object
  extended by com.vividsolutions.jump.feature.FeatureCollectionWrapper
      extended by com.vividsolutions.jump.feature.IndexedFeatureCollection
All Implemented Interfaces:
FeatureCollection

public class IndexedFeatureCollection
extends FeatureCollectionWrapper

An IndexedFeatureCollection creates a new collection which is backed by a FeatureCollection, but which is indexed for query purposes. In this implementation, Features cannot be added or removed (an Exception is thrown) and Features' Geometries should not be modified (otherwise they will be out of sync with the spatial index).


Constructor Summary
IndexedFeatureCollection(FeatureCollection fc)
          Constructs an IndexedFeatureCollection wrapping the given FeatureCollection and using the default spatial index.
IndexedFeatureCollection(FeatureCollection fc, com.vividsolutions.jts.index.SpatialIndex spatialIndex)
          Constructs an IndexedFeatureCollection wrapping the given FeatureCollection and using the given empty spatial index.
 
Method Summary
 void add(Feature feature)
          Adds a feature to this collection.
 void addAll(java.util.Collection features)
          Adds multiple features to this collection.
 java.util.List query(com.vividsolutions.jts.geom.Envelope env)
          A quick search for features, using an envelope comparison.
 java.util.Collection remove(com.vividsolutions.jts.geom.Envelope env)
          Removes the features which intersect the given envelope
 void remove(Feature feature)
          Removes a feature from this collection.
 void removeAll(java.util.Collection features)
          Removes multiple features from this collection.
 
Methods inherited from class com.vividsolutions.jump.feature.FeatureCollectionWrapper
checkNotWrappingSameClass, clear, getEnvelope, getFeatures, getFeatureSchema, getUltimateWrappee, getWrappee, hasWrapper, isEmpty, iterator, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedFeatureCollection

public IndexedFeatureCollection(FeatureCollection fc)
Constructs an IndexedFeatureCollection wrapping the given FeatureCollection and using the default spatial index.


IndexedFeatureCollection

public IndexedFeatureCollection(FeatureCollection fc,
                                com.vividsolutions.jts.index.SpatialIndex spatialIndex)
Constructs an IndexedFeatureCollection wrapping the given FeatureCollection and using the given empty spatial index.

Method Detail

add

public void add(Feature feature)
Description copied from interface: FeatureCollection
Adds a feature to this collection.

Specified by:
add in interface FeatureCollection
Overrides:
add in class FeatureCollectionWrapper
Parameters:
feature - a Feature to add to the end of this collection

remove

public void remove(Feature feature)
Description copied from interface: FeatureCollection
Removes a feature from this collection.

Specified by:
remove in interface FeatureCollection
Overrides:
remove in class FeatureCollectionWrapper
Parameters:
feature - a Feature to remove from this collection

query

public java.util.List query(com.vividsolutions.jts.geom.Envelope env)
Description copied from interface: FeatureCollection
A quick search for features, using an envelope comparison.

Specified by:
query in interface FeatureCollection
Overrides:
query in class FeatureCollectionWrapper
Parameters:
env - the envelope to query against
Returns:
features whose envelopes intersect the given envelope

addAll

public void addAll(java.util.Collection features)
Description copied from interface: FeatureCollection
Adds multiple features to this collection. To be preferred over #add for adding multiple features, because in some systems (like the JUMP Workbench) fewer events will be fired.

Specified by:
addAll in interface FeatureCollection
Overrides:
addAll in class FeatureCollectionWrapper

remove

public java.util.Collection remove(com.vividsolutions.jts.geom.Envelope env)
Description copied from interface: FeatureCollection
Removes the features which intersect the given envelope

Specified by:
remove in interface FeatureCollection
Overrides:
remove in class FeatureCollectionWrapper
Returns:
the removed features

removeAll

public void removeAll(java.util.Collection features)
Description copied from interface: FeatureCollection
Removes multiple features from this collection. To be preferred over #remove for removing multiple features, because in some systems (like the JUMP Workbench) fewer events will be fired.

Specified by:
removeAll in interface FeatureCollection
Overrides:
removeAll in class FeatureCollectionWrapper