Class SvgWriter
- Namespace
- GeometryHelper.Export
- Assembly
- GeometryHelper.dll
Draws shapes in the plane as an SVG picture, to look at in a browser.
public sealed class SvgWriter
- Inheritance
-
SvgWriter
- Inherited Members
Remarks
The picture is fitted round everything added, with Y pointing up as in the drawing, and every line is
drawn the same width however far the picture is zoomed. Arcs and ellipses are drawn as arcs and ellipses,
not as chords, and a spline as the Bézier curves it is made of wherever SVG has them. Each shape takes a stroke
colour and, where it encloses something, a fill — any colour SVG knows, such as "red" or "#3070c0". A ray is drawn on to the edge of the picture, a line without ends across it both ways, and
Text(GeoPoint2, string, string) names a shape in it.
new SvgWriter().Add(plate, "black", "#eeeeee").Add(cut, "red").Save("cut.svg");
Methods
- Add(GeoArc2, string)
Adds an arc.
- Add(GeoCircle2, string, string)
Adds a circle.
- Add(GeoEdge2, string)
Adds an edge, straight or curved.
- Add(GeoEllipse2, string, string)
Adds an ellipse, drawn as an ellipse, turned by the direction of its major axis.
- Add(GeoFace2, string, string)
Adds a face, its holes left empty.
- Add(GeoLine2, string)
Adds a segment.
- Add(GeoPoint2, string)
Adds a point, drawn as a dot.
- Add(GeoPolygon2, string, string)
Adds a polygon.
- Add(GeoPolygonArc2, string, string)
Adds a loop with arcs.
- Add(GeoPolyline2, string)
Adds a chain.
- Add(GeoPolylineArc2, string)
Adds a chain with arcs.
- Add(GeoRay2, string)
Adds a ray, drawn from its origin to where it leaves the picture.
- Add(GeoRectangle2, string, string)
Adds a rectangle.
- Add(GeoSpline2, double, string)
Adds a spline: as the Bézier curves it is made of where SVG has them, and through chords no further from it than a tolerance where it has none.
- Add(GeoTriangle2, string, string)
Adds a triangle.
- Add(GeoXLine2, string)
Adds a line without ends, drawn across the picture from edge to edge.
- Add(GeoMesh2, string, string)
Adds a mesh, each face a closed path of its own through the corners it has.
- Add(IEnumerable<GeoTriangle2>, string, string)
Adds triangles, each a closed path of its own, such as what a triangulation gives.
- Save(string)
Writes the picture to a path, replacing whatever is there.
- Text(GeoPoint2, string, string)
Adds a label, the text starting at a point and reading upright however the picture is zoomed.
- ToString()
Gets the picture as SVG text.
- WriteTo(TextWriter)
Writes the picture to a writer.