@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdOGC3DTilesModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
ILcdModel
.
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.
InputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.
ILcdDataModelDescriptor
. Although the elements in the
model are not data objects
themselves, you can still use
the data model to access properties of individual points to build
expressions
for use in styling. Use
ILcdDataModelDescriptor.getModelTypes()
to obtain the single data type that
consists of the properties available in the PNTS data.
Object
.
ILcdModelDecoder decoder = new TLcdOGC3DTilesModelDecoder();
ILcdModel model = decoder.decode("tileset.json");
tileset.json
with full metadata support, including property values and ranges.json
) with batched 3D model (.b3dm
) or point cloud (.pnts
) contents. //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);
Modifier and Type | Field and Description |
---|---|
static String |
TYPE_NAME
The type name for the decoded models.
|
Constructor and Description |
---|
TLcdOGC3DTilesModelDecoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String TYPE_NAME
public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactoryCapable
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ILcdInputStreamFactoryCapable
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)