SVGWriter¶
An SVG writer.
-
exception
cpip.plot.SVGWriter.
ExceptionSVGWriter
¶ Exception class for SVGWriter.
-
class
cpip.plot.SVGWriter.
SVGCircle
(theXmlStream, thePoint, theRadius, attrs=None)¶ A circle in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#CircleElement
Initialise the circle with a stream, a Coord.Pt() and a Coord.Dim() objects.
-
class
cpip.plot.SVGWriter.
SVGElipse
(theXmlStream, ptFrom, theRadX, theRadY, attrs=None)¶ An elipse in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#EllipseElement
Initialise the elipse with a stream, a Coord.Pt() and a Coord.Dim() objects.
-
class
cpip.plot.SVGWriter.
SVGGroup
(theXmlStream, attrs=None)¶ Initialise the group with a stream.
See: http://www.w3.org/TR/2003/REC-SVG11-20030114/struct.html#GElement
Sadly we can’t use
**kwargs
because of Python restrictions on keyword names. For examplestroke-width
that is not a valid keyword argument (althoughstroke_width
would be). So instead we pass in an optional dictionary {string : string, ...}
-
class
cpip.plot.SVGWriter.
SVGLine
(theXmlStream, ptFrom, ptTo, attrs=None)¶ A line in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#LineElement
Initialise the line with a stream, and two Coord.Pt() objects.
-
class
cpip.plot.SVGWriter.
SVGPointList
(theXmlStream, name, pointS, attrs)¶ An abstract class that takes a list of points, derived by polyline and polygon.
Initialise the element with a stream, a name, and a list of Coord.Pt() objects.
NOTE: The units of the points are ignored, it is up to the caller to convert them to the User Coordinate System.
-
class
cpip.plot.SVGWriter.
SVGPolygon
(theXmlStream, pointS, attrs=None)¶ A polygon in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#PolygonElement
Initialise the polygon with a stream, and a list of Coord.Pt() objects.
NOTE: The units of the points are ignored, it is up to the caller to convert them to the User Coordinate System.
-
class
cpip.plot.SVGWriter.
SVGPolyline
(theXmlStream, pointS, attrs=None)¶ A polyline in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#PolylineElement
Initialise the polyline with a stream, and a list of Coord.Pt() objects.
NOTE: The units of the points are ignored, it is up to the caller to convert them to the User Coordinate System.
-
class
cpip.plot.SVGWriter.
SVGRect
(theXmlStream, thePoint, theBox, attrs=None)¶ Initialise the rectangle with a stream, a Coord.Pt() and a Coord.Box() objects. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/shapes.html#RectElement Typical attributes: {‘fill’ : “blue”, ‘stroke’ : “black”, ‘stroke-width’ : “2”, }
-
class
cpip.plot.SVGWriter.
SVGText
(theXmlStream, thePoint, theFont, theSize, attrs=None)¶ Text in SVG. See: http://www.w3.org/TR/2003/REC-SVG11-20030114/text.html#TextElement
Initialise the text with a stream, a Coord.Pt() and font as a string and size as an integer. If thePoint is None then no location will be specified (for example for use inside a <defs> element.
-
class
cpip.plot.SVGWriter.
SVGWriter
(theFile, theViewPort, rootAttrs=None, mustIndent=True)¶ Initialise the stream with a file and Coord.Box() object. The view port units must be the same for width and depth.
-
cpip.plot.SVGWriter.
dimToTxt
(theDim)¶ Converts a Coord.Dim() object to text for SVG units.