/// <summary> /// Draws an Ellipse to the SVG string /// </summary> /// <param name="pen"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="size"></param> /// <param name="size2"></param> public override void DrawEllipse(Pen pen, int x, int y, int size, int size2) { int xnew, ynew, newsize; newsize = size / 2; xnew = x + (newsize); ynew = y + (newsize); string svg = String.Format("<circle cx=\"{0}\" cy=\"{1}\" r=\"{2}\" stroke-width=\"1\" fill=\"none\" stroke=\"black\" />", xnew, ynew, newsize); ExportString.Append(svg); }
public override string Export() { ExportString.Append("\n\\end{tikzpicture}\n\\end{document}"); return(ExportString.ToString()); }
public override void DrawLine(Pen pen, int x, int y, int x2, int y2) { ExportString.Append(String.Format("\n\\draw ({0},{1}) -- ({2},{3});", x / scalefactor, -y / scalefactor, x2 / scalefactor, -y2 / scalefactor)); }
public override void DrawEllipse(Pen pen, int x, int y, int size, int size2) { // These numbers are an approximation because LateX uses different scales // The circle is slightly misaligned but fixing that would be a lot of trial and error and doesn't have anything to do with the subject matter. ExportString.Append(String.Format("\n\\draw ({0},{1}) circle ({2}cm);", 1.45 * x / (scalefactor), 1.45 * -y / (scalefactor), size / (scalefactor * 2))); }
/// <summary> /// Builds the SVGString and returns it /// </summary> /// <returns></returns> public override string Export() { ExportString.Append("</svg>"); return(ExportString.ToString()); }
// Draws a Line to the SVG string public override void DrawLine(Pen pen, int x, int y, int x2, int y2) { ExportString.Append(String.Format("<line x1=\"{0}\" y1=\"{1}\" x2=\"{2}\" y2=\"{3}\" style=\"fill:none; stroke:black; stroke - width:1\" />", x, y, x2, y2)); }