public abstract class BinnedGSHHSReader extends PolygonFeatureSource
http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html
http://gmt.soest.hawaii.edu
Modifier and Type | Class and Description |
---|---|
class |
BinnedGSHHSReader.Bin
The bin class acts as a container for GSHHS shore segments.
|
Modifier and Type | Field and Description |
---|---|
protected short[] |
binInfo
The info for each bin.
|
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 |
segmentAreaID
The segment area ID.
|
protected int |
segmentInfoID
The segment info 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.
|
polygonList
area, featureList
Modifier | Constructor and Description |
---|---|
protected |
BinnedGSHHSReader()
Creates a new reader with no initialization.
|
|
BinnedGSHHSReader(java.lang.String name)
Creates a new binned GSHHS reader from the database file name.
|
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, binInfo,
and segmentStart.
|
double |
getMinArea()
Gets the minimum area used in polygon selection.
|
boolean |
getPolygonRendering()
Gets the polygon rendering flag.
|
protected void |
init(java.lang.String name)
Initializes this reader using the specified database.
|
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 |
setMinArea(double minArea)
Sets the minimum area used in polygon selection.
|
void |
setPolygonRendering(boolean flag)
Sets the polygon rendering flag.
|
polygonIterator, renderOutlines, renderPolygons
render
getArea, getAttributeCount, getAttributeNameMap, getAttributes, getFilter, iterator, select, setAttributes, setFilter
protected java.lang.String database
protected int sdID
protected int segmentInfoID
protected int segmentAreaID
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 short[] binInfo
protected int[] segmentStart
public BinnedGSHHSReader(java.lang.String name) throws java.io.IOException
name
- the database name. Several predefined database names
are available using the constants in BinnedGSHHSReaderFactory
: HIGH
, INTER
,
LOW
, and CRUDE
. See the constants for
descriptions of the database resolutions.java.io.IOException
- if an error occurred reading the file.protected BinnedGSHHSReader()
public int getBinIndex(EarthLocation loc)
public void setMinArea(double minArea)
minArea
- the minimum area in km^2. Negative values disable
filtering by minimum area.public double getMinArea()
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.public void setPolygonRendering(boolean flag)
select()
method is called, thus no polygons are ever rendered. When on,
the select()
call causes a set of polygons to be
created from segment data, which may then be rendered via a call
to renderPolygons()
.public boolean getPolygonRendering()
setPolygonRendering(boolean)
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
BinnedGSHHSReader(String)
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 int getBins()
public java.util.Collection getBinIndices(EarthArea area)
area
- the earth area.Integer
objects.public java.lang.String getDatabase()