@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdOSGBModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
*.osgb
files).
File | Required | Entry point | Description |
---|---|---|---|
*.lcd_osgb | x | x | A Luciad specific file which defines the origin mapping and the list of root nodes files. See the next section for more info about this file. |
File | Required | Entry point | Description |
---|---|---|---|
metadata.xml | x | x | An XML file generated by Bentley ContextCapture which defines the model reference and origin of the data set. This file does not define the paths to the root files of the data set. A heuristic will be used to derive those roots, as explained below. |
File | Required | Entry point | Description |
---|---|---|---|
*.desc | x | x | A text file generated by Airbus Street Factory which defines the root files of the data set. |
origin.txt | A text file generated by Airbus Street Factory which defines the origin of the data set. When this file is not available, the decoder will assume the origin is located at (0, 0, 0). |
ILcdModelReferenceDecoder
. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService
annotation, and can handle
<filename>.epsg
): see TLcdEPSGModelReferenceDecoder
for more info.<filename>.prj
): see TLcdWKTModelReferenceDecoder
for more info.<filename>.ref
): see TLcdModelReferenceDecoder
for more info.*.lcd_osgb
fileILcdModelReferenceDecoder
(see previous section)..lcd_osgb
,
which is the entry point for the model decoder.
This file contains an "origin" property and a "nodeList":
{ "origin": [ 663550.0, 7457852.0, 0.0 ], "nodeList": [ "Data/Tile_211200012210231200/Tile_211200012210231200.osgb", "Data/Tile_211200012210231203/Tile_211200012210231203.osgb" ] }
metadata.xml
file
The metadata.xml
file generated by Bentley ContextCapture defines the
model reference and origin of the data:
<?xml version="1.0" encoding="utf-8"?>
<ModelMetadata version="1">
<!--Spatial Reference System-->
<SRS>EPSG:32723</SRS>
<!--Origin in Spatial Reference System-->
<SRSOrigin>663550,7457852,0</SRSOrigin>
</ModelMetadata>
To retrieve the root files, the model decoder uses a heuristic.
It looks for a Data
folder next to the metadata.xml
.
It assumes the Data
folder contains a list of subdirectories, and each of those subdirectories contains
a single root file with the same name as that subdirectory but with extension .osgb
.
This is illustrated below:
metadata.xml
Data
|_ Tile_211200012201331221
| |_ Tile_211200012201331221_L13_0.osgb
| |_ Tile_211200012201331221_L14_00.osgb
| |_ ...
| |_ Tile_211200012201331221.osgb <- assumed root when present
|_ Tile_211200012210201213
| |_ Tile_211200012210201213_L13_0.osgb
| |_ Tile_211200012210201213_L14_00.osgb
| |_ ...
| |_ Tile_211200012210201213.osgb <- assumed root when present
|_ ...
*.desc
and origin.txt
filesILcdModelReferenceDecoder
.origin.txt
file. When not available, the origin is assumed to be at (0, 0, 0).*.desc
file.
The *.desc
file generated by Airbus Street Factory defines the
list of root tiles by specifying their relative paths (relative to the *.desc
file).
Tile_004_009\Tile_004_009.osgb Tile_004_010\Tile_004_010.osgb Tile_004_011\Tile_004_011.osgb Tile_005_004\Tile_005_004.osgb Tile_005_005\Tile_005_005.osgb Tile_005_006\Tile_005_006.osgb Tile_005_007\Tile_005_007.osgb Tile_005_008\Tile_005_008.osgb Tile_005_009\Tile_005_009.osgb Tile_005_010\Tile_005_010.osgb
The origin.txt
file contains the local origin of the dataset. This file consists of the x, y and z values as text separated by a space. An example file would be:
663550 7457852 0
InputStreamFactory
of this decoder when working with an .lcd_osgb
file or
a .desc
file.
When using a metadata.xml
file as entry point, the model decoder needs to find the root files which is done by finding files on the file system directly.
*.lcd_osgb
file.ILcd2DBoundsIndexedModel
.ALcdBounds.fromDomainObject(Object)
method.
TLsp3DTileLayerBuilder
.
Currently it is not possible to visualize the data on a GXY view.
String source = "my_osgb_dataset.lcd_osgb";
TLcdOSGBModelDecoder modelDecoder = new TLcdOSGBModelDecoder();
if(modelDecoder.canDecodeSource(source)){
ILcdModel model = modelDecoder.decode(source);
ILspLayer layer = TLsp3DTileLayerBuilder.newBuilder().model(model).build();
}
Modifier and Type | Field and Description |
---|---|
static String |
TYPE_NAME
The type name for the decoded models.
|
Constructor and Description |
---|
TLcdOSGBModelDecoder() |
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.
|
ILcdModelReference |
getDefaultModelReference()
Returns the model reference to be used for models when the model reference decoder is set to null.
|
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.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the decoder used to produce model references.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the model reference to be used for models when the model reference decoder is set to null.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the decoder to use to produce model references for models created with this decoder.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String TYPE_NAME
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)
public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
aDefaultModelReference
- the model reference to be used for models when the model reference
decoder is set to null.getDefaultModelReference()
public ILcdModelReference getDefaultModelReference()
setDefaultModelReference(com.luciad.model.ILcdModelReference)
public ILcdModelReferenceDecoder getModelReferenceDecoder()
setModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder)
,
setDefaultModelReference(com.luciad.model.ILcdModelReference)
public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
aModelReferenceDecoder
- the decoder to use to produce model references for models created with this decoder.getModelReferenceDecoder()
,
setDefaultModelReference(com.luciad.model.ILcdModelReference)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ILcdInputStreamFactoryCapable
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactoryCapable
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable