Class TLcdGeospatialPDFModelDecoder
- All Implemented Interfaces:
ILcdModelDecoder
Input files
File | Required | Entry point | Description |
---|---|---|---|
x | x | PDF file |
Supported file transfer protocols
- This model decoder only supports files that are directly accessible via the local filesystem.
Model structure
- This model decoder creates a model per map frame specified in the PDF file.
If the PDF file contains a single map frame, a single ILcdModel will be decoded; if the PDF file
contains multiple map frames, a
ILcdModelTreeNode
containing multiple ILcdModels will be decoded.
Model descriptor
- Individual models returned by this model decoder have a
TLcdGeospatialPDFModelDescriptor
. - Composite models returned by this model decoder have a
TLcdModelDescriptor
. - All model descriptors have
TLcdGeospatialPDFModelDescriptor.TYPE_NAME
set as type name.
Model reference
- Models returned by this model decoder have a fitted (projected)
ILcdGridReference
.
Model elements
- Each decoded model contains a single implementation of
ALcdImage
andILcdEarthTileSet
containing oneILcdEarthRasterTileSetCoverage
.
Sample code
ILcdModelDecoder decoder = new TLcdGeospatialPDFModelDecoder();
ILcdModel model = decoder.decode( "vector.pdf" );
Thread safety
- The decoding of models is thread-safe.
- The decoded models are thread-safe for read access.
Supported versions and specifications
- Since:
- 2012.0
-
Constructor Summary
ConstructorDescriptionCreates a new geospatial PDF model decoder instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(ILcdDataSource aDataSource) Checks whether this model decoder can decode the data source(s), identified by the passedILcdDataSource
.boolean
canDecodeSource
(String aString) Determines if this decoder can decode the file designated by the given string.Decodes the file designated by the given string to an ILcdModel instance.decodeSource
(ILcdDataSource aDataSource) Creates a new model from the given data source.discoverDataSources
(String aPath) Retrieves a set of model-specificILcdDataSource
instances.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.double
Returns the current target DPIvoid
setTargetDPI
(double aTargetDPI) Sets the target DPI for the models returned by this model decoder.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
decodeModelMetadata, decodeModelMetadata
-
Constructor Details
-
TLcdGeospatialPDFModelDecoder
public TLcdGeospatialPDFModelDecoder()Creates a new geospatial PDF model decoder instance.
-
-
Method Details
-
getTargetDPI
public double getTargetDPI()Returns the current target DPI- Returns:
- the current target DPI
- See Also:
-
setTargetDPI
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.- Parameters:
aTargetDPI
- The target DPI- See Also:
-
canDecodeSource
Determines if this decoder can decode the file designated by the given string.- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aString
- the file to decode- Returns:
- true if the given file can be decoded; false otherwise
- See Also:
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
decode
Decodes the file designated by the given string to an ILcdModel instance.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the file to decode- Returns:
- the decoded model
- Throws:
IOException
- if an error occurs while decoding the model- See Also:
-
canDecodeSource
Description copied from interface: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 aTLcdDataSource
.The default implementation of this method will check if the given
ILcdDataSource
is aTLcdDataSource
. If not, this method returns false. Otherwise, it delegates the source to theILcdModelDecoder.canDecodeSource(String)
method.- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- theILcdModelSource
to be verified.- Returns:
true
if this decoder can likely decode the data specified byaDataSource
,false
otherwise.- See Also:
-
decodeSource
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.
By default, this method:
- Throws a
NullPointerException
when anull
data source is passed. - Delegates to the
ILcdModelDecoder.decode(String)
method when aTLcdDataSource
is passed. - Throws an IOException in other case.
- Specified by:
decodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- theILcdDataSource
to be decoded.- Returns:
- a model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
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); } }
- See Also:
- Throws a
-
discoverDataSources
Description copied from interface:ILcdModelDecoder
Retrieves a set of model-specific
ILcdDataSource
instances.By default, this method:
- returns a list containing at least a single
TLcdDataSource
that contains a reference to the supplied path, whenILcdModelDecoder.canDecodeSource(String)
returnstrue
for the supplied path. - throws an
IOException
whenILcdModelDecoder.canDecodeSource(String)
returnsfalse
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 usingILcdDataSource
s, where each measurement layer can be referenced to and decoded separately usingILcdModelDecoder.decodeSource(ILcdDataSource)
- Specified by:
discoverDataSources
in interfaceILcdModelDecoder
- Parameters:
aPath
- A path to the data source to be decoded; typically a file path or a URL.- Returns:
- If this model decoder returns
true
forILcdModelDecoder.canDecodeSource(String)
, it will return a list containing at least a singleILcdDataSource
. - Throws:
IOException
- If this model decoder returnsfalse
forILcdModelDecoder.canDecodeSource(String)
or if any exceptions caused by IO problems or invalid data occur.
- returns a list containing at least a single
-