gws.tools.svg¶
Convert an SvgFragment to a list of Tags.
A fragment has three components:
a list of xml2.Tags (which are just tuples)
a list of points, in the map coordinate system
a list of named styles
The idea is to represent client-side svg drawings (e.g. dimensions) in a resolution-independent way
The fragment is converted as follows:
points are converted to pixels
tags’ attributes are iterated. If any attribute value is an array, it’s assumed to be a ‘function’
‘class’ attributes are replaced with inline styles from the .styles list
Attribute ‘functions’ are
- ‘’ (empty function), [‘’, index, component] - returns pixels[index][component],
where component is 0 for x, 1 for y
- ‘rotate’ [‘rotate’, index1, index2, index3] - computes a slope between pixels[index1] and pixels[index2]
and returns a string rotate(slope, pixels[index3]).