Class TLcdE57ModelDecoder

java.lang.Object
com.luciad.format.e57.TLcdE57ModelDecoder
All Implemented Interfaces:
ILcdModelDecoder, ILcdStatusSource

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdE57ModelDecoder extends Object implements ILcdModelDecoder, ILcdStatusSource
A decoder for E57 (.e57) files.

An E57 file can contain both point cloud data and panoramic imagery. This model decoder can decode both kinds of data from an E57 file. Both kinds of data have to decoded in separate models, by first discovering the ILcdDataSource of a E57 file, using the discoverDataSources(String) method. Each ILcdDataSource discovered by this method can be decoded using the decodeSource(ILcdDataSource) method.

According to the E57 specification, panoramic data can be represented in different projections. These are the Visual Projection, the Pinhole Projection, the Spherical Projection, the Cylindrical Projection or they can have no projection. This model decoder only supports images represented in the Pinhole and Spherical projections. If the decodeSource(ILcdDataSource) method is called on an E57 file containing images in any other projection an UnsupportedOperationException will be thrown.

Input Files

FileRequiredEntry pointDescription
*.e57XXThe main E57 file

The model reference is obtained from an ILcdModelReferenceDecoder. The default reference decoder set on this model decoder is based on all model reference decoders annotated with the LcdService annotation, and can handle

If this fails, the decoder's default model reference is returned. Unless set by the user, the default model reference is null.

Supported file transfer protocols

  • This decoder uses random access files to decode objects. The source data needs to be accessible as a file.

Model structure

  • The decoded models implement ILcdBounded (which returns the extent of the data).
  • The decoded models do not support spatial queries.

Model descriptor

Models returned by this model decoder either have a TLcdE57ModelDescriptor when calling decodeSource(ILcdDataSource) with a ILcdE57PointCloudDataSource or a ILcdPanoramaModelDescriptor when calling decodeSource(ILcdDataSource) with a ILcdE57PanoramaDataSource.

Model reference

The E57 model is not georeferenced, meaning that an external georeference is needed to properly decode this type of file within geospatial context.

Model reference decoder priority

A model reference decoder priority for TLcdE57ModelDecoder can be set to change the order in which an ILcdModelReference is decoded by setting the system property com.luciad.format.e57.TLcdE57ModelDecoder.referenceDecoderPriority to one of these priority values.

Priority Explanation
EMBEDDED_FIRST The model reference decoding is first attempted from the reference information embedded in the data file (.e57). If that fails, the model reference decoding is tried from external reference source files such as WKT (.prj), REF (.ref) and EPSG (*.epsg).
EXTERNAL_FIRST The model reference decoding is first attempted from external reference source files such as WKT (.prj), REF (.ref) and EPSG (*.epsg). If that fails, the model reference decoding is tried from the reference information embedded in the data file (.e57).
By default, the priority is set to use EMBEDDED_FIRST.
This configuration can be useful in scenarios where the model reference embedded in the data file (.e57) might be incorrect or incomplete. You can fix it by placing an external reference file next to the data file, and setting the system property com.luciad.format.e57.TLcdE57ModelDecoder.referenceDecoderPriority to EXTERNAL_FIRST.

Model elements

Updating the model

  • Models are read-only and cannot be changed.

Sample code

Decode file

    TLcdE57ModelDecoder e57Decoder = new TLcdE57ModelDecoder();
    ILcdModel e57Model = e57Decoder.decode("file.e57");

Decode data sources

    TLcdE57ModelDecoder e57Decoder = new TLcdE57ModelDecoder();

    List<? extends ILcdDataSource> dataSources = e57Decoder.discoverDataSources("file.e57");

    ILcdE57PointCloudDataSource pointCloudSource = dataSources.stream()
                                                              .filter(dataSource -> dataSource instanceof ILcdE57PointCloudDataSource)
                                                              .map(dataSource -> (ILcdE57PointCloudDataSource) dataSources)
                                                              .findAny()
                                                              .orElse(null);
    if (pointCloudSource != null) {
      ILcdModel pointCloudModel = e57Decoder.decodeSource(pointCloudSource);
    }

    ILcdE57PanoramaDataSource panoramaSource = dataSources.stream()
                                                          .filter(dataSource -> dataSource instanceof ILcdE57PanoramaDataSource)
                                                          .map(dataSource -> (ILcdE57PanoramaDataSource) dataSources)
                                                          .findAny()
                                                          .orElse(null);
    if (panoramaSource != null) {
      ILcdModel panoramaModel = e57Decoder.decodeSource(panoramaSource);
    }

Thread safety

Since:
2018.1
  • Constructor Details

    • TLcdE57ModelDecoder

      public TLcdE57ModelDecoder()
  • Method Details

    • 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.
    • setModelReferenceDecoder

      public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
      Sets the model reference decoder that will be used for files that don't specify model references.
      Parameters:
      aModelReferenceDecoder - the model reference decoder.
    • getModelReferenceDecoder

      public ILcdModelReferenceDecoder getModelReferenceDecoder()
      Returns the model reference decoder that is used for files that don't specify model references. The default value supports WKT (*.prj), REF (*.ref), and EPSG (*.epsg).
      Returns:
      the model reference decoder used by this decoder
      See Also:
    • setDefaultModelReference

      public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
      Sets the default model reference to be assigned to decoded models whose files don't specify model references.
      Parameters:
      aDefaultModelReference - the default model reference.
    • getDefaultModelReference

      public ILcdModelReference getDefaultModelReference()
      Returns the default model reference that is assigned to decoded models whose files don't specify model references.
    • getMaxNumberOfPoints

      public long getMaxNumberOfPoints()
      Returns the maximum number of points that is kept in the model after decoding.
      Returns:
      the maximum number of points that is kept in the model after decoding.
      See Also:
    • setMaxNumberOfPoints

      public void setMaxNumberOfPoints(long aMaxNumberOfPoints)

      Sets the maximum number of points kept during decoding.

      The points that are kept will be spread over the whole range of points, so that you still see a lower-resolution version of the data. See also performance note in TLspLIDARLayerBuilder.

      Parameters:
      aMaxNumberOfPoints - the maximum number of points kept during decoding.
      See Also:
    • getPointFilter

      public ILcdFilter<ILcdDataObject> getPointFilter()
      Returns the filter used to omit points during decoding.
      Returns:
      the filter used to omit points during decoding, can be null.
      See Also:
    • setPointFilter

      public void setPointFilter(ILcdFilter<ILcdDataObject> aPointFilter)

      Sets the filter used to omit points during decoding. When this filter returns false, the given point is not added to the decoded model. Note that implementations of this filter should not hold on to the points as they may become invalid afterwards.

      It is possible that points are already filtered because a max number of points is set on this model decoder. In that case, the given filter is applied on the remaining points.

      Parameters:
      aPointFilter - the filter used to omit domain objects during decoding. Can be null.
      See Also:
    • addStatusListener

      public void addStatusListener(ILcdStatusListener aListener)
      Description copied from interface: ILcdStatusSource

      Registers the given listener so it will receive status events from this source.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source, you can use a ALcdWeakStatusListener instance as status listener.

      Specified by:
      addStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - The listener to be notified when the status has changed.
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aListener)
      Description copied from interface: ILcdStatusSource
      Removes the specified listener so it is no longer notified.
      Specified by:
      removeStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - The listener to remove.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return 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.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if this decoder can likely decode the data specified by the source name, false otherwise.
      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:
    • decodeModelMetadata

      public TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
      Decodes the model metadata of a E57 file. An E57 file can contain point cloud data, or panoramic images, or both.

      If the passed E57 file contains point cloud data (whether or not panoramic images are present), calling this method is equivalent to calling decodeModelMetadata(ILcdDataSource) with a ILcdE57PointCloudDataSource describing the given file.

      If the passed E57 file contains only panoramic imagery (and no point cloud data), calling this method is equivalent to calling decodeModelMetadata(ILcdDataSource) with a ILcdE57PanoramaDataSource describing the given file.

      If the passed file contains neither point cloud data nor panoramic imagery, an IOException will be thrown
      Specified by:
      decodeModelMetadata in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      a TLcdModelMetadata instance containing the model metadata of either a point cloud model or a panoramic model
      Throws:
      IOException - If the given file contains no point cloud data or panoramic imagery or if another IOException occurs.
      See Also:
    • decodeModelMetadata

      public TLcdModelMetadata decodeModelMetadata(ILcdDataSource aDataSource) throws IOException
      Description copied from interface: ILcdModelDecoder
      Decodes metadata for the specified data source. By default, this decodes the model and returns the model metadata found on that model. Implementations can override this method to speed up the retrieval.
      Specified by:
      decodeModelMetadata in interface ILcdModelDecoder
      Parameters:
      aDataSource - the data source to be decoded.
      Returns:
      the model metadata for the data source, never null.
      Throws:
      IOException - if the metadata cannot be decoded for some reason.
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Decodes a E57 file.

      If the passed E57 file contains point cloud date and/or panoramic imagery, calling this method is equivalent to calling decodeSource(ILcdDataSource) with a ILcdE57PointCloudDataSource describing the given file.

      If If the passed E57 file contains only panoramic imagery (and no point cloud data), calling this method is equivalent to calling decodeSource(ILcdDataSource) with a ILcdE57PanoramaDataSource describing the given file.

      If the passed file contains neither point cloud data nor panoramic imagery, an IOException will be thrown
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      an ILcdModel containing either point cloud data or panoramic imagery data.
      Throws:
      IOException - If the given file contains no point cloud data or panoramic imagery or if another IOException occurs.
      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<? extends ILcdDataSource> discoverDataSources(String aPath) throws IOException
      Retrieves ILcdDataSource instances for E57 file. The returned ILcdDataSource will either be suitable to decode point cloud data or panoramic imagery from the given E57 file.

      The returned list will contain at most two ILcdDataSource.

      If the given E57 file contains point cloud data, the returned list will contain a ILcdE57PointCloudDataSource. This ILcdE57PointCloudDataSource can be used to decode point cloud data from the E57 file by passing it to the decodeSource(ILcdDataSource) method.

      If the given E57 file contains panoramic imagery, the returned list will contain a ILcdE57PanoramaDataSource. This ILcdE57PanoramaDataSource can be used to decode point cloud data from the E57 file by passing it to the decodeSource(ILcdDataSource) method.
      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.