org.geotools.process.feature
Class AbstractFeatureCollectionProcess

Object
  extended by AbstractFeatureCollectionProcess
All Implemented Interfaces:
Process
Direct Known Subclasses:
BufferFeatureCollectionProcess

public abstract class AbstractFeatureCollectionProcess
extends Object
implements Process

Abstract implementation of Process for feature collections.

Subclasses need to implement processFeature(SimpleFeature, Map). This method should perform the operation on the feature, changing any attributes on the feature in as necessary.

Since:
2.6
Author:
Justin Deoliveira, OpenGEO
See Also:
AbstractFeatureCollectionProcessFactory

Constructor Summary
AbstractFeatureCollectionProcess()
           
 
Method Summary
 Map<String,Object> execute(Map<String,Object> input, ProgressListener monitor)
          Execute this process with the provided inputs.
protected abstract  void processFeature(SimpleFeature feature, Map<String,Object> input)
          Performs an operation on a single feature in the collection.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFeatureCollectionProcess

public AbstractFeatureCollectionProcess()
Method Detail

execute

public final Map<String,Object> execute(Map<String,Object> input,
                                        ProgressListener monitor)
Description copied from interface: Process
Execute this process with the provided inputs.

Specified by:
execute in interface Process
Parameters:
input - Input parameters for this process
monitor - listener for handling the progress of the process
Returns:
Map of results, (@see ProcessFactory for details), or null if canceled

processFeature

protected abstract void processFeature(SimpleFeature feature,
                                       Map<String,Object> input)
                                throws Exception
Performs an operation on a single feature in the collection.

This method should do some work based on the feature and then set any attributes on the feature as necessary. Example of a simple buffering operation:

 protected void processFeature(SimpleFeature feature, Map input) throws Exception {
    Double buffer = (Double) input.get( BufferFeatureCollectionFactory.BUFFER.key );

    Geometry g = (Geometry) feature.getDefaultGeometry();
    g = g.buffer( buffer );

    feature.setDefaultGeometry( g );
 }
 

Parameters:
feature -
input -
Throws:
Exception


Copyright © 1996-2009 Geotools. All Rights Reserved.