|
Re: Print to PDF - Edge connects multiple nodes [message #1767024 is a reply to message #1766976] |
Thu, 29 June 2017 15:20 |
|
Hi Du Vu,
1. Not out-of-the-box, but you can simulate such an edge either via way points (located at the intermediary station), or via two edges. Moreover, Zest (as a grey box framework) can be customized, i.e. you can extend EdgePart to fit your needs (e.g. evaluate a custom attribute holding intermediary nodes), or extend GraphPart to fix the Z-order, so that edges with intermediary stations are drawn above these stations.
2. Not out-of-the-box, but from the top of my head, I can think of three solutions:
a) JavaFX offers a PrinterJob [1] that can be used to print a JavaFX Node. You need to configure it correctly for printing to PDF, though. The appearance within the PDF will match the drawing on the display.
b) You can convert the JavaFX image to an AWT BufferedImage and print it using the Java AWT Printing API [2].
c) When Graphviz is available you can delegate to Graphviz for PDF generation. You have to convert the Zest-attributed graph to a Dot-attributed graph (possibly using Zest2DotAttributesConverter, although it is not API), serialize the graph using DotExport#exportDot(Graph), and use Graphviz to generate the PDF. For a code example, you can take a look at DotExecutableUtilsTests#testImageExport(String), which produces a PDF from a Dot input file. Unfortunately, the appearance (colors, thicknesses, etc.) will not be preserved.
[1] https://docs.oracle.com/javase/8/javafx/api/javafx/print/PrinterJob.html
[2] https://docs.oracle.com/javase/tutorial/2d/printing/printable.html
PS: I am checking for questions tagged "eclipse-gef" on SO from time to time, but not on a daily basis. OTOH, many people involved are active in this forum, so you have higher chances of getting responses here.
Best regards,
Matthias
|
|
|
Re: Print to PDF - Edge connects multiple nodes [message #1767106 is a reply to message #1767024] |
Sat, 01 July 2017 06:34 |
Du Vu Messages: 3 Registered: June 2017 |
Junior Member |
|
|
Thanks for your quick support Matthias!
I am going to try to extend the Edge part and try to render the connections in the way that it has connection points at the border of the intermediate node.
The solution of via 2 edges were also thought, but then we still have to render a line inside the intermediate station box to "connect" the 2 edge connecting points with the box, simulating that it's a "one line" from 2 end stations.
I did't get any notification from Eclipse on your approval of my question/your answer! only the one from stackoverflow!
Cheers
Du
[Updated on: Sat, 01 July 2017 06:35] Report message to a moderator
|
|
|
|
Re: Print to PDF - Edge connects multiple nodes [message #1768074 is a reply to message #1767138] |
Thu, 13 July 2017 12:51 |
|
Hi Du Vu,
unfortunately, you will have to implement additional labels by yourself. The contents for the labels are generated by GraphPart#doGetContentChildren(). Additional roles need to be specified for the additional labels (e.g. MID_LABEL), and the EdgeLabelPart needs to be subclassed, so that you can adjust the position computation for the new labels, e.g. using the control point location as the label position.
Best regards,
Matthias
|
|
|
Powered by
FUDForum. Page generated in 0.02968 seconds