+
+ }
+ else if (strcmp(child.name(), "line") == 0)
+ {
+ Real x0(child.attribute("x1").as_float());
+ Real y0(child.attribute("y1").as_float());
+ Real x1(child.attribute("x2").as_float());
+ Real y1(child.attribute("y2").as_float());
+ TransformXYPair(x0,y0,transform);
+ TransformXYPair(x1,y1,transform);
+ AddBezier(Bezier(x0,y0,x1,y1,x1,y1,x1,y1));
+ }
+ else if (strcmp(child.name(), "rect") == 0)
+ {
+ Real coords[4];
+ const char * attrib_names[] = {"x", "y", "width", "height"};
+ for (size_t i = 0; i < 4; ++i)
+ coords[i] = child.attribute(attrib_names[i]).as_float();
+
+ Real x2(coords[0]+coords[2]);
+ Real y2(coords[1]+coords[3]);
+ TransformXYPair(coords[0],coords[1],transform); // x, y, transform
+ TransformXYPair(x2,y2,transform);
+ coords[2] = x2 - coords[0];
+ coords[3] = y2 - coords[1];
+
+ bool outline = !(child.attribute("fill") && strcmp(child.attribute("fill").as_string(),"none") != 0);
+ Add(outline?RECT_OUTLINE:RECT_FILLED, Rect(coords[0], coords[1], coords[2], coords[3]),0);
+ }
+ else if (strcmp(child.name(), "circle") == 0)
+ {
+ Real cx = child.attribute("cx").as_float();
+ Real cy = child.attribute("cy").as_float();
+ Real r = child.attribute("r").as_float();
+
+ Real x = (cx - r);
+ Real y = (cy - r);
+ TransformXYPair(x,y,transform);
+ Real w = Real(2)*r*transform.a; // width scales
+ Real h = Real(2)*r*transform.d; // height scales
+
+
+ Rect rect(x,y,w,h);
+ Add(CIRCLE_FILLED, rect,0);
+ Debug("Added Circle %s", rect.Str().c_str());
+ }
+ else if (strcmp(child.name(), "text") == 0)
+ {
+ Real x = child.attribute("x").as_float();
+ Real y = child.attribute("y").as_float();
+ TransformXYPair(x,y,transform);
+ Debug("Add text \"%s\"", child.child_value());
+ AddText(child.child_value(), 0.05, x, y);