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.PropertyChangeSupportDEMReader - 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 classDEMReader.CacheEntryCacheEntry -- A class used to store a row of values
-
Field Summary
Fields Modifier and Type Field Description protected static intBUFFERLENGTHprotected java.util.HashMap<java.lang.String,DEMReader.CacheEntry>cacheprotected booleancacheEnableprotected java.lang.String[]copyrightprotected longcycleprotected java.lang.StringDIRECTORYprotected booleandownloadprotected longhitsprotected static java.util.zip.ZipInputStreaminprotected java.lang.StringlastMessageprotected intlastValueprotected static java.util.LocaleLOCALEprotected static intMAX_CACHE_SIZEprotected longmissingprotected static doubleMISSINGprotected longresultcountprotected longtriesprotected booleanuseLegacy
-
Constructor Summary
Constructors Modifier Constructor Description protectedDEMReader(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.StringdatasetName()abstract booleandownloadable()protected voiddownloadFile(java.lang.String filename)Download a specific file and sand save it in scratch space on the local machineabstract java.lang.Stringextn()abstract java.lang.Stringformatstring()doublefrac(int tile)Calculate the proportion of a degree represented by a particular element in the bufferprotected java.lang.StringgetDownloadSiteName()doublegetHeight(LatLong place)protected java.lang.StringgetProperty(TerrainProperties propertyName)java.beans.PropertyChangeListener[]getPropertyChangeListeners()protected DEMReader.CacheEntrygetRow(java.lang.String name, int ytile)longhits()static doublelagrangian(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 booleanlittleendian()protected java.lang.Stringmakename(java.lang.String ns, double lat, java.lang.String ew, double lon)longmissing()abstract intmissingValue()java.lang.StringnumEntryName(java.lang.String name)byte[]readByteRecord()Read the next byte record from the current ZipInputStreamint[]readRecord()Read the next record from the current ZipInputStreamabstract intrecordlength()voidresetCounts()longresultcount()voidsetDownload(boolean flag)protected voidsetMessage(java.lang.String msg)protected voidsetProgress(int val)doubletile(double x)Calculate the number of the element in the buffer that refers to a particular lat or lon valuelongtries()java.lang.StringzipEntryName(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.IOExceptionRead 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.IOExceptionRead 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, MissingDataFileExceptionDownload 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.KeyManagementExceptionjava.security.NoSuchAlgorithmExceptionjava.io.IOExceptionMissingDataFileException
-
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:
getPropertyChangeListenersin 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)
-
-