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
ILcdModelTreeNodecontaining 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_NAMEset 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
ALcdImageandILcdEarthTileSetcontaining 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
ConstructorsConstructorDescriptionCreates a new geospatial PDF model decoder instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(ILcdDataSource aDataSource) Checks whether this model decoder can decode the data source(s), identified by the passedILcdDataSource.booleancanDecodeSource(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-specificILcdDataSourceinstances.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.doubleReturns the current target DPIvoidsetTargetDPI(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, waitMethods 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:
canDecodeSourcein 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:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
decode
Decodes the file designated by the given string to an ILcdModel instance.- Specified by:
decodein 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:ILcdModelDecoderChecks 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
ILcdDataSourceis aTLcdDataSource. If not, this method returns false. Otherwise, it delegates the source to theILcdModelDecoder.canDecodeSource(String)method.- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aDataSource- theILcdModelSourceto be verified.- Returns:
trueif this decoder can likely decode the data specified byaDataSource,falseotherwise.- See Also:
-
decodeSource
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.
By default, this method:
- Throws a
NullPointerExceptionwhen anulldata source is passed. - Delegates to the
ILcdModelDecoder.decode(String)method when aTLcdDataSourceis passed. - Throws an IOException in other case.
- Specified by:
decodeSourcein interfaceILcdModelDecoder- Parameters:
aDataSource- theILcdDataSourceto be decoded.- Returns:
- a model containing the decoded data. While
nullis 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:ILcdModelDecoderRetrieves a set of model-specific
ILcdDataSourceinstances.By default, this method:
- returns a list containing at least a single
TLcdDataSourcethat contains a reference to the supplied path, whenILcdModelDecoder.canDecodeSource(String)returnstruefor the supplied path. - throws an
IOExceptionwhenILcdModelDecoder.canDecodeSource(String)returnsfalsefor 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 usingILcdDataSources, where each measurement layer can be referenced to and decoded separately usingILcdModelDecoder.decodeSource(ILcdDataSource)- Specified by:
discoverDataSourcesin 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
trueforILcdModelDecoder.canDecodeSource(String), it will return a list containing at least a singleILcdDataSource. - Throws:
IOException- If this model decoder returnsfalseforILcdModelDecoder.canDecodeSource(String)or if any exceptions caused by IO problems or invalid data occur.
- returns a list containing at least a single
-