org.openlr.binary.writer.RectangleLocationReferenceWriter Maven / Gradle / Ivy
The newest version!
package org.openlr.binary.writer;
import org.openlr.binary.format.Status;
import org.openlr.locationreference.RectangleLocationReference;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
class RectangleLocationReferenceWriter {
private final StatusWriter statusWriter;
private final CoordinateWriter coordinateWriter;
RectangleLocationReferenceWriter(StatusWriter statusWriter, CoordinateWriter coordinateWriter) {
this.statusWriter = statusWriter;
this.coordinateWriter = coordinateWriter;
}
void write(RectangleLocationReference rectangleLocationReference, ByteArrayOutputStream outputStream) throws IOException {
Status status = new Status(3, false, 2, false);
statusWriter.write(status, outputStream);
coordinateWriter.writeAbsoluteCoordinate(rectangleLocationReference.getLowerLeft(), outputStream);
coordinateWriter.writeRelativeCoordinate(rectangleLocationReference.getUpperRight(), rectangleLocationReference.getLowerLeft(), outputStream);
}
}