All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy