Commit 629c3014 authored by Julian Frosch's avatar Julian Frosch
Browse files

Revised README, added notification, removed old test-file under res/

parent 7760b8a9
......@@ -10,7 +10,7 @@ sudo npm install electron-prebuilt -g
```
and electron will be installed!
In order to test the program, clone the repo, cd into it's directory and run
In order to test the program, clone the repo, cd into it's directory and run
```
npm install
```
......@@ -27,5 +27,37 @@ electron .
to start the application!
## Using the app
You will see the window with a *Hello World!*-Greeting and some text on the left and the developer-tools on the right.
You can just drag an SVG-File (example-file is in the res/-folder) directly onto the "Drag your SVG-File here!"-Text on the left side. Once done, the program will read the data of all paths in your file (may get an error warning if there is no such data... duh) and show the parsed data in the "console" on the right side :)
After starting, you will see a window. You can just drag'n'drop the SVG that should be approximated and the PNG (the heatmap) anywhere into the window.
The "console" at the bottom will give you feedback about the files. Note that you can also drag multiple files of each type into the window.
However, only the last one will be used for approximation.
You can adjust the desired path-lengths with the two steppers above the run button. The program will calculate corresponding values between min/max for the grayscale-amount in your heatmap.
If no heatmap is provided, the whole SVG will be approximated with maximum precision!
With everything set up, you can click the run button and let the work begin! When finished, the program will write two files into the folder where you dragged your initial files from:
* <svg-filename>_approximated.txt: only contains all linepoints of the paths (comma-separated, one path per line).
* <svg-filename>_approximated.svg: an SVG containing the approximated paths. Actually it is the "original" SVG, only the path's data-attributes are completely replaced by lines.
## Installing via electron-packager
For convenience, you can also pack this program into a single app containing the electron-framework and Google's V8-engine, so it can be run on any computer without the need to have electron or even node.js installed. You can pack it for the Linux, Windows and Darwin platform from whichever OS you may run (although it is recommended to pack it from the corresponding OS, as some modules may be compiled differently...).
For this, you need to install the electron-packager:
```
sudo npm install electron-packager -g
```
Then, cd into the program's directory and pack it! For a full functionality description, you can just
```
electron-packager
```
as this will show the help-text.
An example for building the app for Linux and Windows on the x64-arch:
```
electron-packager ./ BezLinApp --platform=linux,win32 --arch=x64 --version=0.36.3
```
Note:
* For the platform, you can submit a comma-separated list, or even put *all* for all platforms
* The version-parameter specifies the electron-version to build the app with. If in doubt, use your current version (take a look under /usr/lib/node_modules/electron-prebuilt/package.json).
* For some reason, the icon didn't work for me with this method... the icon-parameter (see options) didn't work either. Also, you need different filetypes for the different platforms.
* Windows has some serious issues with the pathname-length. Don't ask me, it's 2016 and I don't know how a modern OS can still have this problem. If you want to try it, take a look under "asar-archives" in the electron-API. With this, you can pack parts of your app into a one-file-archive and tackle this problem...
......@@ -49,11 +49,17 @@ $(function(){
}
stream.end();
printOut("Wrote to file " + filenameBase + ".txt");
/*var notification_TXTWritten = new Notification('Textfile written!', {
body: "Wrote to file " + filenameBase + ".txt"
});*/
});
// let the parser write to SVG-file
svgParser.writeSVG(filenameBase + ".svg", paths, function(err) {
printOut("Wrote to file " + filenameBase + ".svg");
var notification_SVGWritten = new Notification('SVG-file written!', {
body: "Wrote to file " + filenameBase + ".svg"
});
})
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="test_plain.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="332.16833"
inkscape:cy="340.28752"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1600"
inkscape:window-height="873"
inkscape:window-x="1920"
inkscape:window-y="300"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 96.974644,363.43815 C 407.09148,189.69191 587.90878,328.08281 587.90878,328.08281"
id="path3805"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 58.588848,588.70216 C 333.35034,443.2402 364.66507,384.65135 538.41131,478.59554 c 173.74623,93.94418 173.74623,93.94418 173.74623,93.94418"
id="path3807"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 40.406102,887.70732 c 0,0 23.233508,-203.04066 275.771648,-219.2031 252.53813,-16.16245 211.12188,-8.08122 295.97469,104.04571 84.85282,112.12693 -215.16249,203.04066 -215.16249,203.04066"
id="path3809"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 345.47217,599.81384 c 42.42641,-31.31473 153.54319,-115.15739 117.1777,-42.4264 -36.3655,72.73098 -117.1777,42.4264 -117.1777,42.4264 z"
id="path3811"
inkscape:connector-curvature="0" />
</g>
</svg>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment