@LcdService(service=ILcdModelEncoder.class, priority=20000) public class TLcdOGC3DTilesModelEncoder extends Object implements ILcdModelEncoder, ILcdStatusSource, ILcdOutputStreamFactoryCapable
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
.
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.
This encoder outputs version 1 of the OGC 3D Tiles specification. Specifically, it supports:
tileset.json
metadata files that hold the LOD tree information.
This model decoder supports all transfer protocols that are supported by the output stream factory
of this decoder.
By default this file output only.
// 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");
This encoder is not thread-safe for concurrent writing.
tileset.json
, if the LOD tree is large.setMeshCompression(ELcdOGC3DTilesMeshCompressionType)
,
which results in significantly smaller file sizes. You can also use this feature to compress existing OGC 3D Tiles datasets.Constructor and Description |
---|
TLcdOGC3DTilesModelEncoder()
Create a new
TLcdOGC3DTilesModelEncoder . |
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aListener)
Registers the given listener so it will receive status events from this source.
|
boolean |
canExport(ILcdModel aModel,
String aDestinationName)
Returns whether this encoder can export the specified model to the specified destination.
|
boolean |
canSave(ILcdModel aModel)
Returns false: this model encoder can not save a model to the location it originally came from.
|
void |
export(ILcdModel aModel,
String aDestinationName)
Exports the specified model to the specified destination.
|
String |
getDisplayName()
Returns a short, displayable name for the format this
ILcdModelEncoder encodes to. |
ELcdOGC3DTilesMeshCompressionType |
getMeshCompression()
Get the mesh compression algorithm that is used while encoding.
|
ILcdOutputStreamFactory |
getOutputStreamFactory()
Returns the output stream factory that is used.
|
void |
removeStatusListener(ILcdStatusListener aListener)
Removes the specified listener so it is no longer notified.
|
void |
save(ILcdModel aModel)
Throws an
UnsupportedOperationException : 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.
|
public TLcdOGC3DTilesModelEncoder()
TLcdOGC3DTilesModelEncoder
.public void setMeshCompression(ELcdOGC3DTilesMeshCompressionType aMeshCompressionType)
aMeshCompressionType
- NONE as default; Should not be null
.public ELcdOGC3DTilesMeshCompressionType getMeshCompression()
public String getDisplayName()
ILcdModelEncoder
ILcdModelEncoder
encodes to.getDisplayName
in interface ILcdModelEncoder
ILcdModelEncoder
.public boolean canSave(ILcdModel aModel)
canSave
in interface ILcdModelEncoder
aModel
- the model to be verified.ILcdModelEncoder.save(com.luciad.model.ILcdModel)
public void save(ILcdModel aModel)
UnsupportedOperationException
: this model encoder can not save a model
to the location it originally came from.save
in interface ILcdModelEncoder
aModel
- the model to be saved.UnsupportedOperationException
- this model encoder can not save a model to the location it originally came from.public boolean canExport(ILcdModel aModel, String aDestinationName)
class javadoc
for details on which models can be exported.canExport
in interface ILcdModelEncoder
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.true
if the model can be exported, false
otherwise.ILcdModelEncoder.export(com.luciad.model.ILcdModel, java.lang.String)
public void export(ILcdModel aModel, String aDestinationName) throws IllegalArgumentException, IOException
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.
Data
subdirectory.lcd_lock
.export
in interface ILcdModelEncoder
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.IllegalArgumentException
- if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)
).IOException
- if an I/O error occurs during encoding.public void addStatusListener(ILcdStatusListener aListener)
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.
addStatusListener
in interface ILcdStatusSource
aListener
- The listener to be notified when the status has changed.public void removeStatusListener(ILcdStatusListener aListener)
ILcdStatusSource
removeStatusListener
in interface ILcdStatusSource
aListener
- The listener to remove.public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
ILcdOutputStreamFactoryCapable
setOutputStreamFactory
in interface ILcdOutputStreamFactoryCapable
aOutputStreamFactory
- the output stream factory to be used.public ILcdOutputStreamFactory getOutputStreamFactory()
ILcdOutputStreamFactoryCapable
getOutputStreamFactory
in interface ILcdOutputStreamFactoryCapable