private void appendBounds( Document doc, Element parent, String name, BxBounds bounds, Object... hints) { if (bounds == null) { bounds = new BxBounds(); } Element node = doc.createElement(name); appendVertex(doc, node, bounds.getX(), bounds.getY(), hints); if (!Arrays.asList(hints).contains(MINIMAL_OUTPUT_SIZE)) { appendVertex(doc, node, bounds.getX() + bounds.getWidth(), bounds.getY(), hints); } appendVertex( doc, node, bounds.getX() + bounds.getWidth(), bounds.getY() + bounds.getHeight(), hints); if (!Arrays.asList(hints).contains(MINIMAL_OUTPUT_SIZE)) { appendVertex(doc, node, bounds.getX(), bounds.getY() + bounds.getHeight(), hints); } parent.appendChild(node); }
private void appendVertex(Document doc, Element parent, double x, double y, Object... hints) { DecimalFormat format = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US)); if (Arrays.asList(hints).contains(MINIMAL_OUTPUT_SIZE)) { format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US)); } Element node = doc.createElement("Vertex"); node.setAttribute("x", format.format(x)); node.setAttribute("y", format.format(y)); parent.appendChild(node); }