com.vividsolutions.jump.feature
Class FeatureDataset

java.lang.Object
  extended by com.vividsolutions.jump.feature.FeatureDataset
All Implemented Interfaces:
FeatureCollection, java.io.Serializable

public class FeatureDataset
extends java.lang.Object
implements FeatureCollection, java.io.Serializable

Default implementation of FeatureCollection.

See Also:
Serialized Form

Constructor Summary
FeatureDataset(java.util.Collection newFeatures, FeatureSchema featureSchema)
          Creates a FeatureDataset, initialized with a group of Features.
FeatureDataset(FeatureSchema featureSchema)
          Creates a FeatureDataset.
 
Method Summary
 void add(Feature feature)
          Adds a feature to this collection.
 void addAll(java.util.Collection features)
          Adds multiple features to this collection.
 void clear()
          Removes all features from this collection.
 boolean contains(Feature feature)
          Returns whether or not this Feature is in this collection
 com.vividsolutions.jts.geom.Envelope getEnvelope()
          Because the envelope is cached, the envelope may be incorrect if you later change a Feature's geometry using Feature#setGeometry.
 Feature getFeature(int index)
          Returns the Feature at the given index (zero-based).
 java.util.List getFeatures()
          Returns an unmodifiable List of the features in this collection
 FeatureSchema getFeatureSchema()
          Returns information about this FeatureCollection
 void invalidateEnvelope()
          Clears the cached envelope of this FeatureDataset's Features.
 boolean isEmpty()
          Returns whether this collection has no features.
 java.util.Iterator iterator()
          Returns an Iterator over the features
 java.util.List query(com.vividsolutions.jts.geom.Envelope envelope)
          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.
 int size()
          Returns the number of features in this collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureDataset

public FeatureDataset(java.util.Collection newFeatures,
                      FeatureSchema featureSchema)
Creates a FeatureDataset, initialized with a group of Features.

Parameters:
newFeatures - an initial group of features to add to this FeatureDataset
featureSchema - the types of the attributes of the features in this collection

FeatureDataset

public FeatureDataset(FeatureSchema featureSchema)
Creates a FeatureDataset.

Parameters:
featureSchema - the types of the attributes of the features in this collection
Method Detail

getFeature

public Feature getFeature(int index)
Returns the Feature at the given index (zero-based).


getFeatureSchema

public FeatureSchema getFeatureSchema()
Description copied from interface: FeatureCollection
Returns information about this FeatureCollection

Specified by:
getFeatureSchema in interface FeatureCollection
Returns:
the types of the attributes of the features in this collection

getEnvelope

public com.vividsolutions.jts.geom.Envelope getEnvelope()
Because the envelope is cached, the envelope may be incorrect if you later change a Feature's geometry using Feature#setGeometry.

Specified by:
getEnvelope in interface FeatureCollection
Returns:
the smallest Envelope enclosing all the Features in this collection

getFeatures

public java.util.List getFeatures()
Description copied from interface: FeatureCollection
Returns an unmodifiable List of the features in this collection

Specified by:
getFeatures in interface FeatureCollection
Returns:
a read-only view of all the features

isEmpty

public boolean isEmpty()
Description copied from interface: FeatureCollection
Returns whether this collection has no features.

Specified by:
isEmpty in interface FeatureCollection
Returns:
whether or not the size of this collection is 0

query

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

Specified by:
query in interface FeatureCollection
Parameters:
envelope - the envelope to query against
Returns:
a List containing the features whose envelopes intersect the given envelope

add

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

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

contains

public boolean contains(Feature feature)
Returns whether or not this Feature is in this collection

Returns:
true if this feature is in this collection, as determined using Feature#equals

remove

public java.util.Collection remove(com.vividsolutions.jts.geom.Envelope env)
Removes the features which intersect the given envelope

Specified by:
remove in interface FeatureCollection
Returns:
the removed features

remove

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

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

clear

public void clear()
Removes all features from this collection.

Specified by:
clear in interface FeatureCollection

size

public int size()
Description copied from interface: FeatureCollection
Returns the number of features in this collection.

Specified by:
size in interface FeatureCollection
Returns:
the number of features in this collection

iterator

public java.util.Iterator iterator()
Description copied from interface: FeatureCollection
Returns an Iterator over the features

Specified by:
iterator in interface FeatureCollection
Returns:
an Iterator over the features

invalidateEnvelope

public void invalidateEnvelope()
Clears the cached envelope of this FeatureDataset's Features. Call this method when a Feature's Geometry is modified.


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

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