Search in sources :

Example 1 with LazDecompress

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++;
    }
}
Also used : ChannelReader(com.revolsys.io.channels.ChannelReader) LazDecompress(com.revolsys.elevation.cloud.las.zip.LazDecompress) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint) LasPointFormat(com.revolsys.elevation.cloud.las.pointformat.LasPointFormat) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint) Point(com.revolsys.geometry.model.Point)

Example 2 with LazDecompress

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);
    }
}
Also used : ChannelReader(com.revolsys.io.channels.ChannelReader) LazDecompress(com.revolsys.elevation.cloud.las.zip.LazDecompress) LasPointFormat(com.revolsys.elevation.cloud.las.pointformat.LasPointFormat) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint) Point(com.revolsys.geometry.model.Point)

Example 3 with LazDecompress

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;
}
Also used : LazDecompress(com.revolsys.elevation.cloud.las.zip.LazDecompress) LazDecompressRgb12V2(com.revolsys.elevation.cloud.las.zip.LazDecompressRgb12V2) LazDecompressRgb12V1(com.revolsys.elevation.cloud.las.zip.LazDecompressRgb12V1) LazDecompressPoint10V1(com.revolsys.elevation.cloud.las.zip.LazDecompressPoint10V1) LazDecompressPoint10V2(com.revolsys.elevation.cloud.las.zip.LazDecompressPoint10V2) LazItemType(com.revolsys.elevation.cloud.las.zip.LazItemType) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint) Point(com.revolsys.geometry.model.Point) LazDecompressGpsTime11V1(com.revolsys.elevation.cloud.las.zip.LazDecompressGpsTime11V1) LazDecompressGpsTime11V2(com.revolsys.elevation.cloud.las.zip.LazDecompressGpsTime11V2)

Example 4 with LazDecompress

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);
        }
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) LazDecompress(com.revolsys.elevation.cloud.las.zip.LazDecompress) ArithmeticDecoder(com.revolsys.elevation.cloud.las.zip.ArithmeticDecoder)

Aggregations

LazDecompress (com.revolsys.elevation.cloud.las.zip.LazDecompress)4 LasPoint (com.revolsys.elevation.cloud.las.pointformat.LasPoint)3 Point (com.revolsys.geometry.model.Point)3 LasPointFormat (com.revolsys.elevation.cloud.las.pointformat.LasPointFormat)2 ChannelReader (com.revolsys.io.channels.ChannelReader)2 ArithmeticDecoder (com.revolsys.elevation.cloud.las.zip.ArithmeticDecoder)1 LazDecompressGpsTime11V1 (com.revolsys.elevation.cloud.las.zip.LazDecompressGpsTime11V1)1 LazDecompressGpsTime11V2 (com.revolsys.elevation.cloud.las.zip.LazDecompressGpsTime11V2)1 LazDecompressPoint10V1 (com.revolsys.elevation.cloud.las.zip.LazDecompressPoint10V1)1 LazDecompressPoint10V2 (com.revolsys.elevation.cloud.las.zip.LazDecompressPoint10V2)1 LazDecompressRgb12V1 (com.revolsys.elevation.cloud.las.zip.LazDecompressRgb12V1)1 LazDecompressRgb12V2 (com.revolsys.elevation.cloud.las.zip.LazDecompressRgb12V2)1 LazItemType (com.revolsys.elevation.cloud.las.zip.LazItemType)1 BaseCloseable (com.revolsys.io.BaseCloseable)1