org.geotools.filter
Class AreaFunction

Object
  extended by ExpressionAbstract
      extended by DefaultExpression
          extended by FunctionExpressionImpl
              extended by AreaFunction
All Implemented Interfaces:
Factory, ExpressionType, FunctionExpression, Expression, Function

public class AreaFunction
extends FunctionExpressionImpl

Author:
James
Module:

Field Summary
 
Fields inherited from class FunctionExpressionImpl
fallback, name, params
 
Fields inherited from class DefaultExpression
expressionType, permissiveConstruction
 
Fields inherited from interface ExpressionType
ATTRIBUTE, ATTRIBUTE_DOUBLE, ATTRIBUTE_GEOMETRY, ATTRIBUTE_INTEGER, ATTRIBUTE_STRING, ATTRIBUTE_UNDECLARED, FUNCTION, LITERAL_DOUBLE, LITERAL_GEOMETRY, LITERAL_INTEGER, LITERAL_LONG, LITERAL_STRING, LITERAL_UNDECLARED, MATH_ADD, MATH_DIVIDE, MATH_MULTIPLY, MATH_SUBTRACT
 
Fields inherited from interface Expression
NIL
 
Fields inherited from interface Expression
NIL
 
Constructor Summary
AreaFunction()
          Creates a new instance of AreaFunction
 
Method Summary
 Object evaluate(Object feature)
          This method checks if the object is an instance of Feature and if so, calls through to #evaluate(Feature).
 double getArea(Geometry geometry)
          Calculates and returns the area of the specified geometry.
protected  double getArea(GeometryCollection geometryCollection1)
          Returns the area of a GeometryCollection.
protected  double getArea(MultiPolygon multiPolygon)
          Returns the area of a MultiPolygon.
protected  double getArea(Polygon polygon)
          Returns the area of a Polygon.
 int getArgCount()
          Gets the number of arguments that are set.
 double getPerimeter(Geometry geometry)
          Calculates and returns the perimeter of the specified geometry.
protected  double getPerimeter(GeometryCollection geometryCollection)
          Returns.
protected  double getPerimeter(LineString lineString)
          Returns the perimeter of a LineString.
protected  double getPerimeter(MultiLineString multiLineString)
          Returns the perimeter of a MultiLineString.
protected  double getperimeter(MultiPolygon multiPolygon)
          Returns the perimeter of a MultiPolygon.
protected  double getPerimeter(Polygon polygon)
          Returns the perimeter of a Polygon.
 
Methods inherited from class FunctionExpressionImpl
accept, equals, getArgs, getExpression, getFallbackValue, getImplementationHints, getName, getParameters, getType, setArgs, setFallbackValue, setName, setParameters, toString
 
Methods inherited from class DefaultExpression
accept, evaluate, getValue, isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression, isMathExpression
 
Methods inherited from class ExpressionAbstract
eval, eval, evaluate
 
Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Expression
accept, evaluate, getValue
 
Methods inherited from interface Expression
evaluate
 
Methods inherited from interface Expression
evaluate
 

Constructor Detail

AreaFunction

public AreaFunction()
Creates a new instance of AreaFunction

Method Detail

evaluate

public Object evaluate(Object feature)
Description copied from class: DefaultExpression
This method checks if the object is an instance of Feature and if so, calls through to #evaluate(Feature). This is done to maintain backwards compatability with previous version of Expression api which depended on Feature. If the object is not an instance of feature the super implementation is called.

Specified by:
evaluate in interface Expression
Overrides:
evaluate in class DefaultExpression

getArgCount

public int getArgCount()
Description copied from class: FunctionExpressionImpl
Gets the number of arguments that are set.

Specified by:
getArgCount in interface FunctionExpression
Specified by:
getArgCount in class FunctionExpressionImpl
Returns:
the number of args.

getArea

protected double getArea(GeometryCollection geometryCollection1)
Returns the area of a GeometryCollection.

Parameters:
geometryCollection1 - The GeometryCollection for which the area is calulated.
Returns:
The total area of all geometries in the collection.

getPerimeter

protected double getPerimeter(GeometryCollection geometryCollection)
Returns.

Parameters:
geometryCollection - The GeometryCollection for which the perimeter is calulated.
Returns:
the perimeter of a GeometryCollection.

getArea

public double getArea(Geometry geometry)
Calculates and returns the area of the specified geometry.
For Polygons, this is the total area inside the external ring less the total of any contained by interior rings. GeometryCollections (including MultiPolygons) are iterated through so the result is the sum of all polygons anywhere within the collection. Any geometry other than Polgyon or a collection returns 0;

Parameters:
geometry - The Geometry to calculate the area of.
Returns:
The total area of the Geometry.

getPerimeter

public double getPerimeter(Geometry geometry)
Calculates and returns the perimeter of the specified geometry.
For Polygons, this is the total length of the exterior ring and all internal rings. For LineStrings the total line length is returned. GeometryCollections are iterated through so the result is the sum of all Polygon and Line geometries anywhere within the collection. Any point geometries return a value of 0;

Parameters:
geometry - The Geometry to calculate the area of.
Returns:
The total area of the Geometry.

getArea

protected double getArea(MultiPolygon multiPolygon)
Returns the area of a MultiPolygon.

Parameters:
multiPolygon - the MultiPolygon for which the area is calculated.
Returns:
Total area of all polygons in multiPolygon.

getperimeter

protected double getperimeter(MultiPolygon multiPolygon)
Returns the perimeter of a MultiPolygon.

Parameters:
multiPolygon - the MultiPolygon for which the perimeter is calculated.
Returns:
Total perimeter of all polygons in the multiPolygon.

getArea

protected double getArea(Polygon polygon)
Returns the area of a Polygon.

Parameters:
polygon - the Polygon for which the area is calculated.
Returns:
The area of the polygon.

getPerimeter

protected double getPerimeter(Polygon polygon)
Returns the perimeter of a Polygon.

Parameters:
polygon - the Polygon for which the perimeter is calculated.
Returns:
The perimeter of the polygon.

getPerimeter

protected double getPerimeter(MultiLineString multiLineString)
Returns the perimeter of a MultiLineString.

Parameters:
multiLineString - the MultiLineString for which the perimeter is calculated.
Returns:
the total perimter (length) of the lines in multiLineString.

getPerimeter

protected double getPerimeter(LineString lineString)
Returns the perimeter of a LineString.

Parameters:
lineString - the LineString for which the perimeter is calculated.
Returns:
the perimeter (length) of the lineString.


Copyright © 1996-2009 Geotools. All Rights Reserved.