/** * Same as <code>write</code>, but with newlines and spaces to make the * well-known text more readable. * *@param geometry a <code>Geometry</code> to process */ public void writeFormatted(Geometry geometry, Writer writer) throws IOException { writeFormatted(geometry, true, writer, precisionModel); } /**
public static String getText(Geometry geom, int textType) { switch (textType) { case GeometryType.WELLKNOWNTEXT: String wkt = wktWriter.writeFormatted(geom); return wkt; } Assert.shouldNeverReachHere(); return ""; }
public String toFormattedString() { WKTWriter writer = new WKTWriter(); return writer.writeFormatted(geometry); }
private String xml(String id, Geometry g, File wktFile, WKTWriter writer) { if (g == null) { return ""; } if (wktFile != null) { return " <" + id + " file=\"" + wktFile + "\"/>"; } String xml = ""; xml += " <" + id + ">" + StringUtil.newLine; xml += StringUtil.indent(writer.writeFormatted(g), 4) + StringUtil.newLine; xml += " </" + id + ">" + StringUtil.newLine; return xml; } }
/** * Same as <code>write</code>, but with newlines and spaces to make the * well-known text more readable. * *@param geometry a <code>Geometry</code> to process *@return a <Geometry Tagged Text> string (see the OpenGIS Simple * Features Specification), with newlines and spaces */ public String writeFormatted(Geometry geometry) { Writer sw = new StringWriter(); try { writeFormatted(geometry, true, sw, precisionModel); } catch (IOException ex) { Assert.shouldNeverReachHere(); } return sw.toString(); } /**
private String getWKTorWKB(Geometry g, boolean useWKT) { if (useWKT) return wktWriter.writeFormatted(g); return WKBWriter.toHex(wkbWriter.write(g)); }
public String getResultDisplayString(Geometry g) { if (g == null) return ""; if (g.getNumPoints() > DisplayParameters.MAX_DISPLAY_POINTS) return GeometryEditModel.toStringVeryLarge(g); return writer.writeFormatted(g); }
/** * Converts a <code>Geometry</code> to its Well-known Text representation. * *@param geometry a <code>Geometry</code> to process */ public void write(Geometry geometry, Writer writer) throws IOException { // determine the precision model PrecisionModel pm = this.precisionModel; if (pm == null) pm = geometry.getFactory().getPrecisionModel(); // write the geometry writeFormatted(geometry, isFormatted, writer, pm); }
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (flavor.equals(GEOMETRY_FLAVOR)) { return geom; } if (flavor.equals(DataFlavor.stringFlavor)) { if (isFormatted) { WKTWriter writer = new WKTWriter(); writer.setFormatted(true); writer.setMaxCoordinatesPerLine(5); String wkt = writer.writeFormatted(geom); return wkt; } return geom.toString(); } throw new UnsupportedFlavorException(flavor); } }
/** * Converts a <code>Geometry</code> to its Well-known Text representation. * *@param geometry a <code>Geometry</code> to process *@return a <Geometry Tagged Text> string (see the OpenGIS Simple * Features Specification) */ public String write(Geometry geometry) { Writer sw = new StringWriter(); // determine the precision model PrecisionModel pm = this.precisionModel; if (pm == null) pm = geometry.getFactory().getPrecisionModel(); try { writeFormatted(geometry, false, sw, pm); } catch (IOException ex) { Assert.shouldNeverReachHere(); } return sw.toString(); }
void printFormatted(Geometry geom) { WKTWriter writer = new WKTWriter(); System.out.println(writer.writeFormatted(geom)); }
private String supplement(String message) throws ParseException { String newMessage = "\n" + message + "\n"; newMessage += "Original: " + wktWriter.writeFormatted(getOriginal()) + "\n"; newMessage += "Buffer Distance: " + bufferDistance + "\n"; newMessage += "Buffer: " + wktWriter.writeFormatted(getBuffer()) + "\n"; return newMessage.substring(0, newMessage.length() - 1); }