Class TLcdOGC3DTilesModelEncoder
- All Implemented Interfaces:
ILcdOutputStreamFactoryCapable
,ILcdModelEncoder
,ILcdStatusSource
,Serializable
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatusListener
(ILcdStatusListener aListener) Registers the given listener so it will receive status events from this source.boolean
Returns whether this encoder can export the specified model to the specified destination.boolean
Returns false: this model encoder can not save a model to the location it originally came from.void
Exports the specified model to the specified destination.Returns a short, displayable name for the format thisILcdModelEncoder
encodes to.Get the mesh compression algorithm that is used while encoding.Returns the output stream factory that is used.void
removeStatusListener
(ILcdStatusListener aListener) Removes the specified listener so it is no longer notified.void
Throws anUnsupportedOperationException
: this model encoder can not save a model to the location it originally came from.void
setMeshCompression
(ELcdOGC3DTilesMeshCompressionType aMeshCompressionType) Set the mesh compression algorithm to use while encoding.void
setOutputStreamFactory
(ILcdOutputStreamFactory aOutputStreamFactory) Sets the output stream factory to be used.
-
Constructor Details
-
TLcdOGC3DTilesModelEncoder
public TLcdOGC3DTilesModelEncoder()Create a newTLcdOGC3DTilesModelEncoder
.
-
-
Method Details
-
setMeshCompression
Set the mesh compression algorithm to use while encoding. None if not set.- Parameters:
aMeshCompressionType
- NONE as default; Should not benull
.- Since:
- 2021.1
-
getMeshCompression
Get the mesh compression algorithm that is used while encoding.- Returns:
- the mesh compression type
- Since:
- 2021.1
-
getDisplayName
Description copied from interface:ILcdModelEncoder
Returns a short, displayable name for the format thisILcdModelEncoder
encodes to.- Specified by:
getDisplayName
in interfaceILcdModelEncoder
- Returns:
- the displayable name of this
ILcdModelEncoder
.
-
canSave
Returns false: this model encoder can not save a model to the location it originally came from.- Specified by:
canSave
in interfaceILcdModelEncoder
- Parameters:
aModel
- the model to be verified.- Returns:
- false
- See Also:
-
save
Throws anUnsupportedOperationException
: this model encoder can not save a model to the location it originally came from.- Specified by:
save
in interfaceILcdModelEncoder
- 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
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. Seeclass javadoc
for details on which models can be exported.- Specified by:
canExport
in interfaceILcdModelEncoder
- 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. Seeclass javadoc
for details on which models can be exported. You can either provide a json file name as destination, typicallytileset.json
, or a directory name where the encoder will place atileset.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 interfaceILcdModelEncoder
- 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.
- The encoder will write metadata to the json file, and place the tile data into a
-
addStatusListener
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 interfaceILcdStatusSource
- Parameters:
aListener
- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSource
Removes the specified listener so it is no longer notified.- Specified by:
removeStatusListener
in interfaceILcdStatusSource
- Parameters:
aListener
- The listener to remove.
-
setOutputStreamFactory
Description copied from interface:ILcdOutputStreamFactoryCapable
Sets the output stream factory to be used.- Specified by:
setOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Parameters:
aOutputStreamFactory
- the output stream factory to be used.
-
getOutputStreamFactory
Description copied from interface:ILcdOutputStreamFactoryCapable
Returns the output stream factory that is used.- Specified by:
getOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Returns:
- the output stream factory that is used.
-