Class AreaFunction

All Implemented Interfaces:
Expression, Function, FunctionExpression, Factory

public class AreaFunction extends FunctionExpressionImpl
Area of provided geometry.
Author:
James
  • Field Details

  • Constructor Details

    • AreaFunction

      public AreaFunction()
      Creates a new instance of AreaFunction
  • Method Details

    • evaluate

      public Object evaluate(Object feature)
      Description copied from class: ExpressionAbstract
      Subclass should override, default implementation returns null.
      Specified by:
      evaluate in interface Expression
      Overrides:
      evaluate in class FunctionExpressionImpl
      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.