Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Eclipse Layout Kernel » Node Resize when doing auto layout
Node Resize when doing auto layout [message #1727947] Tue, 29 March 2016 16:29 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Hi All Smile

I am just a newbie to elk and layouting Smile

I am usuing SIrius (based on GMF) to develope a modelling environment for an SDL. I have installed elk and I could see that it does auto-layout for my diagrams, how ever it automatically resizes the node as shown in the below image Sad
index.php/fa/25462/0/

Do you have any idea why this is happening ? I have found some other guys also had this issue and apparently it because of the border spacing option of the layout option which is 12 by default.

Now, I need some help on how to override the default values for the layout options (maybe using extension points). I have check the video on youtube but it uses staticConfig as the extension point, which is not available anymore due to the reconstruction of elk.

I found this elk very interesting but since it resizes the nodes I can't use it right now Sad

Thanks,
Bests,
Parsa
Re: Node Resize when doing auto layout [message #1727991 is a reply to message #1727947] Wed, 30 March 2016 06:50 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 easiest way to statically configure the layout would be to set the properties in your custom IDiagramLayoutConnector implementation, e.g. by subclassing GmfDiagramLayoutConnector:

https://github.com/eclipse/elk/blob/master/plugins/org.eclipse.elk.conn.gmf/src/org/eclipse/elk/conn/gmf/GmfDiagramLayoutConnector.java

That implementation is registered with an ILayoutSetup in the org.eclipse.elk.core.service.layoutConnectors extension point, see GmfLayoutSetup.

In this case you can force the respective nodes to keep their original size by setting the option CoreOptions.NODE_SIZE_CONSTRAINTS to SizeConstraint.fixed().
Re: Node Resize when doing auto layout [message #1727993 is a reply to message #1727991] Wed, 30 March 2016 06:56 Go to previous message
Miro Spönemann is currently offline Miro SpönemannFriend
Messages: 78
Registered: March 2015
Location: Kiel, Germany
Member

Example:

public class MyLayoutConnector extends GmfDiagramLayoutConnector {
    ...
    protected KNode createNode(LayoutMapping mapping, ShapeNodeEditPart nodeEditPart,
            IGraphicalEditPart parentEditPart, KNode parentKNode, Maybe<KInsets> kinsets) {
        KNode node = super.createNode(mapping, nodeEditPart, parentEditPart, parentKNode, kinsets);
        if (nodeEditPart instanceof MySpecialEditPart) {
            KShapeLayout shapeLayout = node.getData(KShapeLayout.class);
            shapeLayout.setProperty(CoreOptions.NODE_SIZE_CONSTRAINTS, SizeConstraint.fixed());
        }
        return node;
    }
}


But beware! This is a very early stage of ELK and the APIs are likely to change further in the course of this year.

[Updated on: Wed, 30 March 2016 06:58]

Report message to a moderator

Previous Topic:Static Configuration
Next Topic:Use elk based on Diagram (Type)
Goto Forum:
  


Current Time: Sat Oct 12 20:04:40 GMT 2024

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

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

Back to the top