use of eu.esdihumboldt.hale.io.gml.writer.internal.geometry.Descent in project hale by halestudio.
the class MultiLineStringWriter method write.
/**
* @see GeometryWriter#write(XMLStreamWriter, Geometry, TypeDefinition,
* QName, String, DecimalFormat)
*/
@Override
public void write(XMLStreamWriter writer, MultiLineString geometry, TypeDefinition elementType, QName elementName, String gmlNs, DecimalFormat decimalFormatter) throws XMLStreamException {
for (int i = 0; i < geometry.getNumGeometries(); i++) {
if (i > 0) {
writer.writeStartElement(elementName.getNamespaceURI(), elementName.getLocalPart());
}
Descent descent = descend(// $NON-NLS-1$
writer, // $NON-NLS-1$
Pattern.parse("*/LineString"), elementType, elementName, gmlNs, false);
LineString line = (LineString) geometry.getGeometryN(i);
writeCoordinates(writer, line.getCoordinates(), descent.getPath().getLastType(), gmlNs, decimalFormatter);
descent.close();
if (i < geometry.getNumGeometries() - 1) {
writer.writeEndElement();
}
}
}
use of eu.esdihumboldt.hale.io.gml.writer.internal.geometry.Descent in project hale by halestudio.
the class AbstractGeometryWriter method descendAndWriteCoordinates.
/**
* Write coordinates into a posList or coordinates property
*
* @param writer the XML stream writer
* @param descendPattern the pattern to descend
* @param coordinates the coordinates to write
* @param elementType the type of the encompassing element
* @param elementName the encompassing element name
* @param gmlNs the GML namespace
* @param unique if the path's start element cannot be repeated
* @param decimalFormatter a decimal formatter to format geometry
* coordinates
* @throws XMLStreamException if an error occurs writing the coordinates
*/
protected static void descendAndWriteCoordinates(XMLStreamWriter writer, Pattern descendPattern, Coordinate[] coordinates, TypeDefinition elementType, QName elementName, String gmlNs, boolean unique, DecimalFormat decimalFormatter) throws XMLStreamException {
Descent descent = descend(writer, descendPattern, elementType, elementName, gmlNs, unique);
// write geometry
writeCoordinates(writer, coordinates, descent.getPath().getLastType(), gmlNs, decimalFormatter);
descent.close();
}
use of eu.esdihumboldt.hale.io.gml.writer.internal.geometry.Descent in project hale by halestudio.
the class MultiCurveWriter method write.
/**
* @see GeometryWriter#write(XMLStreamWriter, Geometry, TypeDefinition,
* QName, String, DecimalFormat)
*/
@Override
public void write(XMLStreamWriter writer, MultiLineString geometry, TypeDefinition elementType, QName elementName, String gmlNs, DecimalFormat decimalFormatter) throws XMLStreamException {
for (int i = 0; i < geometry.getNumGeometries(); i++) {
if (i > 0) {
writer.writeStartElement(elementName.getNamespaceURI(), elementName.getLocalPart());
}
Descent descent = descend(// $NON-NLS-1$
writer, // $NON-NLS-1$
Pattern.parse("*/LineString"), elementType, elementName, gmlNs, false);
LineString line = (LineString) geometry.getGeometryN(i);
writeCoordinates(writer, line.getCoordinates(), descent.getPath().getLastType(), gmlNs, decimalFormatter);
descent.close();
if (i < geometry.getNumGeometries() - 1) {
writer.writeEndElement();
}
}
}
Aggregations