archi icon indicating copy to clipboard operation
archi copied to clipboard

External links for nodes and export them to SVG

Open Vorchuh opened this issue 11 years ago • 10 comments

It will be very convenient to support external links for nodes (for example, by URL property) and export them in SVG

Vorchuh avatar Mar 18 '14 09:03 Vorchuh

Thanks for opening this feature request. Do you mean to have links embedded on the diagram nodes? Do you know if and how this is possible in SVG? Do you propose an extra "URL" field. Or is this something that could be added to an existing Property? Could you provide more detail for how this would work?

Phillipus avatar Mar 18 '14 09:03 Phillipus

Now we use custom export to png image and html-map with links to produce clickable schemes for our WIKI but in SVG that natively supports links it will be more convinient. For node we just add new property named URL with link in it's value. It's used by export plugin to generate the URL in html-map for node area on png image.

Vorchuh avatar Mar 18 '14 09:03 Vorchuh

SVG links: http://www.w3.org/wiki/SVG_Links

Vorchuh avatar Mar 18 '14 09:03 Vorchuh

This would be a nice feature... but a hard one to implement as SVG is created from the canvas, thus without semantic information.

Maybe we can do it by adding the URL to the figure label and use a hack in drawString(s, x, y) method from GraphicsToGraphics2DAdaptor.java to split this information and both draw the string and add the link... (good luck)

jbsarrodie avatar Mar 18 '14 09:03 jbsarrodie

Reports with SVG images and more information might be better. But still, as you say, the way that the SVG is generated is purely graphical.

Phillipus avatar Mar 18 '14 09:03 Phillipus

Last minute idea: it should be possible to generate the SVG and a kind of html-map separatly and then merge them.

As suggested here a "map" in SVG is nothing more than a rectangle with a <A> tag, fill:none" and pointer-events="visible" properties set. So a loop which scan all elements should be able to use those with a URL property and generate the (small) SVG code needed to create the map.

So

jbsarrodie avatar Mar 18 '14 10:03 jbsarrodie

This is exactly what I'm looking for. You won't have all the semantic information, I understand that, but there would be, at least, the object names, wouldn't there?

If there are, then wouldn't it be easier simply to take the object name to put the link in the .svg? Define a document wide property 'URL':

URL === http://www.mysite.com

Then, for each object, the .svg export could just append the object name. So, for the object above 'Consumer', setting this would mean that export would be:

<a xlink:"http://www.mysite.com/Consumer.html"> Consumer

So, for every object in the diagram, you'd need a sub-directory on your web-server. Nice and neat - and I'd hope, not that difficult to code.

Even better, for the perfect Archi -> Web solution. Set:

URL === http://www.mysite.com

as above, and:

LINK_TYPE = php

To get:

<a xlink:"http://www.mysite.com/Consumer.php"> Consumer

So your links could link to any sort of sub-domain page that suited you, html, php or even .svg if you wanted to link a cascade of Archi diagrams

ghost avatar Dec 02 '14 12:12 ghost

Hello,

Any updates about this issue? Maybe there is a plugin to embed SVG links to the exported diagram? It would be a killer feature to us – having a diagram that links together model artifacts not only semantically, but actually.

kvaleev avatar Apr 17 '19 21:04 kvaleev

Any updates about this issue?

I'm not working on this personally, but if any one else wants to take a look, they are welcome. BTW - HTML Reports have links.

Maybe there is a plugin to embed SVG links to the exported diagram?

I don't think so.

Phillipus avatar Apr 18 '19 08:04 Phillipus

I have a solution that may address this feature request.

The approach is to extend/modify various classes to enable adding an attribute of "archi-id" for elements added to the SVG DOM managed by Batik and exported in the com.archimatetool.export.svg and ...svg.graphiti packages. Classes in the ...editor.diagram packages also needed some modification to get the concept-id for the "archi-id".

The ...reports.html frame.stg, model.css were modified and new .js files added to demonstrate the capability enabled by SVG for graph tracing and highlighting in the browser. Interaction with embedded SVG is to select a node and show the path to a second node. Pan and zoom is enabled through javascript.

It's definitely a work in progress and would benefit from others' evaluation.

Please see attached videos.

This video shows the export to the HTML report (leveraging the export.svg package - the svg is embedded in the html via the frame.stg string processing):

https://user-images.githubusercontent.com/31220739/151642383-7bf7ffa0-f007-4cde-b66e-924004437222.mp4

This next video shows the html report results, demonstrating selection of an object to show documentation/properties, tracing a "Path from here" - "Path to here" option, listing the graph results in an added tab in the view frame, the pan&zoom of the SVG image, and an inspection of an SVG element and its archi-id attribute:

https://user-images.githubusercontent.com/31220739/151642381-1e96603a-407b-4583-b269-69a2497c637b.mp4

oswalds avatar Jan 29 '22 01:01 oswalds