@LcdService(service=ILcdModelDecoder.class, priority=20000) public final class TLcdBinzModelDecoder extends Object implements ILcdModelDecoder, ILcdStatusSource
This model decoder decodes Binz files.
See the Data Formats: Binz documentation for more in-depth information on how to use
the decoder and the resulting decoded model.
You can load it directly into a LuciadLightspeed view, or create an OGC 3DTiles dataset using the
TLcdOGC3DTilesModelEncoder
.
LuciadFusion can pick this model up and expose it through an OGC 3DTiles service.
File | Required | Entry point | Description |
---|---|---|---|
*.binz | x | x | Binz archive file containing a description of the model, its materials and its meta-data. |
File | Required | Entry point | Description |
---|---|---|---|
tree0000.bin | x | x | Binz files and directories containing a description of the model, its materials and its meta-data.
These files contain the unpacked data of a .binz archive file. |
tree0000.idx.bin | |||
leaf (directory) | x | ||
meta (directory) | x |
File | Required | Entry point | Description |
---|---|---|---|
*.binz.index | x | x | A text file containing relative path names to binz datasets. All datasets will be combined into one ILcdModel. |
This decoder only supports data sources that are regular files.
Binz data does not contain geo-referencing information itself. This section describes what strategies this decoder uses to find a suitable reference for the data.
ILcdModelReferenceDecoder
. The default reference decoder set on
this model decoder is based on all model reference decoders annotated with the LcdService
annotation.
For example, you use a .prj
file with WKT information, or a .epgs
file with an EPSG code
next to the input data.
.llh
file next to the input data with a single text line
containing a longitude, latitude and height coordinate (defined in the default EPSG 4326 reference).
This will then be used as a topocentric reference to position your model in the world.
setDefaultModelReference(com.luciad.model.ILcdModelReference)
.
decoder.setDefaultModelReference(fallbackModelReference);
If no geo-reference information can be found with any of these strategies, then the data will be loaded in its
original, non-georeferenced coordinate system.
Note: Data that is decoded in its original coordinate system, can not be visualized on a
geographical map. The dataset must be geo-located with an external tool, after conversion has been done.
This is equivalent to setting a TLcdCartesianReference
as fallback reference:
decoder.setDefaultModelReference(new TLcdCartesianReference(TLcdDistanceUnit.METRE_UNIT,
TLcdDistanceUnit.METRE_UNIT,
TLcdDistanceUnit.METRE_UNIT));
This model decoder creates a ILcdModel
that does not implement any other public interface.
The domain objects in this model currently don't implement any public LuciadLightspeed API.
ILcdModelDecoder decoder = new TLcdBinzModelDecoder();
ILcdModel model = decoder.decode(sourceName);
Modifier and Type | Field and Description |
---|---|
static String |
TYPE_NAME
The type name for the decoded models.
|
Constructor and Description |
---|
TLcdBinzModelDecoder()
Create a new
TLcdBinzModelDecoder . |
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aListener)
Registers the given listener so it will receive status events from this source.
|
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.
|
ILcdModel |
decodeFeatures(String aSourceName)
Creates a model with a single domain object per Binz feature.
|
TLcdModelMetadata |
decodeModelMetadata(String aSourceName)
Decodes metadata for the specified data source.
|
ILcdModelReference |
getDefaultModelReference()
Get the default model reference.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
void |
removeStatusListener(ILcdStatusListener aListener)
Removes the specified listener so it is no longer notified.
|
void |
setDefaultModelReference(ILcdModelReference aModelReference)
Set the default model reference.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
public static final String TYPE_NAME
public TLcdBinzModelDecoder()
TLcdBinzModelDecoder
.public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public void setDefaultModelReference(ILcdModelReference aModelReference)
TLcdCartesianReference
will be used as fallback:
when no reference is found, the data will be loaded in its original non-georeferenced coordinate system.
Note that you will not be able to visualize the data on a geographical map.
If the default model reference is set to null
, and no reference information can be found,
the decode(java.lang.String) will fail.
For more details, see the class javadoc.aModelReference
- the model reference used as a default, or null
if no custom default model reference should be set.public ILcdModelReference getDefaultModelReference()
null
if no default model reference is set.setDefaultModelReference(com.luciad.model.ILcdModelReference)
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 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 TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
ILcdModelDecoder
decodeModelMetadata
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)
public ILcdModel decodeFeatures(String aSourceName) throws IOException
ILcdDataObject
(containing metadata such as linkage, moniker, aabb) and ILcdExtrudedShape
(expressing the bounds of the feature).
The reference is always EPSG:4326, except if the input data is non-referenced, then the input reference is used.
This model can be used to serve feature information over WFS, or encode to GeoJson
.
If no feature index information (tree0000.idx.bin
) is available, this method fails with IllegalArgumentException
.aSourceName
- The .binz file or tree0000.bin file or a combined .binz.zip fileIOException
- If the data cannot be read.IllegalArgumentException
- If no tree0000.idx.bin
is present.