Class PolygonImpl

java.lang.Object
org.openspaces.spatial.shapes.impl.PolygonImpl
All Implemented Interfaces:
Externalizable, Serializable, Polygon, Shape, Spatial4jShapeProvider

public class PolygonImpl extends Object implements Polygon, Spatial4jShapeProvider, Externalizable
Since:
11.0
Author:
Yohana Khoury
See Also:
  • Constructor Details

    • PolygonImpl

      public PolygonImpl()
    • PolygonImpl

      public PolygonImpl(Point[] points)
  • Method Details

    • getNumOfPoints

      public int getNumOfPoints()
      Description copied from interface: Polygon
      Returns the number of points within the polygon
      Specified by:
      getNumOfPoints in interface Polygon
      Returns:
      The number of points within the polygon
    • getX

      public double getX(int index)
      Description copied from interface: Polygon
      Gets the X coordinate of the point in the specified index.
      Specified by:
      getX in interface Polygon
    • getY

      public double getY(int index)
      Description copied from interface: Polygon
      Gets the Y coordinate of the point in the specified index.
      Specified by:
      getY in interface Polygon
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(ShapeFormat shapeFormat)
      Description copied from interface: Shape
      Returns a string representation of the shape using the specified format.
      Specified by:
      toString in interface Shape
      Parameters:
      shapeFormat - The format which will be used to format the shape.
      Returns:
      A string representation of the shape.
    • appendTo

      public StringBuilder appendTo(StringBuilder stringBuilder, ShapeFormat shapeFormat)
      Description copied from interface: Shape
      Appends a string representation of the shape using the specified format
      Specified by:
      appendTo in interface Shape
      Parameters:
      stringBuilder - The string builder to append to
      shapeFormat - The format which will be used to format the shape
      Returns:
      The string builder
    • getSpatial4jShape

      public org.locationtech.spatial4j.shape.Shape getSpatial4jShape(org.locationtech.spatial4j.context.SpatialContext spatialContext)
      Description copied from interface: Spatial4jShapeProvider
      Gets a Spatial4j shape from the current object
      Specified by:
      getSpatial4jShape in interface Spatial4jShapeProvider
      Parameters:
      spatialContext - The SpatialContext which will be used to construct the shape, if needed.
      Returns:
      A Spatial4j shape
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException