Allow export link metadata while generating output

0 votes
asked Apr 21, 2019 in Wanted features by rowanG077 (120 points)
The link feature in plantuml is really handy but it really only works with specific outputs. For instance when generating a png the entire URL information is thrown away. Many times this information is still really relevant. What I would like is the x, y coordinates and the width and height of each link in a diagram exported as a json or some orther structured way. This would allow me to take this metadata and overlay appropiate links in my tool. For instance on the web I could overlay link anchors over the png image. In latex I can generate url tags etc.

I suppose a work around could be first generating svg. Then manually extracting the links and then render again as something else. This would double the build time which I don't really like...
commented Apr 21, 2019 by albert (3,520 points)
edited Apr 21, 2019 by albert
This is not an answer to the question but some, hopefully useful, ideas.

This is an intriguing problem. As plantuml uses dot as engine I know that dot hat the output possibilities: cmapx (see also https://www.graphviz.org/doc/info/output.html).
The cmpax output produces something like:
    <map id="qq" name="qq">
    <area shape="rect" id="node1" title=" " alt="" coords="5,5,92,32"/>
    </map>
this can be process / be used in e.g. HTML.


When I use the dot program outside of plantuml I always have to issue 2 commands:
- generate the png file
- generate the map file

I was just thinking: is it possible to use these 2 outputs in one go so I tried:
    dot -Tpng -Tcmapx -o qq.png -o qq.cmapx qq.dot
and I got 2 files
- one with the png image
- one with the image map
so it looks like it is working.

It is also possible to use (see https://www.graphviz.org/doc/info/command.html#d:T and  on the same page a bit further down at the -O):
    dot -Tpng -Tcmapx -O qq.dot

I didn't look at the execution time, so I don't know whether dot does 1 "analyzing" phase and 2 outputs or 2 "analyzing" phases.
commented Apr 24, 2019 by rowanG077 (120 points)
This is exactly what I am looking for, it's nice that HTML immediately supports that output. That means only the work for other outputs has to be done. Is it possible to configure plantuml to pass the -Tcmapx parameter to dot?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...