Package org.geotools.filter
Class AreaFunction
- Object
-
- ExpressionAbstract
-
- DefaultExpression
-
- FunctionExpressionImpl
-
- AreaFunction
-
- All Implemented Interfaces:
Expression
,Function
,FunctionExpression
,Factory
public class AreaFunction extends FunctionExpressionImpl
Area of provided geometry.- Author:
- James
-
-
Field Summary
Fields Modifier and Type Field Description static FunctionName
NAME
-
Fields inherited from class FunctionExpressionImpl
fallback, functionName, name, params
-
Fields inherited from interface Expression
NIL
-
-
Constructor Summary
Constructors Constructor Description AreaFunction()
Creates a new instance of AreaFunction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
evaluate(Object feature)
Subclass should override, default implementation returns null.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.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.protected double
getperimeter(MultiPolygon multiPolygon)
Returns the perimeter of a MultiPolygon.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.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(Polygon polygon)
Returns the perimeter of a Polygon.-
Methods inherited from class FunctionExpressionImpl
accept, equals, functionName, getExpression, getFallbackValue, getFunctionName, getImplementationHints, getName, getParameters, hashCode, setFallbackValue, setParameters, toString
-
Methods inherited from class DefaultExpression
isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
-
Methods inherited from class ExpressionAbstract
evaluate
-
Methods inherited from interface Expression
evaluate
-
-
-
-
Field Detail
-
NAME
public static FunctionName NAME
-
-
Method Detail
-
evaluate
public Object evaluate(Object feature)
Description copied from class:ExpressionAbstract
Subclass should override, default implementation returns null.- Specified by:
evaluate
in interfaceExpression
- Overrides:
evaluate
in classFunctionExpressionImpl
- Returns:
- default implementation returns null
-
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.
-
-