Graphiti Connection and ChopboxAnchros [message #1782309] |
Wed, 21 February 2018 10:37  |
Eclipse User |
|
|
|
Hello, I have been recently looking into automatic layouting for our diagrams. We use the Graphiti framework and since I saw that there is a Graphiti support for the Eclipse Layout Kernel I wanted to give this a try.
However, I am getting layouts that look not just bad as in the getting started description, they barely change with different settings. So I had a look into the debug view and didnt see any connections in the ELK Graph. In Graphiti we are using the feature of ChopboxAnchors and I had a look into the Graphiti to ELK Graph converter where I found this in the node creation algorithm
if (graphElemIndicator.isPortAnchor(anchor)) {
if (anchor instanceof BoxRelativeAnchor) {
createPort(mapping, childNode, (BoxRelativeAnchor) anchor);
} else if (anchor instanceof FixPointAnchor) {
createPort(mapping, childNode, (FixPointAnchor) anchor);
}
}
ChopboxAnchors dont seem to be considered at all and ignored. Am I missing something here? Is this intended behavior?
Greetings
|
|
|
|
Re: Graphiti Connection and ChopboxAnchros [message #1782353 is a reply to message #1782348] |
Thu, 22 February 2018 05:16  |
Eclipse User |
|
|
|
Miro Spönemann wrote on Thu, 22 February 2018 09:32
All other types of anchors are not interpreted as ports, but their (outgoing) connections are still considered. This is done with the code below the lines you quoted:
// gather all connections in the diagram
mapping.getProperty(CONNECTIONS).addAll(anchor.getOutgoingConnections());
Thanks for the quick response! Actually while the connection is considered, the ChopboxAnchor itself is not being mapped. So in the following step when the connections get processed, these kind of connections with ChopboxAnchors are ignored.
I just now got it working for me by extending the default graphiti layout connector and adding my own createPort method.
protected ElkPort createPort(final LayoutMapping mapping, final ElkNode parentNode, ChopboxAnchor anchor) {
ElkPort port = ElkGraphUtil.createPort(parentNode);
mapping.getGraphMap().put(port, anchor);
return port;
}
I will consider making an issue and a pull request!
|
|
|
Powered by
FUDForum. Page generated in 0.04753 seconds