1 18 package org.apache.batik.svggen; 19 20 import java.awt.geom.Line2D ; 21 22 import org.w3c.dom.Element ; 23 24 31 public class SVGLine extends SVGGraphicObjectConverter { 32 35 public SVGLine(SVGGeneratorContext generatorContext) { 36 super(generatorContext); 37 } 38 39 42 public Element toSVG(Line2D line) { 43 Element svgLine = 44 generatorContext.domFactory.createElementNS(SVG_NAMESPACE_URI, 45 SVG_LINE_TAG); 46 svgLine.setAttributeNS 47 (null, SVG_X1_ATTRIBUTE, doubleString(line.getX1())); 48 svgLine.setAttributeNS 49 (null, SVG_Y1_ATTRIBUTE, doubleString(line.getY1())); 50 svgLine.setAttributeNS 51 (null, SVG_X2_ATTRIBUTE, doubleString(line.getX2())); 52 svgLine.setAttributeNS 53 (null, SVG_Y2_ATTRIBUTE, doubleString(line.getY2())); 54 return svgLine; 55 } 56 } 57 | Popular Tags |