Package noaa.coastwatch.render.feature
Class BinnedGSHHSLineReader
java.lang.Object
noaa.coastwatch.render.feature.AbstractFeatureSource
noaa.coastwatch.render.feature.LineFeatureSource
noaa.coastwatch.render.feature.BinnedGSHHSLineReader
- All Implemented Interfaces:
Iterable<Feature>,FeatureSource
- Direct Known Subclasses:
HDFGSHHSLineReader,OpendapGSHHSLineReader
The BinnedGSHHSLineReader class reads Global
Self-consistent Hierarchical High-resolution Shorelines
(GSHHS) border and river data in the binned format provided
with the Generic Mapping Tools (GMT). For source code and
data files, see:
http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html
http://gmt.soest.hawaii.edu
- Since:
- 3.2.1
- Author:
- Peter Hollemans
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe bin class acts as a container for GSHHS segments. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleThe bin size in degrees.protected StringThe database name.protected intThe relative longitude point ID.protected intThe relative latitude point ID.protected int[]The index of the first segment in each bin.protected intThe number of bins in the latitude direction.protected intThe number of bins in the longitude direction.protected doubleThe multiplier for converting scaled segment units to degrees.protected short[]The number of segments in each bin.protected intThe database ID.protected intThe segment level ID.protected intThe segment points ID.protected int[]The starting point for each segment.protected intThe total number of bins.protected intThe total number of points.protected intThe total number of segments.Fields inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
area, featureList -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new reader with no initialization. -
Method Summary
Modifier and TypeMethodDescriptionintgetBinIndex(EarthLocation loc) Gets a bin index using the specified earth location.getBinIndices(EarthArea area) Gets the bin indices containing the specified earth area.intgetBins()Gets the total number of bins.Gets the database name currently being used for selection.protected abstract voidReads data about the entire file, including binSize, multiplier, lonBins, latBins, totalBins, firstSegment, numSegments, and segmentStart.protected voidInitializes this reader using the specified database.iterator()Gets an iterator over all selected features.protected abstract intOpens the data file and returns the file ID.protected abstract voidReads data for the specified variable ID.protected abstract voidReads data for the specified variable name.protected voidselect()Selects a set of features from the data source based on the current area.protected abstract intselectData(String var) Gets the variable ID for the specified variable.protected voidsetBinHint(int index) Sets a hint that subsequent bin data access is about to occur.protected voidsetBinListHint(List indexList) Sets a hint that subsequent bin data access is about to occur for a list of bins.voidsetLevelRange(int minLevel, int maxLevel) Sets the hierarchical level range useds in line segment rendering.Methods inherited from class noaa.coastwatch.render.feature.LineFeatureSource
renderMethods inherited from class noaa.coastwatch.render.feature.AbstractFeatureSource
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, select, setAttributes, setFilterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
database
The database name. -
sdID
protected int sdIDThe database ID. -
segmentLevelID
protected int segmentLevelIDThe segment level ID. -
segmentPointsID
protected int segmentPointsIDThe segment points ID. -
dxID
protected int dxIDThe relative longitude point ID. -
dyID
protected int dyIDThe relative latitude point ID. -
multiplier
protected double multiplierThe multiplier for converting scaled segment units to degrees. -
binSize
protected double binSizeThe bin size in degrees. -
lonBins
protected int lonBinsThe number of bins in the longitude direction. -
latBins
protected int latBinsThe number of bins in the latitude direction. -
totalBins
protected int totalBinsThe total number of bins. -
totalPoints
protected int totalPointsThe total number of points. -
totalSegments
protected int totalSegmentsThe total number of segments. -
firstSegment
protected int[] firstSegmentThe index of the first segment in each bin. -
numSegments
protected short[] numSegmentsThe number of segments in each bin. -
segmentStart
protected int[] segmentStartThe starting point for each segment.
-
-
Constructor Details
-
BinnedGSHHSLineReader
protected BinnedGSHHSLineReader()Creates a new reader with no initialization.
-
-
Method Details
-
getBinIndex
Gets a bin index using the specified earth location. -
setLevelRange
public void setLevelRange(int minLevel, int maxLevel) Sets the hierarchical level range useds in line segment rendering. By default all line segments are rendered, regardless of level.- Parameters:
minLevel- the maximum hierarchical level.maxLevel- the maximum hierarchical level.
-
readData
protected abstract void readData(int sdsid, int[] start, int[] count, Object data) throws IOException Reads data for the specified variable ID.- Parameters:
sdsid- the identifier for the variable.start- the starting data index for reading.count- the number of data values to read.data- the data array to fill with values.- Throws:
IOException- if an error occurred reading the data.
-
readData
protected abstract void readData(String var, int[] start, int[] count, Object data) throws IOException Reads data for the specified variable name.- Parameters:
var- the name of the variable.start- the starting data index for reading.count- the number of data values to read.data- the data array to fill with values.- Throws:
IOException- if an error occurred reading the data.
-
selectData
Gets the variable ID for the specified variable.- Parameters:
var- the variable name to retrieve an ID.- Returns:
- the variable ID.
- Throws:
IOException- if an error occurred retrieving the ID.
-
openFile
Opens the data file and returns the file ID.- Parameters:
name- the data file name.- Throws:
IOException- if an error occurred opening the file.
-
getGlobalData
Reads data about the entire file, including binSize, multiplier, lonBins, latBins, totalBins, firstSegment, numSegments, and segmentStart.- Throws:
IOException- if an error occurred reading the data.
-
init
Initializes this reader using the specified database.- Throws:
IOException- See Also:
-
setBinListHint
Sets a hint that subsequent bin data access is about to occur for a list of bins. This may be used by child classes to increase the speed of bin data access.- Parameters:
indexList- the list of bin indices to be accessed sorted in increasing order.
-
setBinHint
protected void setBinHint(int index) Sets a hint that subsequent bin data access is about to occur. This may be used by child classes to increase the speed of bin data access.- Parameters:
index- the bin that data access will be performed for next.
-
select
Description copied from class:AbstractFeatureSourceSelects a set of features from the data source based on the current area.- Specified by:
selectin classAbstractFeatureSource- Throws:
IOException- if an error occurred accessing the data source.
-
iterator
Description copied from interface:FeatureSourceGets an iterator over all selected features.- Specified by:
iteratorin interfaceFeatureSource- Specified by:
iteratorin interfaceIterable<Feature>- Overrides:
iteratorin classAbstractFeatureSource
-
getBins
public int getBins()Gets the total number of bins. -
getBinIndices
Gets the bin indices containing the specified earth area.- Parameters:
area- the earth area.- Returns:
- a collection of bin indices as
Integerobjects.
-
getDatabase
Gets the database name currently being used for selection.
-