Class TLcdGeospatialPDFModelDecoder

java.lang.Object
com.luciad.format.geospatialpdf.TLcdGeospatialPDFModelDecoder
All Implemented Interfaces:
ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdGeospatialPDFModelDecoder extends Object implements ILcdModelDecoder
This model decoder decodes Geospatial PDF files.

Input files

File Required Entry point Description
*.pdf 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

Model reference

Model elements

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 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

      public boolean canDecodeSource(String aString)
      Determines if this decoder can decode the file designated by the given string.
      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aString - the file to decode
      Returns:
      true if the given file can be decoded; false otherwise
      See Also:
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Decodes the file designated by the given string to an ILcdModel instance.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the file to decode
      Returns:
      the decoded model
      Throws:
      IOException - if an error occurs while decoding the model
      See Also:
    • canDecodeSource

      public boolean canDecodeSource(ILcdDataSource aDataSource)
      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 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.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aDataSource - the ILcdModelSource to be verified.
      Returns:
      true if this decoder can likely decode the data specified by aDataSource, false otherwise.
      See Also:
    • decodeSource

      public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException
      Description copied from interface: ILcdModelDecoder

      Creates a new model from the given data source.

      By default, this method:

      Specified by:
      decodeSource in interface ILcdModelDecoder
      Parameters:
      aDataSource - the ILcdDataSource 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:
    • discoverDataSources

      public List<ILcdDataSource> discoverDataSources(String aPath) throws IOException
      Description copied from interface: ILcdModelDecoder

      Retrieves a set of model-specific ILcdDataSource instances.

      By default, this method:

      Concrete model decoders might choose to return a set of 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 ILcdDataSources, where each measurement layer can be referenced to and decoded separately using ILcdModelDecoder.decodeSource(ILcdDataSource)

      Specified by:
      discoverDataSources in interface ILcdModelDecoder
      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 for ILcdModelDecoder.canDecodeSource(String), it will return a list containing at least a single ILcdDataSource.
      Throws:
      IOException - If this model decoder returns false for ILcdModelDecoder.canDecodeSource(String) or if any exceptions caused by IO problems or invalid data occur.