Class PolygonFeature

All Implemented Interfaces:
Iterable<EarthLocation>, Feature

public class PolygonFeature extends LineFeature
The PolygonFeature class is a LineFeature with extra properties and rendering algorithms specific to polygons. Polygons are rendered as filled where as lines are rendered as a series of segments only. Polygons have an inherent winding direction which may be used to determine what is inside the polygon and what is outside. The winding direction is not used by the rendering algorithm, but rather is a convenience for the user so that polygons of different winding directions may be grouped together but treated differently depending on their direction.
Since:
3.1.4
Author:
Peter Hollemans
  • Field Details

    • CLOCKWISE

      public static final int CLOCKWISE
      The clockwise winding direction.
      See Also:
    • COUNTER_CLOCKWISE

      public static final int COUNTER_CLOCKWISE
      The counter-clockwise winding direction.
      See Also:
  • Constructor Details

    • PolygonFeature

      public PolygonFeature(int direction)
      Creates a new empty polygon feature with no attributes.
      Parameters:
      direction - the winding direction, either clockwise or counter-clockwise.
    • PolygonFeature

      public PolygonFeature(int direction, Object[] attributeArray)
      Creates a new empty polygon feature with attributes.
      Parameters:
      direction - the winding direction, either clockwise or counter-clockwise.
      attributeArray - the array of feature attributes.
  • Method Details

    • getDirection

      public int getDirection()
      Gets the winding direction.
    • renderOutline

      public void renderOutline(Graphics2D g, EarthImageTransform trans)
      Renders the outline of this polygon feature to a graphics context. This method allows the user to render the polygon as if it was line data with no filling applied. It simply calls the overridden LineFeature.render(java.awt.Graphics2D, noaa.coastwatch.render.EarthImageTransform) method.
      Parameters:
      g - the graphics context for drawing.
      trans - the earth image transform for converting Earth locations to image points.
    • transform

      public GeneralPath transform(EarthImageTransform imageTrans)
      Description copied from class: LineFeature
      Transforms this line feature to a path. The EarthImageTransform is used to eliminate any line segments which do not transform to valid image points.
      Overrides:
      transform in class LineFeature
      Parameters:
      imageTrans - the transform for converting earth locations to image points.
      Returns:
      the path that follows this feature's points in the transformed space.
    • render

      public void render(Graphics2D g, EarthImageTransform trans)
      Description copied from class: LineFeature
      Renders this feature to a graphics context.
      Overrides:
      render in class LineFeature
      Parameters:
      g - the graphics context for drawing.
      trans - the earth image transform for converting Earth locations to image points.