use of com.revolsys.record.io.format.saif.geometry.ArcLineString in project com.revolsys.open by revolsys.
the class ArcConverter method write.
protected void write(final OsnSerializer serializer, final Object object, final boolean writeAttributes) throws IOException {
if (object instanceof LineString) {
final LineString line = (LineString) object;
serializer.startObject(this.geometryType);
serializer.fieldName("LineString");
serializer.startCollection("List");
final LineString points = line;
final int axisCount = points.getAxisCount();
for (int i = 0; i < points.getVertexCount(); i++) {
serializer.startObject(SaifConstants.POINT);
serializer.fieldName("coords");
final double x = points.getX(i);
final double y = points.getY(i);
final double z = points.getZ(i);
if (axisCount == 2) {
serializer.startObject("/Coord2D");
serializer.attribute("c1", x, true);
serializer.attribute("c2", y, false);
} else {
serializer.startObject("/Coord3D");
serializer.attribute("c1", x, true);
serializer.attribute("c2", y, true);
if (Double.isNaN(z)) {
serializer.attribute("c3", 0, false);
} else {
serializer.attribute("c3", z, false);
}
}
serializer.endObject();
serializer.endAttribute();
serializer.endObject();
}
serializer.endCollection();
serializer.endAttribute();
if (writeAttributes && line instanceof ArcLineString) {
writeAttributes(serializer, (ArcLineString) line);
}
serializer.endObject();
}
}
use of com.revolsys.record.io.format.saif.geometry.ArcLineString in project com.revolsys.open by revolsys.
the class ArcConverter method writeAttributes.
protected void writeAttributes(final OsnSerializer serializer, final ArcLineString line) throws IOException {
final String qualifier = line.getQualifier();
attributeEnum(serializer, "qualifier", qualifier);
}
use of com.revolsys.record.io.format.saif.geometry.ArcLineString in project com.revolsys.open by revolsys.
the class ContourConverter method write.
@Override
public void write(final OsnSerializer serializer, final Object object) throws IOException {
if (object instanceof LineString) {
final LineString line = (LineString) object;
serializer.startObject(GEOMETRY_CLASS);
serializer.fieldName("arc");
super.write(serializer, object);
serializer.endAttribute();
if (line instanceof ContourLineString) {
final ContourLineString contourLine = (ContourLineString) line;
final String form = contourLine.getForm();
attributeEnum(serializer, "form", form);
super.writeAttributes(serializer, (ArcLineString) line);
final int value = contourLine.getValue();
attributeEnum(serializer, "form", Integer.toString(value));
} else if (line instanceof ArcLineString) {
super.writeAttributes(serializer, (ArcLineString) line);
}
serializer.endObject();
}
}
use of com.revolsys.record.io.format.saif.geometry.ArcLineString in project com.revolsys.open by revolsys.
the class OrientedArcConverter method write.
@Override
public void write(final OsnSerializer serializer, final Object object) throws IOException {
if (object instanceof LineString) {
final LineString line = (LineString) object;
serializer.startObject(GEOMETRY_CLASS);
serializer.fieldName("arc");
super.write(serializer, object, false);
serializer.endAttribute();
if (line instanceof ArcLineString) {
super.writeAttributes(serializer, (ArcLineString) line);
}
if (line instanceof OrientedArcLineString) {
final OrientedArcLineString orientedLine = (OrientedArcLineString) line;
final String traversalDirection = orientedLine.getTraversalDirection();
attributeEnum(serializer, "traversalDirection", traversalDirection);
}
serializer.endObject();
}
}
use of com.revolsys.record.io.format.saif.geometry.ArcLineString in project com.revolsys.open by revolsys.
the class ArcDirectedConverter method writeAttributes.
@Override
protected void writeAttributes(final OsnSerializer serializer, final ArcLineString line) throws IOException {
if (line instanceof ArcDirectedLineString) {
final ArcDirectedLineString dirLine = (ArcDirectedLineString) line;
final String flowDirection = dirLine.getFlowDirection();
attributeEnum(serializer, "flowDirection", flowDirection);
}
super.writeAttributes(serializer, line);
}
Aggregations