5
SVG::SVG(const char* filename)
7
this->f = fopen(filename, "w");
9
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
10
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n"
11
"<svg height=\"2000\" width=\"2000\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"
12
" <marker id=\"endArrow\" markerHeight=\"8\" markerUnits=\"strokeWidth\" markerWidth=\"10\" orient=\"auto\" refX=\"1\" refY=\"5\" viewBox=\"0 0 10 10\">\n"
13
" <polyline fill=\"darkblue\" points=\"0,0 10,5 0,10 1,5\" />\n"
20
SVG::coordinate(long c)
22
return (float)unscale(c)*10;
26
SVG::AddLine(const Line &line)
29
" <line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke: black; stroke-width: 2\"",
30
this->coordinate(line.a.x), this->coordinate(line.a.y), this->coordinate(line.b.x), this->coordinate(line.b.y)
33
fprintf(this->f, " marker-end=\"url(#endArrow)\"");
34
fprintf(this->f, "/>\n");
38
SVG::AddLine(const IntersectionLine &line)
40
this->AddLine(Line(line.a, line.b));
46
fprintf(this->f, "</svg>\n");
48
printf("SVG file written.\n");