use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.
the class Iox2gpkg method multicoord2wkb.
public Object multicoord2wkb(IomObject obj, int srsId) throws Iox2wkbException {
if (obj == null) {
return null;
}
try {
os.reset();
writeGeoPackageBinaryHeader(srsId, null);
// wkb
Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
os.write(helper.multicoord2wkb(obj));
} catch (IOException e) {
throw new RuntimeException("Unexpected IO exception: " + e.getMessage());
}
return os.toByteArray();
}
use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.
the class Iox2gpkg method polyline2wkb.
/**
* Converts a POLYLINE to a JTS CoordinateList.
* @param polylineObj INTERLIS POLYLINE structure
* @param isSurfaceOrArea true if called as part of a SURFACE conversion.
* @param p maximum stroke to use when removing ARCs
* @return JTS CoordinateList
* @throws Iox2wkbException
*/
public byte[] polyline2wkb(IomObject obj, boolean isSurfaceOrArea, boolean asCompoundCurve, double p, int srsId) throws Iox2wkbException {
if (obj == null) {
return null;
}
try {
os.reset();
CompoundCurve surface = Iox2jtsext.polyline2JTS(obj, false, p);
writeGeoPackageBinaryHeader(srsId, surface.getEnvelopeInternal());
// wkb
Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
os.write(helper.polyline2wkb(obj, isSurfaceOrArea, 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();
}
use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.
the class Iox2gpkg method surface2wkb.
/**
* Converts a SURFACE to a JTS Polygon.
* @param obj INTERLIS SURFACE structure
* @param strokeP maximum stroke to use when removing ARCs
* @return JTS Polygon
* @throws Iox2wkbException
*/
public byte[] surface2wkb(// SurfaceOrAreaType type)
IomObject obj, // SurfaceOrAreaType type)
boolean asCurvePolygon, // SurfaceOrAreaType type)
double strokeP, // SurfaceOrAreaType type)
int srsId) throws Iox2wkbException {
if (obj == null) {
return null;
}
try {
os.reset();
Polygon surface = Iox2jtsext.surface2JTS(obj, strokeP);
writeGeoPackageBinaryHeader(srsId, surface.getEnvelopeInternal());
// wkb
Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
os.write(helper.surface2wkb(obj, asCurvePolygon, strokeP));
} catch (IOException e) {
throw new RuntimeException("Unexpected IO exception: " + e.getMessage());
} catch (IoxException e) {
throw new RuntimeException("Unexpected exception: " + e.getMessage());
}
return os.toByteArray();
}
use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.
the class Iox2gpkg method coord2wkb.
/**
* Converts a COORD to a JTS Coordinate.
* @param value INTERLIS COORD structure.
* @return JTS Coordinate.
* @throws Iox2wkbException
*/
public byte[] coord2wkb(IomObject obj, int srsId) throws Iox2wkbException {
if (obj == null) {
return null;
}
try {
os.reset();
writeGeoPackageBinaryHeader(srsId, null);
// wkb
Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
os.write(helper.coord2wkb(obj));
} catch (IOException e) {
throw new RuntimeException("Unexpected IO exception: " + e.getMessage());
}
return os.toByteArray();
}
use of ch.interlis.iox_j.wkb.Iox2wkb in project ili2db by claeis.
the class Iox2gpkg method multisurface2wkb.
public byte[] multisurface2wkb(// SurfaceOrAreaType type)
IomObject obj, // SurfaceOrAreaType type)
boolean asCurvePolygon, // SurfaceOrAreaType type)
double strokeP, // SurfaceOrAreaType type)
int srsId) throws Iox2wkbException {
if (obj == null) {
return null;
}
try {
os.reset();
writeGeoPackageBinaryHeader(srsId, null);
// wkb
Iox2wkb helper = new Iox2wkb(outputDimension, os.order());
os.write(helper.multisurface2wkb(obj, asCurvePolygon, strokeP));
} catch (IOException e) {
throw new RuntimeException("Unexpected IO exception: " + e.getMessage());
}
return os.toByteArray();
}
Aggregations