use of ch.interlis.iom_j.itf.impl.jtsext.geom.CompoundCurve in project ili2db by claeis.
the class Iox2fgdb method polyline2wkb.
public byte[] polyline2wkb(IomObject polylineObj, boolean isSurfaceOrArea, boolean asCompoundCurve, double p, int srsId) throws IoxException {
if (polylineObj == null) {
return null;
}
byte[] ret = null;
CompoundCurve polyline = Iox2jtsext.polyline2JTS(polylineObj, false, p);
os.reset();
if (asCompoundCurve) {
int shapeType = EsriShpConstants.ShapeGeneralPolyline;
shapeType |= EsriShpConstants.shapeHasCurves;
shapeType |= (outputDimension == 3 ? EsriShpConstants.shapeHasZs : 0);
os.writeInt(shapeType);
} else {
if (outputDimension == 3) {
os.writeInt(EsriShpConstants.ShapePolylineZ);
} else {
os.writeInt(EsriShpConstants.ShapePolyline);
}
}
// boundingBox
Envelope env = polyline.getEnvelopeInternal();
os.writeDouble(env.getMinX());
os.writeDouble(env.getMinY());
os.writeDouble(env.getMaxX());
os.writeDouble(env.getMaxY());
// cParts The number of lines in the multiline.
// cPoints The total number of points for all parts.
int cPart = 1;
int cPoints = getNumPoints(polyline);
os.writeInt(cPart);
os.writeInt(cPoints);
int partStart = 0;
os.writeInt(partStart);
java.util.ArrayList<Arc> arcs = null;
if (asCompoundCurve) {
arcs = new java.util.ArrayList<Arc>();
}
java.util.ArrayList<Double> zv = null;
if (outputDimension == 3) {
zv = new java.util.ArrayList<Double>();
}
double[] zMin = new double[1];
double[] zMax = new double[1];
{
Coordinate coord = polyline.getStartPoint().getCoordinate();
if (outputDimension == 3) {
zMin[0] = coord.z;
zMax[0] = coord.z;
}
}
int startPtIdx = 0;
writePoints(polyline, false, zv, zMin, zMax, startPtIdx, arcs);
if (outputDimension == 3) {
// zMin
os.writeDouble(zMin[0]);
// zMax
os.writeDouble(zMax[0]);
// Zs[cPoints]
for (Double z : zv) {
os.writeDouble(z);
}
}
if (asCompoundCurve) {
writeArcs(arcs);
}
ret = os.toByteArray();
return ret;
}
Aggregations