svgpathtoolss/test/groups.svg

162 lines
3.0 KiB
XML
Raw Normal View History

Flattening SVG groups and handling transforms (#55) * Some progress (and added CONTRIBUTING.md) * fixed documentation line-width to be PEP 8 compliant * fixed documentation line-width to be PEP 8 compliant * style changes * made some design changes * Make the Document class available when importing the library * Add a method to parse transform strings * Iterate on the implementation of the Document class * Tweaks to transform parsing implementation * Implementing a depth-first flattening of groups * Finish implementation of flatten_paths * Beginning to write tests for groups * Refactoring flatten_paths() into flatten_all_paths() * Clean up implementation of document classes * Debugging xml namespace behavior -- needs improvement * Improve the way the svg namespace is handled * Print out some paths to see that they're sane * Fix multiplication of numpy matrices -- need to use .dot() instead of operator* * Create a unit test for parsing SVG groups * Return a reference to an element instead of a copied dictionary of attributes * Add a test for <path> elements that contain a 'transform' attribute * minor docstring improvements * got rid of svg2path changes (reverted to master) * updated to match master * Remove accidental paranthesis * Remove unnecessary import * Use a default width and height of 0, as dictated by SVG specs, in case width or height is missing * Expose the CONVERSIONS and CONVERT_ONLY_PATHS constants * Fix the use of some numpy operations * Remove untested functions * Fix add_group() and write tests for adding groups and paths * Update documentation of document module * Add tests for parsing transforms * Update the module name for svg_to_paths * Improve Python3 compatibility * Try to improve compatibility * More tweaks for compatibility
2018-08-22 01:00:29 +00:00
<?xml version="1.0" ?>
<svg
baseProfile="full"
version="1.1"
viewBox="0 0 365 365"
height="100%"
width="100%"
xmlns="http://www.w3.org/2000/svg"
xmlns:test="some://testuri">
<defs/>
<g
id="matrix group"
transform="matrix(1.5 0.0 0.0 0.5 -40.0 20.0)">
<path
d="M 183,183 l 0,-50"
fill="black"
stroke="black"
stroke-width="3"
test:name="path00"/>
<g
id="scale group"
transform="scale(1.25)">
<path
d="M 122,320 l -50,0"
fill="black"
stroke="black"
stroke-width="3"
test:name="path01"/>
<g
id="nested group - empty transform"
transform="">
<path
d="M 150,200 l -50,25"
fill="black"
stroke="black"
stroke-width="3"
test:name="path02"/>
</g>
<g
id="nested group - no transform">
<path
d="M 150,200 l -50,25"
fill="black"
stroke="black"
stroke-width="3"
test:name="path03"/>
</g>
<g
id="nested group - translate"
transform="translate(20)">
<path
d="M 150,200 l -50,25"
fill="black"
stroke="black"
stroke-width="3"
test:name="path04"/>
</g>
<g
id="nested group - translate xy"
transform="
translate(20, 30)">
Flattening SVG groups and handling transforms (#55) * Some progress (and added CONTRIBUTING.md) * fixed documentation line-width to be PEP 8 compliant * fixed documentation line-width to be PEP 8 compliant * style changes * made some design changes * Make the Document class available when importing the library * Add a method to parse transform strings * Iterate on the implementation of the Document class * Tweaks to transform parsing implementation * Implementing a depth-first flattening of groups * Finish implementation of flatten_paths * Beginning to write tests for groups * Refactoring flatten_paths() into flatten_all_paths() * Clean up implementation of document classes * Debugging xml namespace behavior -- needs improvement * Improve the way the svg namespace is handled * Print out some paths to see that they're sane * Fix multiplication of numpy matrices -- need to use .dot() instead of operator* * Create a unit test for parsing SVG groups * Return a reference to an element instead of a copied dictionary of attributes * Add a test for <path> elements that contain a 'transform' attribute * minor docstring improvements * got rid of svg2path changes (reverted to master) * updated to match master * Remove accidental paranthesis * Remove unnecessary import * Use a default width and height of 0, as dictated by SVG specs, in case width or height is missing * Expose the CONVERSIONS and CONVERT_ONLY_PATHS constants * Fix the use of some numpy operations * Remove untested functions * Fix add_group() and write tests for adding groups and paths * Update documentation of document module * Add tests for parsing transforms * Update the module name for svg_to_paths * Improve Python3 compatibility * Try to improve compatibility * More tweaks for compatibility
2018-08-22 01:00:29 +00:00
<path
d="M 150,200 l -50,25"
fill="black"
stroke="black"
stroke-width="3"
test:name="path05"/>
</g>
</g>
<g
id="scale xy group"
transform="scale(0.5 1.5)">
<path
d="M 122,320 l -50,0"
fill="black"
stroke="black"
stroke-width="3"
test:name="path06"/>
</g>
<g
id="rotate group"
transform="rotate(20)">
<path
d="M 183,183 l 0,30"
fill="black"
stroke="black"
stroke-width="3"
test:name="path07"/>
</g>
<g
id="rotate xy group"
transform="rotate(45 183 183)">
<path
d="M 183,183 l 0,30"
fill="black"
stroke="black"
stroke-width="3"
test:name="path08"/>
</g>
<g
id="skew x group"
transform="skewX(5)">
<path
d="M 183,183 l 40,40"
fill="black"
stroke="black"
stroke-width="3"
test:name="path09"/>
</g>
<g
id="skew y group"
transform="skewY(5)">
<path
d="M 183,183 l 40,40"
fill="black"
stroke="black"
stroke-width="3"
test:name="path10"/>
<path
d="M 180,20 l -70,80"
fill="black"
stroke="black"
stroke-width="4"
transform="rotate(-40, 100, 100)"
test:name="path11"/>
</g>
</g>
</svg>