next up previous contents index
Next: Combination of Features Up: Examples of GDL Specifications Previous: The Effect of the

Tree Layout

The following example shows a typed syntax tree. This tree can either be drawn by the specialized algorithm for ``downward laid-out trees'' or by the normal algorithms. When the normal algorithms are used to draw a tree, it is advisable to increase the layout down factor in order to obtain good results (see Figure 22). If the layout down factor is not used, the incoming edges draw the nodes too much in the direction of the parent node.

A nice layout is achieved by the specialized tree algorithm with a tree factor of 0.9 (see Figure 23).

If an orthogonal layout is needed, the attribute smanhattan_edges can be used. For trees, this attribute is more appropriate than the standard Manhattan layout with manhattan_edges (see Figure 24).


  
Figure 22: Example 11: Layout Algorithm normal
\begin{figure}
\begin{center}
\epsfig{file=pics_vcg/exa5a.ps, height=9.5cm}
\end{center}\end{figure}

Example 11: Syntax Tree
<>01  graph: {
<>02       title: "Typed Syntax Tree"
<>03       node: { title:"503160" label: "Identifier\ntst3 (0)" }
<>04       node: { title:"503240" label: "Identifier\nx (0)" }
<>05       node: { title:"502952" label: "INTEGER" }
<>06       node: { title:"503304" label: "VarDecl" }
<>         ...
<>29       node: { title:"T0" label: "no type" }
<>30       node: { title:"T1" label: "no type" }
<>31       node: { title:"T2" label: "int" }
<>         ...
<>57       edge: { sourcename:"503304" targetname:"503240" }
<>58       edge: { sourcename:"503304" targetname:"502952" }
<>         ...
<>83       nearedge: { sourcename:"503160" targetname:"T0" linestyle: dotted }
<>84       nearedge: { sourcename:"503240" targetname:"T1" linestyle: dotted }
<>85       nearedge: { sourcename:"502952" targetname:"T2" linestyle: dotted }
<>         ...
<>110 }


  
Figure 23: Example 11: Layout Algorithm tree, treefactor: 0.9
\begin{figure}
\begin{center}
\epsfig{file=pics_vcg/exa5b.ps, height=9.5cm}
\end{center}\end{figure}


  
Figure 24: Example 11: Layout Algorithm tree, smanhattan_edges: yes
\begin{figure}
\begin{center}
\epsfig{file=pics_vcg/exa5c.ps, height=9.5cm}
\end{center}\end{figure}


next up previous contents index
Next: Combination of Features Up: Examples of GDL Specifications Previous: The Effect of the
© AbsInt Angewandte Informatik GmbH