org.geotools.feature.collection
Class FeatureState

java.lang.Object
  extended byorg.geotools.feature.collection.FeatureState
Direct Known Subclasses:
BaseFeatureState, SubFeatureState

public abstract class FeatureState
extends java.lang.Object

This is *not* a Feature - it is a Delegate used by FeatureCollection implementations as "mix-in", provides implementation of featureCollection events, featureType, and attribute access.

To use cut&paste the following code exactly:

 
 
 
 

On the bright side this means we can "fix" all the FeatureCollection implementations in one fell-swoop.

Since:
GeoTools 2.2
Author:
Jody Garnett, Refractions Reserach, Inc.

Field Summary
protected  com.vividsolutions.jts.geom.Envelope bounds
           
protected  ResourceCollection data
           
 
Constructor Summary
protected FeatureState(ResourceCollection collection)
           
 
Method Summary
abstract  void addListener(CollectionListener listener)
          Adds a listener for collection events.
static java.util.Set fids(java.util.Collection stuff)
          Get the set of fids for the provided collection.
protected  void fireChange(java.util.Collection coll, int type)
           
protected abstract  void fireChange(Feature[] features, int type)
          To let listeners know that something has changed.
protected  void fireChange(Feature feature, int type)
           
 java.lang.Object getAttribute(int index)
           
 java.lang.Object getAttribute(java.lang.String xPath)
          Not really interested yet ..
 java.lang.Object[] getAttributes(java.lang.Object[] attributes)
           
 com.vividsolutions.jts.geom.Envelope getBounds()
          Gets the bounding box for the features in this feature collection.
abstract  FeatureType getChildFeatureType()
           
 com.vividsolutions.jts.geom.Geometry getDefaultGeometry()
           
abstract  FeatureType getFeatureType()
           
abstract  java.lang.String getId()
           
 int getNumberOfAttributes()
           
 FeatureCollection getParent()
           
static boolean isFeatures(java.util.Collection stuff)
          Test if collection is all features!
abstract  void removeListener(CollectionListener listener)
          Removes a listener for collection events.
 void setAttribute(int position, java.lang.Object val)
           
 void setAttribute(java.lang.String xPath, java.lang.Object attribute)
           
 void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
           
 void setParent(FeatureCollection parent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bounds

protected com.vividsolutions.jts.geom.Envelope bounds

data

protected ResourceCollection data
Constructor Detail

FeatureState

protected FeatureState(ResourceCollection collection)
Method Detail

addListener

public abstract void addListener(CollectionListener listener)
Adds a listener for collection events.

Parameters:
listener - The listener to add

removeListener

public abstract void removeListener(CollectionListener listener)
Removes a listener for collection events.

Parameters:
listener - The listener to remove

fireChange

protected abstract void fireChange(Feature[] features,
                                   int type)
To let listeners know that something has changed.


fireChange

protected void fireChange(Feature feature,
                          int type)

fireChange

protected void fireChange(java.util.Collection coll,
                          int type)

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
Gets the bounding box for the features in this feature collection.

Returns:
the envelope of the geometries contained by this feature collection.

getFeatureType

public abstract FeatureType getFeatureType()

getChildFeatureType

public abstract FeatureType getChildFeatureType()

getId

public abstract java.lang.String getId()

getParent

public FeatureCollection getParent()

setParent

public void setParent(FeatureCollection parent)

getAttributes

public java.lang.Object[] getAttributes(java.lang.Object[] attributes)

getAttribute

public java.lang.Object getAttribute(java.lang.String xPath)
Not really interested yet ..


getAttribute

public java.lang.Object getAttribute(int index)

setAttribute

public void setAttribute(int position,
                         java.lang.Object val)
                  throws IllegalAttributeException,
                         java.lang.ArrayIndexOutOfBoundsException
Throws:
IllegalAttributeException
java.lang.ArrayIndexOutOfBoundsException

getNumberOfAttributes

public int getNumberOfAttributes()

setAttribute

public void setAttribute(java.lang.String xPath,
                         java.lang.Object attribute)
                  throws IllegalAttributeException
Throws:
IllegalAttributeException

getDefaultGeometry

public com.vividsolutions.jts.geom.Geometry getDefaultGeometry()

setDefaultGeometry

public void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
                        throws IllegalAttributeException
Throws:
IllegalAttributeException

fids

public static java.util.Set fids(java.util.Collection stuff)
Get the set of fids for the provided collection.

By doing a quick pass through the collection we can do comparisons based on Feature ID (rather then collection membership).

A subclass that tracks its FID information may wish to override this method.


isFeatures

public static boolean isFeatures(java.util.Collection stuff)
Test if collection is all features!



Copyright © GeoTools. All Rights Reserved.