Search in sources :

Example 6 with Iox2wkb

use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.

the class Iox2gpkg method multiline2wkb.

public byte[] multiline2wkb(IomObject obj, boolean asCompoundCurve, double p, int srsId) throws Iox2wkbException {
    if (obj == null) {
        return null;
    }
    try {
        os.reset();
        int polylinec = obj.getattrvaluecount(Wkb2iox.ATTR_POLYLINE);
        Envelope env = new Envelope();
        for (int polylinei = 0; polylinei < polylinec; polylinei++) {
            IomObject polyline = obj.getattrobj(Wkb2iox.ATTR_POLYLINE, polylinei);
            CompoundCurve curve = Iox2jtsext.polyline2JTS(polyline, false, p);
            env.expandToInclude(curve.getEnvelopeInternal());
        }
        writeGeoPackageBinaryHeader(srsId, env);
        Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
        for (int polylinei = 0; polylinei < polylinec; polylinei++) {
            IomObject polyline = obj.getattrobj(Wkb2iox.ATTR_POLYLINE, polylinei);
            os.write(helper.polyline2wkb(polyline, false, asCompoundCurve, p));
        }
    } catch (IOException e) {
        throw new RuntimeException("Unexpected IO exception: " + e.getMessage());
    } catch (IoxException e) {
        throw new RuntimeException("Unexpected exception: " + e.getMessage());
    }
    return os.toByteArray();
}
Also used : IomObject(ch.interlis.iom.IomObject) CompoundCurve(ch.interlis.iom_j.itf.impl.jtsext.geom.CompoundCurve) Iox2wkb(ch.interlis.iox_j.wkb.Iox2wkb) IOException(java.io.IOException) Envelope(com.vividsolutions.jts.geom.Envelope) IoxException(ch.interlis.iox.IoxException)

Aggregations

Iox2wkb (ch.interlis.iox_j.wkb.Iox2wkb)6 IOException (java.io.IOException)6 IoxException (ch.interlis.iox.IoxException)3 CompoundCurve (ch.interlis.iom_j.itf.impl.jtsext.geom.CompoundCurve)2 IomObject (ch.interlis.iom.IomObject)1 Envelope (com.vividsolutions.jts.geom.Envelope)1 Polygon (com.vividsolutions.jts.geom.Polygon)1