Skip to content

Commit ddc48a3

Browse files
authored
README: clarify project and tools goals (#25)
clarify project and tools goals svg2js: improve goals
1 parent c0f40c0 commit ddc48a3

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

README.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66

77
A set of tool to convert SVG files into mxGraph resources.
88

9-
This repository is based on mxGraph svg2xml tooling: `SVG to XML mxGraph stencil definition translation tool. This was
10-
created for internal use, so there are lots of things unfinished.`
9+
This repository is based on [mxGraph svg2xml tooling](https://github.com/jgraph/svg2xml):
10+
```
11+
SVG to XML mxGraph stencil definition translation tool.
12+
This was created for internal use, so there are lots of things unfinished.
13+
```
1114

1215
It contains the original svg2xml tool; it aims to improve it and to add the following features
13-
- modernize [svg2xml](#svg2xml) and contribute improvements to the upstream repository (if it is still active and accept
14-
contributions): CLI, UI look&feel updates, implement to completed features....
15-
- add [xml2js](#xml2js): translate an XML mxGraph stencil definition into a set of corresponding javascript command for an
16+
- modernize [svg2xml](#svg2xml) and contribute improvements to the upstream repository (if it is [still active and accept
17+
contributions](https://github.com/jgraph/svg2xml/pull/13#issuecomment-619573225)): CLI, UI look&feel updates, implement to complete features....
18+
- add [xml2js](#xml2js): translate an XML mxGraph stencil definition into a set of corresponding JavaScript/TypeScript commands for an
1619
easy integration in JS programs
17-
- add [svg2js](#svg2js): convert an SVG file into a set of `mxGraph` javascript commands
18-
xml2js
20+
- add [svg2js](#svg2js): convert an SVG file into a set of `mxGraph` JavaScript/TypeScript commands
21+
1922

2023

2124
## Build
@@ -52,6 +55,8 @@ java -jar target/mxgraph-svg2shape-*-jar-with-dependencies.jar <path_to_source>
5255

5356
### GUI Quick start guide
5457

58+
**Note**: the following is taken from the [upstream repository](https://github.com/jgraph/svg2xml)
59+
5560
The left file system defines what files or folders you want to convert. The right one, defines the destination.
5661

5762
If you select one file, a single stencil XML file will be generated for just that one stencil.
@@ -79,11 +84,19 @@ If you want to reduce the size, with some compromise to precision, use rounding.
7984

8085
## `xml2js`
8186

82-
**DISCLAIMER**: this tool is at its early stage and misses a lot of features. See the GitHub issues (create one for
83-
any questions and prior submitting a Pull Request for discussions). It is mainly developed to provide the foundation for `svg2js`
87+
**DISCLAIMER**: this tool is at its early stage and misses a lot of features. See the [GitHub issues](https://github.com/process-analytics/mxgraph-svg2shape/issues)
88+
(create one for any questions and prior submitting a Pull Request for discussions). It is mainly developed to provide the foundation for `svg2js`
89+
and won't probably never support the whole mxGraph stencil format.
90+
8491

92+
**GOAL**:
93+
- translate an XML mxGraph stencil definition into a set of corresponding javascript calls for an easy integration in JS programs
94+
- the stencil definition and the JavaScript functions are very close; the names are almost the same but the arguments order is not the same
95+
(have a look at `curveTo` for instance). So the tool can save you a lot of time and avoid mistakes (you would get strange painting) compared to manual
96+
transformations
97+
- xml curve: `<curve x1='85.52' x2='39.66'..`
98+
- mxAbstractCanvas2D curveTo: `canvas.curveTo(x1, y1, x2,...`
8599

86-
**GOAL**: translate an XML mxGraph stencil definition into a set of corresponding javascript calls for an easy integration in JS programs
87100

88101
### Run
89102

@@ -109,7 +122,11 @@ canvas.fillAndStroke();
109122

110123
## `svg2js`
111124

112-
**GOAL**: convert an SVG file into a set of `mxGraph` javascript commands, by calling `svg2xml` then `xml2js`
125+
**GOAL**:
126+
- convert an SVG file into a set of `mxGraph` javascript commands, by calling `svg2xml` then `xml2js`
127+
- this is the fastest and safest way to integrate SVG into `mxGraph` shapes. That's the way used by [bpmn-visualization](https://github.com/process-analytics/bpmn-visualization-js)
128+
to manage the [BPMN](http://www.bpmn.org/) icons
129+
113130

114131
### Run
115132

0 commit comments

Comments
 (0)