Table of Contents Previous Chapter 23 The SDL Editor
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).
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:
- Importing SDL-PR files and transforming them to SDL-GR diagrams
- Supporting the user in rearranging a diagram.
This section applies to diagrams of type:
- system
- substructure
- block
- process containing service interaction pages
- package
- system type
- block type.
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.
Positioning of the symbols follows these rules, listed in same the order as the conversion proceeds:
- 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).
- 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.
- 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.
- 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.
- 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)
-----
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 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
- service
- process
- procedure
- operator
- process type
- service type
- macro.
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.
The following principles are used when SDT layouts a flow diagram:
- 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.
- 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.
- A symbol flow is always started by a start symbol, a state symbol or a in-connector.
- The order in which flow fragments are processed is:
- The flow starting(1) with the start symbol is handled first, then
- Flows starting with a procedure start
- Flows starting with a macro inlet
- Flows starting with a state
- Flows starting with an in-connector
- Flows starting with any other symbol than listed above, for instance circular flows (which are syntactically incorrect but are possible to express in SDL-PR for instance)
- 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.
- 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:
- input, save and continuous signal symbols
- decision and transition option symbols
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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).
- 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:
- Decision symbols
- Transition option symbols
- Any following symbol that has more than one child i.e. symbols sharing the same parent flow symbol
- Symbols that have their own appendix symbols.
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