Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG output support #3

Open
miilic opened this issue Mar 7, 2017 · 1 comment
Open

SVG output support #3

miilic opened this issue Mar 7, 2017 · 1 comment

Comments

@miilic
Copy link

miilic commented Mar 7, 2017

It would be rather convenient to have the ability to output in SVG format, since SVG files are much more friendly for editing and scaling. I tried adding that to Python rendering script (using svgwrite library), but it became painfully slow once I added the slope lines to output.
In the end I hacked something together in C++, adding the MapGenerator::outputSvgData and a couple of small helper functions to MapGenerator class.
SVG generation is pretty straight-forward, and it comes with an unexpected benefit of not having to calculate and pass label text extents for background covering, since SVG filtering can be employed to do that automagically. I used to a simple semi-opaque white to cover label backgrounds, but the specifics are easily editable.
Patch and a couple of output SVG files (B&W vs color) are attached. I verified those SVG files by opening and editing them in Inkscape, in case your SVG viewer of choice is giving you trouble.
Thanks for an awesome application and a great educational write-up on how it all works together!
svg_output.zip

@psi29a
Copy link

psi29a commented Mar 9, 2017

Could make a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants