use of com.revolsys.elevation.cloud.las.zip.LazDecompress in project com.revolsys.open by revolsys.
the class LasPointCloud method forEachPointLazChunked.
private void forEachPointLazChunked(final ArithmeticDecoder decoder, final LazDecompress[] pointDecompressors, final Consumer<? super LasPoint> action) {
final ChannelReader reader = this.reader;
final long chunkTableOffset = reader.getLong();
final long chunkSize = getLasZipHeader().getChunkSize();
long chunkReadCount = chunkSize;
final long pointCount = getPointCount();
for (int i = 0; i < pointCount; i++) {
final LasPoint point;
final LasPointFormat pointFormat = getPointFormat();
if (chunkSize == chunkReadCount) {
point = pointFormat.readLasPoint(this, reader);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.init(point);
}
decoder.reset();
chunkReadCount = 0;
} else {
point = pointFormat.newLasPoint(this);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.read(point);
}
}
action.accept(point);
chunkReadCount++;
}
}
use of com.revolsys.elevation.cloud.las.zip.LazDecompress in project com.revolsys.open by revolsys.
the class LasPointCloud method forEachPointLazPointwise.
private void forEachPointLazPointwise(final ArithmeticDecoder decoder, final LazDecompress[] pointDecompressors, final Consumer<? super LasPoint> action) {
final LasPointFormat pointFormat = getPointFormat();
{
final ChannelReader reader = this.reader;
final LasPoint point = pointFormat.readLasPoint(this, reader);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.init(point);
}
decoder.reset();
action.accept(point);
}
final long pointCount = getPointCount();
for (int i = 1; i < pointCount; i++) {
final LasPoint point = pointFormat.newLasPoint(this);
for (final LazDecompress pointDecompressor : pointDecompressors) {
pointDecompressor.read(point);
}
action.accept(point);
}
}
use of com.revolsys.elevation.cloud.las.zip.LazDecompress in project com.revolsys.open by revolsys.
the class LasPointCloud method newLazDecompressors.
public LazDecompress[] newLazDecompressors(final LasZipHeader lasZipHeader, final ArithmeticDecoder decoder) {
final int numItems = lasZipHeader.getNumItems();
final LazDecompress[] pointDecompressors = new LazDecompress[numItems];
for (int i = 0; i < numItems; i++) {
final LazItemType type = lasZipHeader.getType(i);
final int version = lasZipHeader.getVersion(i);
if (version < 1 || version > 2) {
throw new RuntimeException(version + " not yet supported");
}
switch(type) {
case POINT10:
if (version == 1) {
pointDecompressors[i] = new LazDecompressPoint10V1(this, decoder);
} else {
pointDecompressors[i] = new LazDecompressPoint10V2(this, decoder);
}
break;
case GPSTIME11:
if (version == 1) {
pointDecompressors[i] = new LazDecompressGpsTime11V1(decoder);
} else {
pointDecompressors[i] = new LazDecompressGpsTime11V2(decoder);
}
break;
case RGB12:
if (version == 1) {
pointDecompressors[i] = new LazDecompressRgb12V1(decoder);
} else {
pointDecompressors[i] = new LazDecompressRgb12V2(decoder);
}
break;
default:
throw new RuntimeException(type + " not yet supported");
}
}
return pointDecompressors;
}
use of com.revolsys.elevation.cloud.las.zip.LazDecompress in project com.revolsys.open by revolsys.
the class LasPointCloud method forEachPointLaz.
private void forEachPointLaz(final Consumer<? super LasPoint> action) {
try (ArithmeticDecoder decoder = new ArithmeticDecoder(this.reader);
BaseCloseable closable = this) {
final LasZipHeader lasZipHeader = getLasZipHeader();
final LazDecompress[] pointDecompressors = newLazDecompressors(lasZipHeader, decoder);
if (lasZipHeader.isCompressor(LasZipHeader.LASZIP_COMPRESSOR_POINTWISE)) {
forEachPointLazPointwise(decoder, pointDecompressors, action);
} else {
forEachPointLazChunked(decoder, pointDecompressors, action);
}
}
}
Aggregations