use of com.revolsys.io.channels.ChannelReader 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.io.channels.ChannelReader in project com.revolsys.open by revolsys.
the class LasPointCloud method close.
@Override
public void close() {
final ChannelReader reader = this.reader;
this.reader = null;
if (reader != null) {
reader.close();
}
if (this.zipIn != null) {
try {
this.zipIn.close();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
use of com.revolsys.io.channels.ChannelReader 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.io.channels.ChannelReader in project com.revolsys.open by revolsys.
the class ArithmeticDecoder method renormDecoderInterval.
private void renormDecoderInterval() {
final ChannelReader reader = this.reader;
int value = this.value;
int length = this.length;
do {
// read least-significant byte
final byte b = reader.getByte();
value = value << 8 | b & 0xff;
// multiplied by 256
length <<= 8;
} while (Integer.compareUnsigned(length, AC_MIN_LENGTH) < 0);
this.value = value;
this.length = length;
}
use of com.revolsys.io.channels.ChannelReader in project com.revolsys.open by revolsys.
the class EpsgCoordinateSystems method loadCoordinateAxis.
private static IntHashMap<List<Axis>> loadCoordinateAxis() {
final IntHashMap<List<Axis>> axisesByCoordinateSystemId = new IntHashMap<>();
try (ChannelReader reader = newChannelReader("coordinateAxis")) {
while (true) {
final int coordinateSystemId = reader.getInt();
final AxisName axisName = readCode(reader, AXIS_NAMES);
final String orientation = reader.getStringUtf8ByteCount();
final Character abbreviation = (char) reader.getByte();
final UnitOfMeasure unitOfMeasure = readCode(reader, UNIT_BY_ID);
final Axis axis = new Axis(axisName, orientation, abbreviation.toString(), unitOfMeasure);
List<Axis> axises = axisesByCoordinateSystemId.get(coordinateSystemId);
if (axises == null) {
axises = new ArrayList<>();
axisesByCoordinateSystemId.put(coordinateSystemId, axises);
}
axises.add(axis);
}
} catch (final NoSuchResourceException e) {
} catch (final WrappedException e) {
if (Exceptions.isException(e, EOFException.class)) {
} else {
throw e;
}
}
return axisesByCoordinateSystemId;
}
Aggregations