1. Manfred Moitzi
  2. svgwrite

Commits

Manfred Moitzi  committed cbc9041

added Marker class

  • Participants
  • Parent commits d625187
  • Branches default

Comments (0)

Files changed (5)

File doc/classes/Marker.rst

View file
+:class:`Marker` objects --- <marker>
+====================================
+
+.. autoclass:: svgwrite.container.Symbol
+
+Inherited Attributes
+--------------------
+
+.. attribute:: Marker.attribs
+
+   `dict` of SVG attributes
+
+.. attribute:: Marker.elements
+
+   `list` of SVG subelements
+
+Inherited Methods
+-----------------
+
+.. automethod:: svgwrite.container.Marker.add(element)
+
+.. automethod:: svgwrite.container.Marker.tostring()
+
+.. automethod:: svgwrite.container.Marker.get_xml()
+
+Supported Interfaces
+--------------------
+
+:class:`svgwrite.interface.IViewBox`
+    :meth:`viewbox`, :meth:`stretch`, :meth:`fit`
+
+Used Mixins
+-----------
+
+:class:`svgwrite.mixins.Presentation`
+
+    :meth:`fill`, :meth:`stroke`, :meth:`dasharray`
+
+SVG attributes
+--------------
+
+* **class** -- `string` assigns one or more css-class-names to an element
+* **style** -- `string` allows per-element css-style rules to be specified
+  directly on a given element
+* **externalResourcesRequired** -- `bool` *False*: if document rendering
+  can proceed even if external resources are unavailable else: *True*
+* **viewBox** -- use :class:`svgwrite.interface.IViewBox` interface
+* **preserveAspectRatio** -- use :class:`svgwrite.interface.IViewBox`
+  interface
+* **markerUnits** -- ``'strokeWidth|userSpaceOnUse'``
+  Defines the coordinate system for attributes **markerWidth**, **markerHeight**
+  and the contents of the **marker**.
+
+  If markerUnits=``'strokeWidth'``, **markerWidth**,
+  **markerHeight** and the contents of the **marker** represent values in a coordinate
+  system which has a single unit equal the size in user units of the current
+  stroke width in place for the graphic object referencing the marker.
+
+  If markerUnits=``'userSpaceOnUse'``, **markerWidth**, **markerHeight** and the
+  contents of the **marker** represent values in the current user coordinate
+  system in place for the graphic object referencing the marker (i.e., the
+  user coordinate system for the element referencing the **marker** element via
+  a **marker**, **marker-start**, <marker-mid** or **marker-end** property).
+
+Standard SVG Attributes
+-----------------------
+
+* :doc:`Core Attributes </attributes/core>`
+* :doc:`Graphical Event Attributes </attributes/graphical_event>`
+* :doc:`Presentation Attributes </attributes/presentation>`

File doc/index.rst

View file
    classes/group
    classes/defs
    classes/symbol
+   classes/marker
    classes/use
    classes/hyperlink
 

File doc/overview.rst

View file
    classes/group
    classes/defs
    classes/symbol
+   classes/marker
    classes/use
    classes/hyperlink
 

File svgwrite/container.py

View file
 * :class:`svgwrite.SVG`
 * :class:`svgwrite.Defs`
 * :class:`svgwrite.Symbol`
+* :class:`svgwrite.Marker`
 * :class:`svgwrite.Use`
 * :class:`svgwrite.Hyperlink`
 
     # ITransform interface is not valid for Symbol -> do not inherit from Group
     elementname = 'symbol'
 
+class Marker(BaseElement, IViewBox, Presentation):
+    """ The <marker> element defines the graphics that is to be used for
+    drawing arrowheads or polymarkers on a given <path>, <line>, <polyline>
+    or <polygon> element.
+    """
+    elementname = 'marker'
+
 class SVG(Symbol):
     """ An SVG document fragment consists of any number of SVG elements contained
     within an <svg> element.

File svgwrite/data/full11.py

View file
     children=frozenset(['set', 'title', 'height', 'width', 'result', 'y', 'x', 'animate', 'metadata', 'desc'])),
 
     'font': SVGElement('font',
-    attributes=frozenset(['xml:base', 'xml:space', 'R', 'id', 'a', 'c', 'e', 'd', 'g', 'i', 'h', '-', 'l', 'o', 'n', 'q', 's', 'r', 'u', 't', 'v', 'y', 'x', 'z', 'xml:lang']),
+    attributes=frozenset(['xml:space', 'id', 'xml:lang', 'xml:base', 'class', 'style', 'externalResourcesRequired', 'horiz-origin-x', 'horiz-origin-y', 'horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y']),
     properties=presentation_attributes,
     children=frozenset(['title', 'metadata', 'missing-glyph', 'font-face', 'vkern', 'hkern', 'glyph', 'desc'])),
 
     children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
 
     'glyph': SVGElement('glyph',
-    attributes=frozenset(['xml:base', 'm', 'xml:space', 'id', 'a', 'c', 'b', 'e', 'd', 'g', 'f', 'i', 'h', '-', 'l', 'o', 'n', 'p', 's', 'r', 'u', 't', 'v', 'y', 'x', 'z', 'xml:lang']),
+    attributes=frozenset(['xml:base', 'xml:space', 'id', 'xml:lang', 'class', 'style','d','horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y', 'unicode', 'glyph-name', 'orientation', 'arabic-form', 'lang']),
     properties=presentation_attributes,
     children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
 
     children=frozenset(['set', 'title', 'animate', 'animateTransform', 'stop', 'metadata', 'desc'])),
 
     'marker': SVGElement('marker',
-    attributes=frozenset(['xml:space', 'id', 'xml:lang', 'A', 'B', 'xml:base', 'H', 'R', 'U', 'W', 'Y', 'X', 'a', 'c', 'e', 'd', 'g', 'f', 'i', 'h', 'k', 'm', 'l', 'o', 'n', 'q', 'p', 's', 'r', 'u', 't', 'w', 'v', 'y', 'x']),
+    attributes=frozenset(['xml:space', 'id', 'xml:lang', 'xml:base', 'class', 'style', 'externalResourcesRequired', 'viewBox', 'preserveAspectRatio', 'refX', 'refY', 'markerUnits', 'markerWidth',  'markerHeight', 'orient']),
     properties=presentation_attributes,
     children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
 
     children=frozenset(['*'])),
 
     'missing-glyph': SVGElement('missing-glyph',
-    attributes=frozenset(['xml:base', 'xml:space', 'id', 'a', 'c', 'e', 'd', 'g', 'i', 'h', '-', 'l', 'o', 'n', 's', 'r', 't', 'v', 'y', 'x', 'z', 'xml:lang']),
+    attributes=frozenset(['xml:base', 'xml:space', 'id', 'xml:lang', 'class', 'style', 'd', 'horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y']),
     properties=presentation_attributes,
     children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),