Package noaa.coastwatch.render
Class ContourGenerator
java.lang.Object
noaa.coastwatch.render.feature.AbstractFeatureSource
noaa.coastwatch.render.feature.LineFeatureSource
noaa.coastwatch.render.ContourGenerator
- All Implemented Interfaces:
Iterable<Feature>
,FeatureSource
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
-
Field Summary
Fields inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
area, featureList
-
Constructor Summary
ConstructorDescriptionContourGenerator
(Grid grid, EarthTransform trans) Creates a new contour generator based on data in the grid. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getLevel
(int index) Gets the contour level of the earth vector at the specified index.protected void
select()
Selects a set of features from the data source based on the current area.void
setFastMode
(boolean flag) Sets the fast contouring mode flag.void
setLevelNudge
(double nudge) Sets the level nudge value.void
setLevels
(double[] levels) Sets the contour levels to generate.Methods inherited from class noaa.coastwatch.render.feature.LineFeatureSource
render
Methods inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, iterator, select, setAttributes, setFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ContourGenerator
Creates a new contour generator based on data in the grid. Initially, no contours are available until a call toselect()
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 viasetLevels()
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
Description copied from class:AbstractFeatureSource
Selects a set of features from the data source based on the current area.- Specified by:
select
in classAbstractFeatureSource
- 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:
-