Difference between the methods performLayoutOnce and setNodeLayout

Article ID: 2144
Last updated: 28 May, 2018
Article ID: 2144
Last updated: 28 May, 2018
Revision: 3
Views: 635
Posted: 09 Dec, 2004
by Dean J.
Updated: 28 May, 2018
by Gargani A.

Question

What is the difference between the methods performLayoutOnce and setNodeLayout?

Answer

Both these methods are used to perform layout to a network. However, they work differently.

  • The method setNodeLayout sets a permanent layout to the network. That means that the layout will be performed each time you move a node in your grapher.

  • If you use the method performLayoutOnce, the layout will be performed when you call the method, and will not be performed again until you call performLayoutOnce or setNodeLayout.

This is why you can get the following behaviors:

  • You have set a layout but when you try to move a node, its position does not change.You probably called setNodeLayout. If you move a node, the layout will be performed right away and the node will be positioned as it was before. It seems that the node position has not changed. In fact, it has changed and the node has been moved back by the layout.

  • You have added a node in the network and the layout does not consider this new node.You probably called performLayoutOnce. The changes in the network will not be taken into account by the layout. If you want the new node to be layed out, you should use setNodeLayout instead.

If you want to call the layout only when needed, you can add a button (or a key-pressed command) which activates the layout and uses the method performLayoutOnce.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2144
Last updated: 28 May, 2018
Revision: 3
Views: 635
Posted: 09 Dec, 2004 by Dean J.
Updated: 28 May, 2018 by Gargani A.
Also listed in


Others in this category