Class CoastOverlay

All Implemented Interfaces:
Serializable, Cloneable, Comparable

public class CoastOverlay extends PolygonOverlay

A CoastOverlay annotates an earth data view with coast lines and polygons. The coast lines are rendered using GSHHS coast line vector data (see BinnedGSHHSReader and BinnedGSHHSReaderFactory). The resolution of the rendered earth vector data is based on the view resolution at the time of rendering. The resolution of the view is taken to be the number of kilometers per pixel at the view center point. In order to help reduce the rendering time and keep the view clear of unwanted coast line "dust", by default small polygons such as the coasts of islands and lakes enclosing less than 3x3 pixels are not rendered.

The overlay color and fill color are used to determine if coast lines and/or polygons should be rendered. If the overlay color is set to null, the coast lines are not rendered. Likewise if the fill color is set to null, land polygons are not rendered. By default the fill color is set to null.

The default reader factory for coastline data is a standard BinnedGSHHSReaderFactory unless the setReaderFactory(noaa.coastwatch.render.feature.BinnedGSHHSReaderFactory) method is called.

Since:
3.1.1
Author:
Peter Hollemans
See Also:
  • Constructor Details

    • CoastOverlay

      public CoastOverlay(Color color, int layer, Stroke stroke, Color fillColor)
      Constructs a new coast overlay.
      Parameters:
      color - the overlay color.
      layer - the overlay layer number.
      stroke - the stroke to use for vector paths.
      fillColor - the fill color to use for polygon fills.
    • CoastOverlay

      public CoastOverlay(Color color)
      Constructs a new coast overlay. The layer number is initialized to 0, the stroke to the default BasicStroke, and the fill color to null.
      Parameters:
      color - the overlay color.
  • Method Details

    • setReaderFactory

      public void setReaderFactory(BinnedGSHHSReaderFactory factory)
      Sets the read factory for new coastline readers.
    • setSmallPolygons

      public void setSmallPolygons(boolean flag)
      Sets the small polygons flag which determines if polygons smaller than 3x3 view pixels are rendered. By default small polygons are not rendered.
    • getSmallPolygons

      public boolean getSmallPolygons()
      Gets the small polygons flag.
    • setFillColor

      public void setFillColor(Color newColor)
      Sets the polygon fill color. This method overrides the parent to detect null/non-null changes in the polygon fill color.
      Overrides:
      setFillColor in class PolygonOverlay
      Parameters:
      newColor - the new opaque polygon fill color, or null to perform no filling.
    • prepare

      protected void prepare(Graphics2D g, EarthDataView view)
      Description copied from class: EarthDataOverlay
      Prepares the overlay graphics prior to drawing.
      Specified by:
      prepare in class EarthDataOverlay
      Parameters:
      g - the graphics object for drawing.
      view - the earth data view.
    • draw

      protected void draw(Graphics2D g, EarthDataView view)
      Description copied from class: EarthDataOverlay
      Draws the overlay graphics.
      Specified by:
      draw in class EarthDataOverlay
      Parameters:
      g - the graphics object for drawing.
      view - the earth data view.