Class Polygon

All Implemented Interfaces:
Serializable

public class Polygon extends MultiPath implements Serializable
A polygon is a collection of one or many interior or exterior rings.
See Also:
  • Field Details

  • Constructor Details

    • Polygon

      public Polygon()
      Creates a polygon.
    • Polygon

      public Polygon(VertexDescription vd)
  • Method Details

    • createInstance

      public Geometry createInstance()
      Description copied from class: Geometry
      Creates an instance of an empty geometry of the same type.
      Specified by:
      createInstance in class Geometry
      Returns:
      The new instance.
    • getDimension

      public int getDimension()
      Description copied from class: Geometry
      Returns the topological dimension of the geometry object based on the geometry's type.

      Returns 0 for point and multipoint.

      Returns 1 for lines and polylines.

      Returns 2 for polygons and envelopes

      Returns 3 for objects with volume

      Specified by:
      getDimension in class Geometry
      Returns:
      Returns the integer value of the dimension of geometry.
    • getType

      public Geometry.Type getType()
      Description copied from class: Geometry
      Returns the geometry type.
      Specified by:
      getType in class Geometry
      Returns:
      Returns the geometry type.
    • estimateMemorySize

      public long estimateMemorySize()
      Description copied from class: Geometry
      Returns an estimate of this object size in bytes.

      This estimate doesn't include the size of the VertexDescription object because instances of VertexDescription are shared among geometry objects.

      Specified by:
      estimateMemorySize in class Geometry
      Returns:
      Returns an estimate of this object size in bytes.
    • calculateRingArea2D

      public double calculateRingArea2D(int ringIndex)
      Calculates the ring area for this ring.
      Parameters:
      ringIndex - The index of this ring.
      Returns:
      The ring area for this ring.
    • isExteriorRing

      public boolean isExteriorRing(int partIndex)
      Returns TRUE if the ring is an exterior ring. Valid only for simple polygons.
    • equals

      public boolean equals(Object other)
      Returns TRUE when this geometry has exactly same type, properties, and coordinates as the other geometry.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code value for this polygon.
      Overrides:
      hashCode in class MultiPath
    • setXY

      public void setXY(int i, double x, double y)
      Sets a new vertex for the polygon.
      Parameters:
      i - The index of the new vertex.
      x - The X coordinate for the new vertex.
      y - The Y coordinate for the new vertex.
    • interpolateAttributes

      public void interpolateAttributes(int path_index, int from_point_index, int to_point_index)
    • interpolateAttributes

      public void interpolateAttributes(int semantics, int path_index, int from_point_index, int to_point_index)
    • getExteriorRingCount

      public int getExteriorRingCount()
    • setFillRule

      public void setFillRule(int rule)
      Fill rule for the polygon that defines the interior of the self intersecting polygon. It affects the Simplify operation. Can be use by drawing code to pass around the fill rule of graphic path. This property is not persisted in any format yet. See also Polygon.FillRule.
    • getFillRule

      public int getFillRule()
      Fill rule for the polygon that defines the interior of the self intersecting polygon. It affects the Simplify operation. Changing the fill rule on the polygon that has no self intersections has no physical effect. Can be use by drawing code to pass around the fill rule of graphic path. This property is not persisted in any format yet. See also Polygon.FillRule.