Table of Contents Previous Chapter 23 The SDL Editor

23 The SDL Editor

Automatic Layouting of Diagrams

This section is a reference to the layouting algorithms that are used when having the SDL Editor rearrange an SDL diagram, using the Tidy Up command (see page 1218) or when converting SDL-PR files to SDL-GR diagrams with the Organizer's Convert to GR command (see page 1117).

General

The SDL Editor is designed as a tool that the user operates in a way that allows him to customize the appearance of his SDL diagrams in order to apply the graphical styleguide of his choice.

Managing the intricate problem that is to layout an SDL diagram in order to give it an appearance that is acceptable for the majority of users, requires a complex algorithm. The SDL Editor is not designed to provide advanced autolayouting algorithms, featuring a multitude of options.

Instead, the auto-layouting algorithm, is designed to cope with the following problems:

Layouting of Interaction Diagrams

This section applies to diagrams of type:

Page Size

Within one diagram, all symbols that are connected by any kind of lines will be placed on one dedicated SDL page with the name 1. The remaining information (such as text symbols and diagram type symbols are placed on another dedicated SDL page, named DefinitionPage, which is located first in the flow of pages.

The size of the created pages is adjusted automatically to the smallest size which contains all the symbols. The implication of this is that a page may become too large to fit on a printer page; on the other hand it is possible to rescale interaction diagram printouts to fit the printer pages. Placing all symbols and lines on one SDL page also enhances readability.

Symbols and Lines

Positioning of the symbols follows these rules, listed in same the order as the conversion proceeds:

  1. Text symbols will be added when required, following their order of appearance. These symbols are positioned on top of the first page, named DefinitionPage. Text symbols are displayed as maximized (see "Text / Additional Heading / Package Reference Symbols" on page 1175).
  2. All symbols are given a minimum size (30 * 20 mm). They may be enlarged if required, in order to fit the text contained in the symbol and to avoid overlapping lines.
  3. Diagram type symbols are placed at the right of the page named DefinitionPage, forming a column of symbols. They are sorted according to their type.
  4. When the input contains 1, 2, 3 or 4 reference symbols, these symbols are placed on the center of the page, a vertical line, a perpendicular triangle, a rectangle, respectively.
  5. In the case of more than 4 symbols, they are placed on a circle which radius and centre are determined in order to have sufficient space to avoid drawing symbols outside the drawing area or overlapping of symbols or lines.
    Figure 343 : Positioning More Than 4 Symbols. 
    -----
    (fig)  
           
    -----
    

Interconnecting Interaction Symbols

Interconnection with the environment is realized by drawing lines horizontally from the symbols to the closest limit of the drawing area.

Interconnection between symbols is done as straightforwardly as possible, without introducing any breakpoints on the lines. Overlapping of lines between the two same symbols is achieved by spreading the line connections over the borders of the symbols. In the case of insufficient space, the size of the symbol will be adjusted accordingly.

Figure 344 : Spreading the Line Connections on a Symbol.Figure legend: This 
		figureillustrates a symbol which needs 2 additional incoming and 2 additional 
		outgoingconnections. The size is increased to the right 
-----
(fig)  
       
       
       
       
-----
An example, illustrated in Figure 345, demonstrates the principles for interconnecting the symbols as well as for connecting the environment.

Figure 345 : Example of Automatic Layouting of Lines. 
-----
(fig)  
       
-----

Layouting of Flow Diagrams

Layouting of flow diagrams is governed by a rather complex algorithm. Describing the algorithm in detail is not within the scope of the topics that are discussed in this manual. The basic principles that may be of assistance to the user when understanding how diagrams are arranged are however listed in this section.

The flow diagrams are the diagrams of type

Page Size

The page size that is defined as the user's preference is preserved. The implication of this principle is that an SDL flow diagram may require multiple pages; the connection between the various fragments of flow is done by in-connectors and out-connectors. This approach is preferable since it is valuable to print a flow branch on one unique sheet of paper.

The required number of pages will thus be determined according to the preferred page size to the contents of the input diagram or file.

Flow Order

The following principles are used when SDT layouts a flow diagram:

  1. Text symbols will be added when required, following their order of appearance. These symbols are positioned on top of the first page, named DefinitionPage. If required, additional pages are added to the diagram with the name DefinitionPage_N, where N is an enumerated integer.
  2. Reference symbols (for instance procedure and operator) are placed below / to the right of the latest added text symbol. If required, new DefinitionPage_N pages are added. The reference symbols are sorted according to their type.
  3. A symbol flow is always started by a start symbol, a state symbol or a in-connector.
  4. The order in which flow fragments are processed is:

Flow Layout

  1. The first symbol in a flow is always positioned at the top of the page and displaced as many positions to the right as needed to assure that there will be no other obstructing symbols below it. If there should be no space available on the page for this symbol, an attempt is done to use the space below the previously positioned flows.
  2. In a flow branch being processed, each of the following symbols are always fully processed, before handling any of the other parallel branches, starting with any of:
  3. In situations where an additional incoming line is connected to a symbol, (i.e where two or more branches merge), the branch not handled at the time is replaced with a in-connector symbol and will be handled later on when that specific branch is in turn to be processed. The connector symbol is located to the left of the symbol previous to the connection point. If required, the entire branch is moved to the right in order to allocate space for this in-connector. Whenever a new branch is handled, the symbols are positioned to the right of the previous branch, with an offset as large as needed to ensure that no obstructing symbols below.
  4. If there should be no space available to the right of the previous branch and if the branch is a part of a decision or transition option, additional space will be allocated, if it is part of an input the state symbol before the input symbol will be repeated at the first position of a new page and the remaining input branches will then be handled.
  5. If the flow should encounter a state symbol the flow line is ended and restarted with the state symbol repeated at the top of the page (or just below the line referred to in step 1. above) and to the right of the current flow, but not until all the remaining branches of the flow have been handled. If there is not enough space on the page for the state symbol or the flow after it the symbol will be located on a new page.
  6. A symbol flow which reaches the lower limit of a page is split using a connector symbol. The remaining symbol flow is then handled when all remaining branches in the flow above has been handled (i.e. either been completed or split with a connector symbol). If there should not be enough space left on the page for the flow remaining after a split the connector and the remaining flow is located on a new page.
  7. Symbols not following the legal syntax of SDL may cause problems. To avoid these problems, the SDL Editor rules for positioning and inserting symbols are used. All symbols that may have several outputs are treated as if they were decision symbols, i.e. the following symbols are forced in by automatically adjusting the size of the page to the need of the symbols.
  8. Recursive flows are treated as follows: Any symbol in the flow may be used as a root symbol. Before this symbol is located on a page, a in-connector symbol is created and placed previous to the root symbol. Then at the other end of the flow, where the "last" symbol calls for the "first" this call is replaced by an out-connector with the same name as the in-connector.
  9. Comment and text extension symbols are located to the right of the symbol they refer to. If more than one of these symbols should be connected to the same symbol, the second one is located below the first one.These symbols are combined in order to have only one comment symbol and one text extension symbol related to the same flow symbol. These appendix symbols are allowed to extend outside the frame as well as outside the page, but only if the are positioned at a legal position (i.e. inside the frame and not in conflict with any previously positioned symbol).
  10. Any symbols following a flow symbol that has one or two appendix symbols will in general be positioned immediately below the previous flow symbol, but only if the symbol itself or any of its appendix symbols do not conflict with the previous flow symbol or any of its appendix symbols.
    There are however a few exceptions when the following flow symbols are positioned below the previous flow symbol rather than immediately below. In these cases the flow symbol is positioned as far below the previous flow symbol as is needed to ensure that it will be located below the bottom of the lowest appendix symbol of the previous flow symbol. These exceptions are:

Footnotes

(1)
Starting in the sense that the first symbol in flow does not have any incoming line or connection.
 
Table of Contents Next Chapter