Package mccombe.terrain
Class DEMReader
- java.lang.Object
-
- java.beans.PropertyChangeSupport
-
- mccombe.terrain.DEMReader
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SRTM2Reader
,SRTM3Reader
public abstract class DEMReader extends java.beans.PropertyChangeSupport
DEMReader - an abstract base class for readers of various forms of Digital Elevation Model data sets- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DEMReader.CacheEntry
CacheEntry -- A class used to store a row of values
-
Field Summary
Fields Modifier and Type Field Description protected static int
BUFFERLENGTH
protected java.util.HashMap<java.lang.String,DEMReader.CacheEntry>
cache
protected boolean
cacheEnable
protected java.lang.String[]
copyright
protected long
cycle
protected java.lang.String
DIRECTORY
protected boolean
download
protected long
hits
protected static java.util.zip.ZipInputStream
in
protected java.lang.String
lastMessage
protected int
lastValue
protected static java.util.Locale
LOCALE
protected static int
MAX_CACHE_SIZE
protected long
missing
protected static double
MISSING
protected long
resultcount
protected long
tries
protected boolean
useLegacy
-
Constructor Summary
Constructors Modifier Constructor Description protected
DEMReader(javax.swing.JComponent item)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String[]
copyright()
abstract java.lang.String
datasetName()
abstract boolean
downloadable()
protected void
downloadFile(java.lang.String filename)
Download a specific file and sand save it in scratch space on the local machineabstract java.lang.String
extn()
abstract java.lang.String
formatstring()
double
frac(int tile)
Calculate the proportion of a degree represented by a particular element in the bufferprotected java.lang.String
getDownloadSiteName()
double
getHeight(LatLong place)
protected java.lang.String
getProperty(TerrainProperties propertyName)
java.beans.PropertyChangeListener[]
getPropertyChangeListeners()
protected DEMReader.CacheEntry
getRow(java.lang.String name, int ytile)
long
hits()
static double
lagrangian(double x, java.awt.geom.Point2D.Double... points)
Fit an exact polynomial to a set of points and return its value at a specified pointabstract boolean
littleendian()
protected java.lang.String
makename(java.lang.String ns, double lat, java.lang.String ew, double lon)
long
missing()
abstract int
missingValue()
java.lang.String
numEntryName(java.lang.String name)
byte[]
readByteRecord()
Read the next byte record from the current ZipInputStreamint[]
readRecord()
Read the next record from the current ZipInputStreamabstract int
recordlength()
void
resetCounts()
long
resultcount()
void
setDownload(boolean flag)
protected void
setMessage(java.lang.String msg)
protected void
setProgress(int val)
double
tile(double x)
Calculate the number of the element in the buffer that refers to a particular lat or lon valuelong
tries()
java.lang.String
zipEntryName(java.lang.String name)
-
Methods inherited from class java.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
in
protected static java.util.zip.ZipInputStream in
-
DIRECTORY
protected java.lang.String DIRECTORY
-
cycle
protected long cycle
-
cache
protected java.util.HashMap<java.lang.String,DEMReader.CacheEntry> cache
-
cacheEnable
protected boolean cacheEnable
-
MAX_CACHE_SIZE
protected static final int MAX_CACHE_SIZE
- See Also:
- Constant Field Values
-
hits
protected long hits
-
tries
protected long tries
-
missing
protected long missing
-
resultcount
protected long resultcount
-
MISSING
protected static final double MISSING
- See Also:
- Constant Field Values
-
BUFFERLENGTH
protected static final int BUFFERLENGTH
- See Also:
- Constant Field Values
-
lastMessage
protected java.lang.String lastMessage
-
download
protected boolean download
-
lastValue
protected int lastValue
-
LOCALE
protected static final java.util.Locale LOCALE
-
useLegacy
protected boolean useLegacy
-
copyright
protected java.lang.String[] copyright
-
-
Constructor Detail
-
DEMReader
protected DEMReader(javax.swing.JComponent item) throws MissingDataFileException
- Throws:
MissingDataFileException
-
-
Method Detail
-
makename
protected java.lang.String makename(java.lang.String ns, double lat, java.lang.String ew, double lon)
-
getHeight
public double getHeight(LatLong place) throws MissingDataFileException
- Throws:
MissingDataFileException
-
getRow
protected DEMReader.CacheEntry getRow(java.lang.String name, int ytile) throws MissingDataFileException
- Throws:
MissingDataFileException
-
readRecord
public int[] readRecord() throws java.io.IOException
Read the next record from the current ZipInputStream- Returns:
- int[] buffer of length recordlength() containing the decoded next record;
- Throws:
java.io.IOException
-
readByteRecord
public byte[] readByteRecord() throws java.io.IOException
Read the next byte record from the current ZipInputStream- Returns:
- byte[] buffer of length recordlength() containing the decoded next record;
- Throws:
java.io.IOException
-
tile
public double tile(double x)
Calculate the number of the element in the buffer that refers to a particular lat or lon value- Parameters:
x
- the double lat/lon value- Returns:
- A double value representing the buffer element index
-
getDownloadSiteName
protected java.lang.String getDownloadSiteName()
-
frac
public double frac(int tile)
Calculate the proportion of a degree represented by a particular element in the buffer- Parameters:
tile
- the integer number of the element- Returns:
- double number representing a fraction of a degree
-
downloadFile
protected void downloadFile(java.lang.String filename) throws java.security.KeyManagementException, java.security.NoSuchAlgorithmException, java.io.IOException, MissingDataFileException
Download a specific file and sand save it in scratch space on the local machine- Parameters:
filename
- the name of the file to download- Throws:
java.security.KeyManagementException
java.security.NoSuchAlgorithmException
java.io.IOException
MissingDataFileException
-
lagrangian
public static double lagrangian(double x, java.awt.geom.Point2D.Double... points)
Fit an exact polynomial to a set of points and return its value at a specified point- Parameters:
x
- double the value at which to evaluate the calculated polynomialpoints
- a set of java.awt.geom.Point2D.Double values- Returns:
- double value of the polynomial
-
hits
public long hits()
-
resultcount
public long resultcount()
-
tries
public long tries()
-
missing
public long missing()
-
resetCounts
public void resetCounts()
-
setMessage
protected void setMessage(java.lang.String msg)
-
setProgress
protected void setProgress(int val)
-
getProperty
protected java.lang.String getProperty(TerrainProperties propertyName)
-
setDownload
public void setDownload(boolean flag)
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
- Overrides:
getPropertyChangeListeners
in classjava.beans.PropertyChangeSupport
-
datasetName
public abstract java.lang.String datasetName()
-
downloadable
public abstract boolean downloadable()
-
recordlength
public abstract int recordlength()
-
formatstring
public abstract java.lang.String formatstring()
-
extn
public abstract java.lang.String extn()
-
littleendian
public abstract boolean littleendian()
-
missingValue
public abstract int missingValue()
-
copyright
public abstract java.lang.String[] copyright()
-
zipEntryName
public java.lang.String zipEntryName(java.lang.String name)
-
numEntryName
public java.lang.String numEntryName(java.lang.String name)
-
-