| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A set of tool to convert SVG files into mxGraph resources.
This repository is based on mxGraph svg2xml tooling:
SVG to XML mxGraph stencil definition translation tool. This was created for internal use, so there are lots of things unfinished.
It contains the original svg2xml tool; it aims to improve it and to add the following features
NOTE: The main purpose of this repository is to provide the svg2js tool and to use it when developing bpmn-visualization.
Requirements: JDK 8+ The build relies on Maven; the project uses the Maven Wrapper, no need to install Maven as the wrapper manages this for you.
WARNING: the tests are known to fail when running with JDK 21!
./mvnw package
Note about branches in this repository
You can run svg2xml with or without GUI.
java -jar target/mxgraph-svg2shape-*-jar-with-dependencies.jar
java -jar target/mxgraph-svg2shape-*-jar-with-dependencies.jar <path_to_source> <path_to_destination>
Note: the following is taken from the upstream repository
The left file system defines what files or folders you want to convert. The right one, defines the destination.
If you select one file, a single stencil XML file will be generated for just that one stencil.
If you select multiple files, a single stencil XML file will be generated for the selected stencils. So those stencils will be one library.
If you select a folder, all the files in the folder and all subfolders will be processed. Every folder will get one library created. So at the destination, all folders from the source path will be recreated and libraries will be named after folder names.
NOTE: most of the options aren't implemented yet (as noted in the UI). Also some of the options are not thoroughly tested.
If checked, stencil borders will be calculated based on content. If unchecked, the borders or viewpoint defined in the SVG will be used.
If other than 1.00, the resulting stencils will be bigger or smaller compared to the source.
If you want to reduce the size, with some compromise to precision, use rounding. For stencils bigger than 100x100 rounding to 2 decimal points is usually a decent choice.
DISCLAIMER: this tool is at its early stage and misses a lot of features. See the GitHub issues (create one for any questions and prior submitting a Pull Request for discussions). It is mainly developed to provide the foundation for svg2js and won't probably never support the whole mxGraph stencil format.
GOAL:
xml2js required the following arguments
java -cp target/mxgraph-svg2shape-*-jar-with-dependencies.jar com.mxgraph.xml2js.Xml2Js <path_to_source>
The tool writes the generated code in the console
// shape: shape-01
// width: 30.5
// height: 40.2
// foreground
canvas.begin();
canvas.moveTo(19.87, 0);
canvas.curveTo(11.98, 0, 5.55, 6.42, 5.55, 14.32);
canvas.lineTo(5.55, 18.4);
canvas.close();
canvas.fillAndStroke();GOAL:
svg2js required the following arguments
java -cp target/mxgraph-svg2shape-*-jar-with-dependencies.jar com.mxgraph.svg2js.Svg2Js <path_to_source>
| Back | FazBrowse Home | New Git URL |