Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Eclipse Layout Kernel » Graphiti Connection and ChopboxAnchros
Graphiti Connection and ChopboxAnchros [message #1782309] Wed, 21 February 2018 15:37 Go to next message
Sascha Müller is currently offline Sascha MüllerFriend
Messages: 7
Registered: February 2018
Junior Member
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 #1782348 is a reply to message #1782309] Thu, 22 February 2018 09:32 Go to previous messageGo to next message
Miro Spönemann is currently offline Miro SpönemannFriend
Messages: 78
Registered: March 2015
Location: Kiel, Germany
Member

The answer is in the comment above the lines you quoted:

// box-relative anchors and fixed-position anchors are interpreted as ports


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());


If you think the behavior you are seeing is a bug, feel free to create an issue for it on GitHub. And of course a Pull Request with a solution is welcome, too :-)
Re: Graphiti Connection and ChopboxAnchros [message #1782353 is a reply to message #1782348] Thu, 22 February 2018 10:16 Go to previous message
Sascha Müller is currently offline Sascha MüllerFriend
Messages: 7
Registered: February 2018
Junior Member
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!
Previous Topic:Find the best Algo and options for my graph
Next Topic:Can ELK be used to layout Papyrus Diagrams ?
Goto Forum:
  


Current Time: Wed Dec 11 01:08:06 GMT 2024

Powered by FUDForum. Page generated in 0.06172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top