@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdGeospatialPDFModelDecoder extends Object implements ILcdModelDecoder
File | Required | Entry point | Description |
---|---|---|---|
x | x | PDF file |
ILcdModelTreeNode
containing multiple ILcdModels will be decoded.TLcdGeospatialPDFModelDescriptor
.TLcdModelDescriptor
.TLcdGeospatialPDFModelDescriptor.TYPE_NAME
set as type name.ILcdGridReference
.ALcdImage
and ILcdEarthTileSet
containing one ILcdEarthRasterTileSetCoverage
.
ILcdModelDecoder decoder = new TLcdGeospatialPDFModelDecoder();
ILcdModel model = decoder.decode( "vector.pdf" );
Constructor and Description |
---|
TLcdGeospatialPDFModelDecoder()
Creates a new geospatial PDF model decoder instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(ILcdDataSource aDataSource)
Checks whether this model decoder can decode the data source(s), identified by the passed
ILcdDataSource . |
boolean |
canDecodeSource(String aString)
Determines if this decoder can decode the file designated by the given string.
|
ILcdModel |
decode(String aSourceName)
Decodes the file designated by the given string to an ILcdModel instance.
|
ILcdModel |
decodeSource(ILcdDataSource aDataSource)
Creates a new model from the given data source.
|
List<ILcdDataSource> |
discoverDataSources(String aPath)
Retrieves a set of model-specific
ILcdDataSource instances. |
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
double |
getTargetDPI()
Returns the current target DPI
|
void |
setTargetDPI(double aTargetDPI)
Sets the target DPI for the models returned by this model decoder.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodeModelMetadata, decodeModelMetadata
public TLcdGeospatialPDFModelDecoder()
public double getTargetDPI()
setTargetDPI(double)
public void setTargetDPI(double aTargetDPI)
Sets the target DPI for the models returned by this model decoder. Changing this value will only have an effect on new decoded models. Existing models remain unaffected.
The model decoder creates Earth tilesets, where the tiles at the most detailed level will
have a DPI of at least aTargetDPI
. When no target DPI is specified, a default
value will be used.
aTargetDPI
- The target DPIgetTargetDPI()
public boolean canDecodeSource(String aString)
canDecodeSource
in interface ILcdModelDecoder
aString
- the file to decodeILcdModelDecoder.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
- the file to decodeIOException
- if an error occurs while decoding the modelILcdModelDecoder.canDecodeSource(String)
public boolean canDecodeSource(ILcdDataSource aDataSource)
ILcdModelDecoder
Checks whether this model decoder can decode the data source(s), identified by the passed ILcdDataSource
.
For performance reasons, we strongly recommend that this will only be a simple test.
For example: check the instance class of aDataSource
,
or check the file extension if it is a TLcdDataSource
.
The default implementation of this method will check if the given ILcdDataSource
is a
TLcdDataSource
. If not, this method returns false. Otherwise, it delegates
the source to the ILcdModelDecoder.canDecodeSource(String)
method.
canDecodeSource
in interface ILcdModelDecoder
aDataSource
- the ILcdModelSource
to be verified.true
if this decoder can likely decode the data specified by aDataSource
, false
otherwise.ILcdModelDecoder.decodeSource(ILcdDataSource)
,
ILcdModelDecoder.decodeModelMetadata(ILcdDataSource)
public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException
ILcdModelDecoder
Creates a new model from the given data source.
By default, this method:
NullPointerException
when a null
data source is passed.ILcdModelDecoder.decode(String)
method when a TLcdDataSource
is passed.decodeSource
in interface ILcdModelDecoder
aDataSource
- the ILcdDataSource
to be decoded.null
is allowed, implementors are advised to throw an error instead.IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost
always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException,
IllegalArgumentException, ...) on unexpected places, implementations are advised to catch
RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated
in the code snippet below.
public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException {
try {
// Perform decoding ...
} catch (RuntimeException e) {
throw new IOException(e);
}
}
ILcdModelDecoder.canDecodeSource(ILcdDataSource)
public List<ILcdDataSource> discoverDataSources(String aPath) throws IOException
ILcdModelDecoder
Retrieves a set of model-specific ILcdDataSource
instances.
By default, this method:
TLcdDataSource
that contains a reference to the supplied path,
when ILcdModelDecoder.canDecodeSource(String)
returns true
for the supplied path.IOException
when ILcdModelDecoder.canDecodeSource(String)
returns false
for the supplied path.ILcdDataSource
, for instance, if the
path references a collection of data sources.
An example where this is useful is for container formats, such as NetCDF. A NetCDF
file can contain multiple measurement layers. This ILcdModelDecoder.discoverDataSources(String)
method
allows you to distinguish between them using ILcdDataSource
s, where each measurement
layer can be referenced to and decoded separately using ILcdModelDecoder.decodeSource(ILcdDataSource)
discoverDataSources
in interface ILcdModelDecoder
aPath
- A path to the data source to be decoded; typically a file path or a URL.true
for ILcdModelDecoder.canDecodeSource(String)
, it will
return a list containing at least a single ILcdDataSource
.IOException
- If this model decoder returns false
for ILcdModelDecoder.canDecodeSource(String)
or if any exceptions caused by IO problems or invalid data occur.