Class TLcdOGC3DTilesModelEncoder

java.lang.Object
com.luciad.format.tiled3d.ogc3dtiles.TLcdOGC3DTilesModelEncoder
All Implemented Interfaces:
ILcdOutputStreamFactoryCapable, ILcdModelEncoder, ILcdStatusSource, Serializable

Encodes tiled and multi-leveled mesh models to OGC 3D Tiles.

Supported input models

This model encoder handles only models with ILcd3DMesh data that is already tiled and multi-leveled.

LuciadLightspeed and LuciadFusion currently don't expose API to write such a model yourself. So in practice you can pass models created by our decoders, such as the TLcdOSGBModelDecoder, TLcdIFCModelDecoder or TLcdBINZModelDecoder.

Luciad's 3D Tiles Processing Engine

If you want to make a 3D mesh model that is not tiled or multi-leveled available for streaming through OGC 3D Tiles, you can make use of the 3D Tiles Processing Engine. It comes as a part of the optional Infrastructure Standards component. The 3D Tiles Processing Engine is an advanced converter that (re)tiles your mesh and makes it multi-leveled, and optimizes it for fast streaming while retaining mesh and texture quality.

Output

This encoder outputs version 1 of the OGC 3D Tiles specification. Specifically, it supports:

  • tileset.json metadata files that hold the LOD tree information.
  • B3DM payloads, with GLTF 2.0 mesh content, with or without textures, with or without mesh compression.

Supported transfer protocols

This model decoder supports all transfer protocols that are supported by the output stream factory of this decoder. By default this file output only.

Example

Decoding an OSGB dataset and encoding it into OGC 3D Tiles.
    // Load an OSGB dataset
    ILcdModelDecoder decoder = new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
    ILcdModel model = decoder.decode("/path/to/osgb/dataset.desc");

    // Encode to OGC 3D Tiles
    TLcdOGC3DTilesModelEncoder encoder = new TLcdOGC3DTilesModelEncoder();
    // Use draco mesh compression when encoding a mesh model
    encoder.setMeshCompression(ELcdOGC3DTilesMeshCompressionType.DRACO);
    encoder.export(model, "/path/to/ogc3dtiles/tileset.json");

Thread-safety

This encoder is not thread-safe for concurrent writing.

Other notes

  • This encoder transforms coordinates from the input model reference to geocentric reference (as mandated by the OGC 3D Tiles specification).
  • This encoder saves only mesh data. In the future, it will also support saving point clouds to PNTS.
  • This encoder splits metadata hierarchically over multiple json files referred from the root tileset.json, if the LOD tree is large.
  • This encoder supports Draco mesh compression through setMeshCompression(ELcdOGC3DTilesMeshCompressionType), which results in significantly smaller file sizes. You can also use this feature to compress existing OGC 3D Tiles datasets.

Since:
2020.0
See Also:
  • Constructor Details

  • Method Details

    • setMeshCompression

      public void setMeshCompression(ELcdOGC3DTilesMeshCompressionType aMeshCompressionType)
      Set the mesh compression algorithm to use while encoding. None if not set.
      Parameters:
      aMeshCompressionType - NONE as default; Should not be null.
      Since:
      2021.1
    • getMeshCompression

      public ELcdOGC3DTilesMeshCompressionType getMeshCompression()
      Get the mesh compression algorithm that is used while encoding.
      Returns:
      the mesh compression type
      Since:
      2021.1
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelEncoder
      Returns a short, displayable name for the format this ILcdModelEncoder encodes to.
      Specified by:
      getDisplayName in interface ILcdModelEncoder
      Returns:
      the displayable name of this ILcdModelEncoder.
    • canSave

      public boolean canSave(ILcdModel aModel)
      Returns false: this model encoder can not save a model to the location it originally came from.
      Specified by:
      canSave in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be verified.
      Returns:
      false
      See Also:
    • save

      public void save(ILcdModel aModel)
      Throws an UnsupportedOperationException: this model encoder can not save a model to the location it originally came from.
      Specified by:
      save in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be saved.
      Throws:
      UnsupportedOperationException - this model encoder can not save a model to the location it originally came from.
    • canExport

      public boolean canExport(ILcdModel aModel, String aDestinationName)
      Returns whether this encoder can export the specified model to the specified destination.

      This check does not verify if the destination is writable, already exists etc, it is only meant to verify compatibility of the model.

      See class javadoc for details on which models can be exported.

      Specified by:
      canExport in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be verified.
      aDestinationName - the location where the model should be exported to, can be either a directory or a specific tileset.json.
      Returns:
      true if the model can be exported, false otherwise.
      See Also:
    • export

      public void export(ILcdModel aModel, String aDestinationName) throws IllegalArgumentException, IOException
      Exports the specified model to the specified destination.

      See class javadoc for details on which models can be exported.

      You can either provide a json file name as destination, typically tileset.json, or a directory name where the encoder will place a tileset.json file.

      • The encoder will write metadata to the json file, and place the tile data into a Data subdirectory.
      • If the directory path to the json file does not exist, it will be created.
      • If the json file already exists, the export fails.
      • If a previous, partial export result already exists, the export overwrites this result. You can recognize this by a json file ending in lcd_lock.
      Specified by:
      export in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be exported.
      aDestinationName - the location where the model should be exported to, can be either a directory or a specific tileset.json.
      Throws:
      IllegalArgumentException - if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)).
      IOException - if an I/O error occurs during encoding.
    • 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.
    • setOutputStreamFactory

      public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
      Description copied from interface: ILcdOutputStreamFactoryCapable
      Sets the output stream factory to be used.
      Specified by:
      setOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Parameters:
      aOutputStreamFactory - the output stream factory to be used.
    • getOutputStreamFactory

      public ILcdOutputStreamFactory getOutputStreamFactory()
      Description copied from interface: ILcdOutputStreamFactoryCapable
      Returns the output stream factory that is used.
      Specified by:
      getOutputStreamFactory in interface ILcdOutputStreamFactoryCapable
      Returns:
      the output stream factory that is used.