public class TLcdWMMModelDecoder extends Object implements ILcdInputStreamFactoryCapable
TLcdMagneticNorthModel
from a data file containing
the parameters for the WMM magnetic model. Such a file can be found in
samples/resources/Data/magneticnorth
File | Required | Entry point | Description |
---|---|---|---|
*.cof | x | x | file containing the magnetic model coefficients |
decode(java.lang.String)
method can decode a single filename or a "," or ";" separated list of filenames.
For instance, when you pass the argument "/../WMM2005.COF, /../WMM2010.COF", both the
WMM2005 and the WMM2010 file will be available to calculate magnetic north declination data
from.
ILcdInputStreamFactory
of this decoder.
ILcd2DBoundsIndexedModel
.
TLcdWMMModelDescriptor
data model
contains the data types found in
TLcdMagneticNorthDataTypes
set date
.
The model elements implement ILcdDataObject
, on top of implementing their respective shape.
TLcdWMMModelDecoder modelDecoder = new TLcdWMMModelDecoder();
//Specify the date on the model decoder
Calendar calendar = Calendar.getInstance();
calendar.set(2020, Calendar.AUGUST, 26, 16, 52);
modelDecoder.setDate(calendar);
//Decode the model
ILcdModel model = modelDecoder.decode("Data/magneticnorth/WMM2020.COF");
read lock
.Constructor and Description |
---|
TLcdWMMModelDecoder() |
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aStatusListener)
Adds a listener that will be informed of progress when processing the data that was loaded.
|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
protected ALcdMagneticNorthModelDescriptor |
createMagneticNorthModelDescriptor()
Create a model descriptor specific for magnetic north models.
|
protected TLcdMagneticNorthModel |
createModel(ILcdMagneticNorthMap aMap) |
protected ILcdModelDescriptor |
createModelDescriptor(ILcdMagneticNorthMap aMap)
Creates a model descriptor for the model by creating a magnetic north model descriptor
(
createMagneticNorthModelDescriptor() ) and then configuring it. |
ILcdModel |
decode(String aSourceName)
This method can decode a single filename or a "," or ";" separated list of filenames.
|
ILcdBounds |
getBounds() |
Calendar |
getDate() |
int |
getDegreesBetweenLines()
Deprecated.
Use
getStep() instead. |
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory to load the data.
|
double |
getPrecision()
Returns the precision.
|
double |
getStep()
Returns the step in degrees between the iso lines of equal declination.
|
boolean |
isCreateValuedPolygons() |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
removeStatusListener(ILcdStatusListener aStatusListener)
Removes a listener that should no longer be informed of progress when processing the data that was loaded.
|
void |
setBounds(ILcdBounds aBounds)
Sets the bounds the magnetic will be retrieved for
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setCreateValuedPolygons(boolean aCreateClosedContours)
Set this ALcdMagneticNorthModelDecoder to always create closed contours.
|
void |
setDate(Calendar aDate)
Sets the date to decode the model for.
|
void |
setDegreesBetweenLines(int aDegreesBetweenLines)
Deprecated.
Use
setStep(double) instead.
Sets the number of degrees between the iso lines. ( f.e. a line every 2 degrees ) |
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to load the data.
|
void |
setPrecision(double aPrecision)
Sets the precision.
|
void |
setStep(double aStep)
Sets the step in degrees between the iso lines of equal declination.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
true
for a source name while decode
throws an exception for that same source name.
For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public ILcdModel decode(String aSourceName) throws IOException
decode
in interface ILcdModelDecoder
aSourceName
- A WMM configuration filename of a list of such names, separated by a "," or a ";".IOException
- when the list contains no valid filenames or when one of the files can't
be opened.ILcdModelDecoder.canDecodeSource(String)
protected ALcdMagneticNorthModelDescriptor createMagneticNorthModelDescriptor()
createModelDescriptor(ILcdMagneticNorthMap)
.protected ILcdModelDescriptor createModelDescriptor(ILcdMagneticNorthMap aMap)
createMagneticNorthModelDescriptor()
) and then configuring it.aMap
- the map to create a model descriptor forpublic ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- an InputStream factory that creates input streams to load the
magnetic north data.getInputStreamFactory()
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.aTraceOn
- if true then all log messages are recorded for this
instance. If false, then only the informative, warning and
error log messages are recorded.public boolean isTraceOn()
true
if tracing is enabled for this class.public double getPrecision()
public void setPrecision(double aPrecision)
aPrecision
- the precision to be usedpublic int getDegreesBetweenLines()
getStep()
instead.public void setDegreesBetweenLines(int aDegreesBetweenLines)
setStep(double)
instead.
Sets the number of degrees between the iso lines. ( f.e. a line every 2 degrees )aDegreesBetweenLines
- the number of degrees between two lines. The lower this number, the higher the number
of lines that will be created.public double getStep()
public void setStep(double aStep)
aStep
- The step in degrees between the iso lines of equal declination.public Calendar getDate()
public void setDate(Calendar aDate)
aDate
- The new datepublic ILcdBounds getBounds()
public void setBounds(ILcdBounds aBounds)
aBounds
- the new boundsprotected TLcdMagneticNorthModel createModel(ILcdMagneticNorthMap aMap)
public void addStatusListener(ILcdStatusListener aStatusListener)
addStatusListener
in interface ILcdStatusSource
aStatusListener
- the listener to inform of progress when processing the data that was loaded.removeStatusListener(com.luciad.util.ILcdStatusListener)
public void removeStatusListener(ILcdStatusListener aStatusListener)
removeStatusListener
in interface ILcdStatusSource
aStatusListener
- a listener that should no longer be informed of progress when processing the data that was loaded.addStatusListener(com.luciad.util.ILcdStatusListener)
public void setCreateValuedPolygons(boolean aCreateClosedContours)
aCreateClosedContours
- The behaviour to setpublic boolean isCreateValuedPolygons()
setCreateValuedPolygons(boolean)