@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdLASModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable, ILcdStatusSource
.las
) and LASzip files (.laz
).
This decoder supports versions 1.0, 1.1, 1.2, 1.3 and 1.4 for the LASer format.
For the LASzip format, versions 1.0, 1.1, 1.2 and 1.3 are supported, version 1.4 is not currently supported.
File | Required | Entry point | Description |
---|---|---|---|
*.las | X | X | The LASer file |
*.laz | X | X | The LASzip file |
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.inputStreamFactory
of this decoder.
ILcdBounded
(which returns the extent of the data).TLcdLASModelDescriptor
.
The model descriptor contains various properties available in the .las
header, as well as the variable-length records.
ILcdGridReference
or ILcdGeodeticReference
..las
file variable-length record.By default, this model decoder loads up to 1000000L points of the file, spread over the whole range of points. This way, you still see a lower-resolution version of the data that is otherwise too large to load.
You can increase or decrease the maximum number of points to load using setMaxNumberOfPoints(long)
.
TLspLIDARLayerBuilder
.decode()
method, but later.
ILcdModelDecoder decoder = new TLcdLASModelDecoder();
ILcdModel model = decoder.decode( "data.las" );
TLcdLockUtil#readLock(Object)
when accessing
elements in the model..las
): version 1.0, 1.1, 1.2, 1.3 and 1.4.laz
): version 1.0, 1.1, 1.2 and 1.3Constructor and Description |
---|
TLcdLASModelDecoder()
Creates a new LAS model decoder with the default settings.
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aStatusListener)
Registers the given listener so it will receive status events from this model decoder.
|
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.
|
TLcdModelMetadata |
decodeModelMetadata(String aSourceName)
Decodes metadata for the specified data source.
|
ILcdModelReference |
getDefaultModelReference()
Returns the default model reference that is assigned to decoded models
whose files don't specify model references.
|
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 currently used for creating input streams given
source names.
|
long |
getMaxNumberOfPoints()
Returns the maximum number of points that is kept in the model after decoding.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the model reference decoder that is used for files that
don't specify model references.
|
ILcdFilter<ILcdDataObject> |
getPointFilter()
Returns the filter used to omit points during decoding.
|
boolean |
isPerformBoundsAndRangeScan()
Returns whether or not to perform a (fast) data scan when decoding a dataset.
|
boolean |
isSupportGeoidDatums()
Returns whether the geodetic datums of the decoded model references may be geoid datums.
|
void |
removeStatusListener(ILcdStatusListener aStatusListener)
Removes the specified listener so it is no longer notified.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the default model reference to be assigned to decoded models whose
files don't specify model references.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams given source names.
|
void |
setMaxNumberOfPoints(long aMaxNumberOfPoints)
Sets the maximum number of points kept during decoding.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder that will be used for files that don't specify model
references.
|
void |
setPerformBoundsAndRangeScan(boolean aPerformBoundsAndRangeScan)
Sets whether or not to perform a (fast) data scan when decoding a dataset.
|
void |
setPointFilter(ILcdFilter<ILcdDataObject> aPointFilter)
Sets the filter used to omit points during decoding.
|
void |
setSupportGeoidDatums(boolean aSupportGeoidDatums)
Specifies whether the geodetic datums of the decoded model references may be geoid datums
(like EGM96), instead of the default ellipsoid datums (like WGS84).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdLASModelDecoder()
Creates a new LAS model decoder with the default settings.
model reference decoder
: a reference decoder that supports .ref
, .prj
and .epsg
filesdefault model reference
: not set (null
)support geoid datums
: false
input stream factory
: a TLcdInputStreamFactory
maximum number of points
: 1000000Lpoint filter
: not set (null
)public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void addStatusListener(ILcdStatusListener aStatusListener)
Note that the model produced by this model decoder is lazy-loading: most of the decoding work is
done when the model is accessed, not during the decode(java.lang.String)
itself.
The status listeners will therefor receive the status events not only during the decode(java.lang.String)
itself, but also
later when the model is accessed, after the decode has finished.
You can expect the following event flow multiple times:
START_BUSY
PROGRESS
with a progress values between 0 and 1END_BUSY
addStatusListener
in interface ILcdStatusSource
aStatusListener
- The listener to be notified when the status has changed.public void removeStatusListener(ILcdStatusListener aStatusListener)
ILcdStatusSource
removeStatusListener
in interface ILcdStatusSource
aStatusListener
- The listener to remove.public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
aModelReferenceDecoder
- the model reference decoder.public ILcdModelReferenceDecoder getModelReferenceDecoder()
setModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder)
public boolean isPerformBoundsAndRangeScan()
TLcdLASModelDescriptor.getPropertyRange(com.luciad.datamodel.TLcdDataProperty)
.
The default value of this property is true
.public void setPerformBoundsAndRangeScan(boolean aPerformBoundsAndRangeScan)
TLcdLASModelDescriptor.getPropertyRange(com.luciad.datamodel.TLcdDataProperty)
.
Disabling this functionality speeds up model decoding, but property ranges cannot be queried.aPerformBoundsAndRangeScan
- if true, point data is scanned when opening a dataset.
If false, the bounds of the headers are used and no property range will be
available.public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
aDefaultModelReference
- the default model reference.public ILcdModelReference getDefaultModelReference()
public void setSupportGeoidDatums(boolean aSupportGeoidDatums)
Specifies whether the geodetic datums of the decoded model references may be geoid datums (like EGM96), instead of the default ellipsoid datums (like WGS84). A geoid typically varies smoothly between -110m and +90m around the ellipsoid. Geoid datums are more accurate for elevation data, but they require more memory and more processing time when they are being used in transformation calculations.
false
by default.
aSupportGeoidDatums
- true
to support geoid datumsisSupportGeoidDatums()
public boolean isSupportGeoidDatums()
setSupportGeoidDatums(boolean)
public long getMaxNumberOfPoints()
setMaxNumberOfPoints(long)
public void setMaxNumberOfPoints(long aMaxNumberOfPoints)
Sets the maximum number of points kept during decoding.
The points that are kept will be spread over the whole range of points, so that
you still see a lower-resolution version of the data. See also performance note in
TLspLIDARLayerBuilder
.
The default is 1000000L.
Use Long.MAX_VALUE
to make sure that all points are always kept during decoding.
aMaxNumberOfPoints
- the maximum number of points kept during decoding.getMaxNumberOfPoints()
public ILcdFilter<ILcdDataObject> getPointFilter()
null
.setPointFilter(com.luciad.util.ILcdFilter)
public void setPointFilter(ILcdFilter<ILcdDataObject> aPointFilter)
Sets the filter used to omit points during decoding. When this filter returns false
, the
given points is not added to the decoded model. Note that implementations of this filter should not
hold on to the points as they may become invalid afterwards.
It is possible that points are already filtered because a max number of points is set on this model decoder. In that case, the given filter is applied on the remaining points.
aPointFilter
- the filter used to omit domain objects during decoding. Can be null
.getPointFilter()
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 TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
decodeModelMetadata
in interface ILcdModelDecoder
aSourceName
- the data source for which the model metadata will be decoded.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)