1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
Marker
======
.. autoclass:: svgwrite.container.Marker
.. seealso:: http://www.w3.org/TR/SVG11/painting.html#MarkerElement
example::
dwg = svgwrite.Drawing()
# create a new marker object
marker = dwg.marker(insert=(5,5), size=(10,10))
# red point as marker
marker.add(dwg.circle((5, 5), r=5, fill='red'))
# add marker to defs section of the drawing
dwg.defs.add(marker)
# create a new line object
line = dwg.add(dwg.polyline(
[(10, 10), (50, 20), (70, 50), (100, 30)],
stroke='black', fill='none'))
# set marker (start, mid and end markers are the same)
line.set_markers(marker)
# or set markers direct as SVG Attributes 'marker-start', 'marker-mid',
# 'marker-end' or 'marker' if all markers are the same.
line['marker'] = marker.get_funciri()
# NEW in v1.1.11
# set individually markers, to just set the end marker set other markers to None or False:
line.set_markers((None, False, marker))
.. automethod:: svgwrite.container.Marker.__init__
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.ViewBox`
* :class:`svgwrite.mixins.Presentation`
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.mixins.ViewBox` interface
* **preserveAspectRatio** -- use :class:`svgwrite.mixins.ViewBox`
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).
* **refX** -- `<coordinate>` -- **insert** parameter
The x-axis coordinate of the reference point which is to be aligned exactly
at the marker position. The coordinate is defined in the coordinate system
after application of the **viewBox** and **preserveAspectRatio** attributes.
(default = "0")
* **refY** -- `<coordinate>` -- **insert** parameter
The y-axis coordinate of the reference point which is to be aligned exactly
at the marker position. The coordinate is defined in the coordinate system
after application of the **viewBox** and **preserveAspectRatio** attributes.
(default = "0")
* **markerWidth** -- `<length>` -- **size** parameter
Represents the width of the viewport into which the marker is to be fitted
when it is rendered. (default = "3")
* **markerHeight** -- `<length>` -- **size** parameter
Represents the height of the viewport into which the marker is to be fitted
when it is rendered. A value of zero disables rendering of the element.
(default = "3")
* **orient** -- ``'auto'`` | `<angle>` -- **orient** parameter
Indicates how the marker is rotated. (SVG default = "0", but for :meth:`__init__`
``'auto'`` is the default value)
.. seealso:: http://www.w3.org/TR/SVG11/painting.html#OrientAttribute
Standard SVG Attributes
-----------------------
* :doc:`Core Attributes </attributes/core>`
* :doc:`Presentation Attributes </attributes/presentation>`
|