Layouts

Figure 5-7. Layout Overview Diagram

Layout Diagram

The abstract class Layout has to be implemented by each layout. The method Do_Layout has to be used to layout the content of an Object_Container, which contains Node_Displays and Edge_Displays. You can use the method Do_Layout with different modes. With the following parameters you can set the mode:

You can also layout using Prepare, Start and Finish.

If you want to apply a simple layout by iterating by hand (that means you do not use a Object_Display_Container, you layout node by node using Node_Display by its own.).

Motivation

Mechanics

For each layout class (also to abstract ones) exists a layout factory. This is used to generate a layout and to specify it by its name. This name can e.g. be used by the Layout Master to show the existing layouts with their names.

Simple Layouts are common in the following aspect. The algorithms layout node by node without considering relations between them. To get all nodes from the Object_Display_Container the Visitor-Pattern is used. In the method Apply_Layout a single node will be layouted. But this method has to be implemented from real simple layouts, like grid- or saw-tooth-layout.

This concept guaranties that you have a powerful and easy-to-use concept to implement different layouts. The use of Object_Containers has the advantage, that you can layout nodes in an easy way (this is that what simple layouts do). Further, you can implement complex layouts, for which relations between nodes are important (e.g. brother and sister layout). So you can apply this layout algorithms in different cases, like layouting a whole window or only a selection.