public abstract class BinnedGSHHSLineReader extends LineFeatureSource
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
Modifier and Type | Class and Description |
---|---|
class |
BinnedGSHHSLineReader.Bin
The bin class acts as a container for GSHHS segments.
|
Modifier and Type | Field and Description |
---|---|
protected double |
binSize
The bin size in degrees.
|
protected java.lang.String |
database
The database name.
|
protected int |
dxID
The relative longitude point ID.
|
protected int |
dyID
The relative latitude point ID.
|
protected int[] |
firstSegment
The index of the first segment in each bin.
|
protected int |
latBins
The number of bins in the latitude direction.
|
protected int |
lonBins
The number of bins in the longitude direction.
|
protected double |
multiplier
The multiplier for converting scaled segment units to degrees.
|
protected short[] |
numSegments
The number of segments in each bin.
|
protected int |
sdID
The database ID.
|
protected int |
segmentLevelID
The segment level ID.
|
protected int |
segmentPointsID
The segment points ID.
|
protected int[] |
segmentStart
The starting point for each segment.
|
protected int |
totalBins
The total number of bins.
|
protected int |
totalPoints
The total number of points.
|
protected int |
totalSegments
The total number of segments.
|
area, featureList
Modifier | Constructor and Description |
---|---|
protected |
BinnedGSHHSLineReader()
Creates a new reader with no initialization.
|
Modifier and Type | Method and Description |
---|---|
int |
getBinIndex(EarthLocation loc)
Gets a bin index using the specified earth location.
|
java.util.Collection |
getBinIndices(EarthArea area)
Gets the bin indices containing the specified earth area.
|
int |
getBins()
Gets the total number of bins.
|
java.lang.String |
getDatabase()
Gets the database name currently being used for selection.
|
protected abstract void |
getGlobalData()
Reads data about the entire file, including binSize,
multiplier, lonBins, latBins, totalBins, firstSegment,
numSegments, and segmentStart.
|
protected void |
init(java.lang.String name)
Initializes this reader using the specified database.
|
java.util.Iterator |
iterator()
Gets an iterator over all selected features.
|
protected abstract int |
openFile(java.lang.String name)
Opens the data file and returns the file ID.
|
protected abstract void |
readData(int sdsid,
int[] start,
int[] count,
java.lang.Object data)
Reads data for the specified variable ID.
|
protected abstract void |
readData(java.lang.String var,
int[] start,
int[] count,
java.lang.Object data)
Reads data for the specified variable name.
|
protected void |
select()
Selects a set of features from the data source based on the
current area.
|
protected abstract int |
selectData(java.lang.String var)
Gets the variable ID for the specified variable.
|
protected void |
setBinHint(int index)
Sets a hint that subsequent bin data access is about to occur.
|
protected void |
setBinListHint(java.util.List indexList)
Sets a hint that subsequent bin data access is about to occur for
a list of bins.
|
void |
setLevelRange(int minLevel,
int maxLevel)
Sets the hierarchical level range useds in line segment
rendering.
|
render
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, select, setAttributes, setFilter
protected java.lang.String database
protected int sdID
protected int segmentLevelID
protected int segmentPointsID
protected int dxID
protected int dyID
protected double multiplier
protected double binSize
protected int lonBins
protected int latBins
protected int totalBins
protected int totalPoints
protected int totalSegments
protected int[] firstSegment
protected short[] numSegments
protected int[] segmentStart
protected BinnedGSHHSLineReader()
public int getBinIndex(EarthLocation loc)
public void setLevelRange(int minLevel, int maxLevel)
minLevel
- the maximum hierarchical level.maxLevel
- the maximum hierarchical level.protected abstract void readData(int sdsid, int[] start, int[] count, java.lang.Object data) throws java.io.IOException
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.java.io.IOException
- if an error occurred reading the data.protected abstract void readData(java.lang.String var, int[] start, int[] count, java.lang.Object data) throws java.io.IOException
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.java.io.IOException
- if an error occurred reading the data.protected abstract int selectData(java.lang.String var) throws java.io.IOException
var
- the variable name to retrieve an ID.java.io.IOException
- if an error occurred retrieving the ID.protected abstract int openFile(java.lang.String name) throws java.io.IOException
name
- the data file name.java.io.IOException
- if an error occurred opening the file.protected abstract void getGlobalData() throws java.io.IOException
java.io.IOException
- if an error occurred reading the data.protected void init(java.lang.String name) throws java.io.IOException
java.io.IOException
BinnedGSHHSReaderFactory.getDatabaseName(int, int)
protected void setBinListHint(java.util.List indexList)
indexList
- the list of bin indices to be accessed sorted in
increasing order.protected void setBinHint(int index)
index
- the bin that data access will be performed for next.protected void select() throws java.io.IOException
AbstractFeatureSource
select
in class AbstractFeatureSource
java.io.IOException
- if an error occurred accessing the data source.public java.util.Iterator iterator()
FeatureSource
iterator
in interface java.lang.Iterable<Feature>
iterator
in interface FeatureSource
iterator
in class AbstractFeatureSource
public int getBins()
public java.util.Collection getBinIndices(EarthArea area)
area
- the earth area.Integer
objects.public java.lang.String getDatabase()