Class ContourGenerator

All Implemented Interfaces:
Iterable<Feature>, FeatureSource

public class ContourGenerator extends LineFeatureSource
A contour generator creates lists of earth data points that follow lines of constant value in a gridded dataset. A contour generator may be used, for example, to create bathymetry or topographic contours from digital elevation model data, or to create contour lines from data in any 2D dataset.
Since:
3.1.7
Author:
Peter Hollemans
  • Constructor Details

    • ContourGenerator

      public ContourGenerator(Grid grid, EarthTransform trans)
      Creates a new contour generator based on data in the grid. Initially, no contours are available until a call to select() is made.
      Parameters:
      grid - the grid data for contouring.
      trans - the earth transform for the grid.
  • Method Details

    • setLevelNudge

      public void setLevelNudge(double nudge)
      Sets the level nudge value. The nudge value is used to nudge the contour levels specified via setLevels() so that limitations in the digitization accuracy do not appear as contour problems. For example, if a contour level of 20 is requested and the data takes on a value of exactly 20 in a group of adjacent grid locations, then strange contour levels can result, including thin polygons with no interior area and bullseye patterns. The default nudge value is 0.
      Parameters:
      nudge - the level nudge value.
      See Also:
    • setFastMode

      public void setFastMode(boolean flag)
      Sets the fast contouring mode flag. Under fast contouring mode, contours are generated as discontinuous line segments. If fast mode is off, contour segments are connected together as continuous lines as much as possible. This has the effect that the initial generation of contours is slower, but subsequent storage and conversion to screen coordinates is more efficient especially when repeated rendering is required. By default, fast contouring is off.
      Parameters:
      flag - the fast mode flag, true for fast contouring.
    • setLevels

      public void setLevels(double[] levels)
      Sets the contour levels to generate. By default, no levels are selected.
      Parameters:
      levels - the contour levels.
    • select

      protected void select() throws IOException
      Description copied from class: AbstractFeatureSource
      Selects a set of features from the data source based on the current area.
      Specified by:
      select in class AbstractFeatureSource
      Throws:
      IOException - if an error occurred accessing the data source.
    • getLevel

      public double getLevel(int index)
      Gets the contour level of the earth vector at the specified index.
      Parameters:
      index - the earth vector index.
      Returns:
      the contour level value for the specified vector.
      See Also: