Class TLcdOGC3DTilesModelDecoder
java.lang.Object
com.luciad.format.tiled3d.ogc3dtiles.TLcdOGC3DTilesModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public final class TLcdOGC3DTilesModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes 3D Tiles tileset files to an
ILcdModel
.
Input files
File | Required | Entry point | Description |
---|---|---|---|
tileset.json/root.json | x | File containing the root tile metadata as well as links to the sub-tiles/content. | |
*.json | Files containing sub-tile metadata as well as links to its sub-tiles/content. | ||
*.b3dm | File containing Batched 3D Model data See the B3DM documentation for more information about this file. | ||
*.pnts | File containing batched Point Cloud data See the PNTS documentation for more information about this file. | ||
*.b3dm_lcd_link | File containing the necessary data for converting from OSGB to Batched 3D Model data. Link files are generated while preprocessing the OSGB dataset. | ||
LuciadPC | Directory containing the necessary data for retrieving payloads from a Luciad Point Cloud dataset. |
Since all JSON files have the same structure, any of them could be used as entry point. However, only the tile of the JSON file and its children will be decoded.
Supported file transfer protocols
-
This model decoder supports all transfer protocols that are supported by
the
InputStreamFactory
of this decoder.
Model structure
- This model decoder creates a model per entry .json file.
-
This model decoder returns a single read-only
ILcd2DBoundsIndexedModel
.
Model descriptor
-
When the tile set contains point cloud data (PNTS), the model descriptor will be an
ILcdDataModelDescriptor
. Although the elements in the model are notdata objects
themselves, you can still use the data model to access properties of individual points to buildexpressions
for use in styling. UseILcdDataModelDescriptor.getModelTypes()
to obtain the single data type that consists of the properties available in the PNTS data. - The type name of the model descriptor is "3D Tiles" for a 3D Tiles 1.0 dataset, and "3D Tiles 1.1" for a 3D Tiles 1.1 dataset.
Model reference
- The decoder assumes a Geocentric reference system.
Model elements
- Each decoded model contains elements that implement
Object
.
Sample code
ILcdModelDecoder decoder = new TLcdOGC3DTilesModelDecoder();
ILcdModel model = decoder.decode("tileset.json");
Performance tips
- Due to the amount of data that can be loaded, the size of the textures can impact performance.
- Since OGC 3DTiles relies on a tree structure to determine which tile to load. This means the way this tree is built can impact performance. An ideal tree has enough level of details to avoid loading highly details at an early stage while loading those when fully zoomed-in.
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models are thread-safe for read access.
Supported versions and specifications
This decoder supports version 1.0 of the OGC 3D Tiles specification. Specifically, it supports:- Decoding
tileset.json
with full metadata support, including property values and ranges - B3DM payloads
- Both GLTF 1.0 and GLTF 2.0 in the B3DM payloads
- PNTS payloads
Known limitations
- The source file must be an external tileset (
.json
) with batched 3D model (.b3dm
) or point cloud (.pnts
) contents. - B3DM tiles support is limited to single color-texture.
- B3DM tiles support does not include animations
- B3DM shading is limited to the base color.
- Embedded binary textures are supported. Externally referenced textures are not supported.
- Instanced 3D Model (I3DM) is not supported.
- Composite Tile Model (CMPT) is not supported.
- Complex, hierarchical batch table properties are not supported.
- 3D Tiles 1.1 tilesets can be decoded but not visualized.
Requirements
- The current implementation requires JRE 1.2 or higher.
- The current implementation requires native libraries.
Additional comments
- Since all JSON files have the same structure, any of them could be used as entry point. However, only the tile of the JSON file and its children will be decoded.
Example: decoding and visualizing OGC 3D Tiles data
//First create the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("https://sampleservices.luciad.com/ogc/3dtiles/marseille-mesh/tileset.json");
//Create a layer for the model using the layer builder
ILspLayer layer = TLsp3DTileLayerBuilder.newBuilder()
.model(model)
.build();
//Add the layer to the Lightspeed view (an ILspView)
view.addLayer(layer);
- Since:
- 2018.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is used.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
TYPE_NAME_1_0
The type name for decoded 3D Tiles 1.0 models.- Since:
- 2024.0
- See Also:
-
TYPE_NAME_1_1
The type name for decoded 3D Tiles 1.1 models.- Since:
- 2024.0
- See Also:
-
TYPE_NAMES
The set of type names this model decoder can produce.- Since:
- 2024.0
-
TYPE_NAME
Deprecated.The type name for the decoded models. This is an alias forTYPE_NAME_1_0
.- See Also:
-
-
Constructor Details
-
TLcdOGC3DTilesModelDecoder
public TLcdOGC3DTilesModelDecoder()
-
-
Method Details
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Returns the input stream factory that is used.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Sets the input stream factory to be used.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
Description copied from interface:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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 interfaceILcdModelDecoder
- 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:
-
decode
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- 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 decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- See Also:
-
TYPE_NAME_1_0
,TYPE_NAME_1_1
orTYPE_NAMES
instead.