Search in sources :

Example 11 with LasPoint

use of com.revolsys.elevation.cloud.las.pointformat.LasPoint in project com.revolsys.open by revolsys.

the class LasPointCloud method forEachPoint.

@Override
public void forEachPoint(final Consumer<? super LasPoint> action) {
    final long pointCount = getPointCount();
    try {
        final ChannelReader reader = this.reader;
        if (reader == null) {
            this.points.forEach(action);
        } else if (pointCount == 0) {
            this.reader = null;
        } else if (this.header.isLaszip()) {
            forEachPointLaz(action);
        } else {
            try (BaseCloseable closable = this) {
                final LasPointFormat pointFormat = getPointFormat();
                for (int i = 0; i < pointCount; i++) {
                    final LasPoint point = pointFormat.readLasPoint(this, reader);
                    action.accept(point);
                }
            }
        }
    } finally {
        this.reader = null;
    }
}
Also used : BaseCloseable(com.revolsys.io.BaseCloseable) ChannelReader(com.revolsys.io.channels.ChannelReader) 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)

Aggregations

LasPoint (com.revolsys.elevation.cloud.las.pointformat.LasPoint)11 LasPointFormat (com.revolsys.elevation.cloud.las.pointformat.LasPointFormat)3 Point (com.revolsys.geometry.model.Point)3 ChannelReader (com.revolsys.io.channels.ChannelReader)3 LazDecompress (com.revolsys.elevation.cloud.las.zip.LazDecompress)2 BaseCloseable (com.revolsys.io.BaseCloseable)1