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;
}
}
Aggregations