/**
* @see org.newdawn.slick.svg.inkscape.ElementProcessor#process(org.newdawn.slick.svg.Loader, org.w3c.dom.Element, org.newdawn.slick.svg.Diagram, org.newdawn.slick.geom.Transform)
*/
public void process(Loader loader, Element element, Diagram diagram, Transform t) throws ParsingException {
Transform transform = Util.getTransform(element);
transform = new Transform(transform, t);
float x1;
float y1;
float x2;
float y2;
if (element.getNodeName().equals("line")) {
x1 = Float.parseFloat(element.getAttribute("x1"));
x2 = Float.parseFloat(element.getAttribute("x2"));
y1 = Float.parseFloat(element.getAttribute("y1"));
y2 = Float.parseFloat(element.getAttribute("y2"));
} else {
String points = element.getAttribute("d");
StringTokenizer tokens = new StringTokenizer(points, ", ");
Polygon poly = new Polygon();
if (processPoly(poly, element, tokens) == 2) {
x1 = poly.getPoint(0)[0];
y1 = poly.getPoint(0)[1];
x2 = poly.getPoint(1)[0];
y2 = poly.getPoint(1)[1];
} else {
return;
}
}
float[] in = new float[] {x1,y1,x2,y2};
float[] out = new float[4];
transform.transform(in,0,out,0,2);
Line line = new Line(out[0],out[1],out[2],out[3]);
NonGeometricData data = Util.getNonGeometricData(element);
data.addAttribute("x1",""+x1);
data.addAttribute("x2",""+x2);