Wiki source code of KIML Layout Options

Version 16.1 by msp on 2014/03/05 13:26

Show last authors
1 {{warning}}
2 This is preliminary and incomplete documentation. You've been warned.
3 {{/warning}}
4
5 KIML defines a whole set of standard layout options that many layout algorithms support. Whether an algorithm supports a layout option depends on the option and on the algorithm. When an option is supported by an algorithm, it may change the option's default value. Algorithms may also provide more specialized documentation for a given layout option.
6
7 **Contents**
8
9
10
11 {{toc/}}
12
13 = Overview =
14
15 Beside a human-readable name, layout options are defined by the following properties:
16
17 * An ID to identify them.
18 * A type. One of Boolean, String, Int, Float, Enum, EnumSet (a {{code language="none"}}Set{{/code}} over a given enumeration), or Object. The types Enum and EnumSet have to be further defined by an enumeration class. The Object type can be constricted to a certain class.
19 * The kinds of graph objects the option applies to. At least one of Parents (nodes that have children, including the diagram root node), Nodes, Edges, Ports, and Labels.
20 * An optional default value. If an option is not set on an object and if the option does not have a default value, {{code language="none"}}null{{/code}} is returned when it is accessed.
21
22 KIML defines the following set of layout options:
23
24 |=(((
25 Option
26 )))|=(((
27 ID
28 )))|=(((
29 Type
30 )))|=(((
31 Applies to
32 )))|=(((
33 Default
34 )))
35 |(((
36 Alignment
37 )))|(((
38 de.cau.cs.kieler.alignment
39 )))|(((
40 Enum
41 )))|(((
42 Nodes
43 )))|(((
44 AUTOMATIC
45 )))
46 |(((
47 Aspect Ratio
48 )))|(((
49 de.cau.cs.kieler.aspectRatio
50 )))|(((
51 Float
52 )))|(((
53 Parents
54 )))|(((
55 0.0
56 )))
57 |(((
58 Bend Points
59 )))|(((
60 de.cau.cs.kieler.bendPoints
61 )))|(((
62 Object
63 )))|(((
64 Edges
65 )))|(((
66
67 )))
68 |(((
69 Border Spacing
70 )))|(((
71 de.cau.cs.kieler.borderSpacing
72 )))|(((
73 Float
74 )))|(((
75 Parents
76 )))|(((
77 -1.0
78 )))
79 |(% colspan="1" %)(% colspan="1" %)
80 (((
81 Comment Box
82 )))|(% colspan="1" %)(% colspan="1" %)
83 (((
84 de.cau.cs.kieler.commentBox
85 )))|(% colspan="1" %)(% colspan="1" %)
86 (((
87 Boolean
88 )))|(% colspan="1" %)(% colspan="1" %)
89 (((
90 Nodes
91 )))|(% colspan="1" %)(% colspan="1" %)
92 (((
93 false
94 )))
95 |(((
96 Debug Mode
97 )))|(((
98 de.cau.cs.kieler.debugMode
99 )))|(((
100 Boolean
101 )))|(((
102 Parents
103 )))|(((
104 false
105 )))
106 |(% colspan="1" %)(% colspan="1" %)
107 (((
108 [[Diagram Type>>doc:||anchor="diagramType"]]
109 )))|(% colspan="1" %)(% colspan="1" %)
110 (((
111 de.cau.cs.kieler.diagramType
112 )))|(% colspan="1" %)(% colspan="1" %)
113 (((
114 String
115 )))|(% colspan="1" %)(% colspan="1" %)
116 (((
117
118 )))|(% colspan="1" %)(% colspan="1" %)
119 (((
120
121 )))
122 |(((
123 Direction
124 )))|(((
125 de.cau.cs.kieler.direction
126 )))|(((
127 Enum
128 )))|(((
129 Parents
130 )))|(((
131 UNDEFINED
132 )))
133 |(% colspan="1" %)(% colspan="1" %)
134 (((
135 Edge Label Placement
136 )))|(% colspan="1" %)(% colspan="1" %)
137 (((
138 de.cau.cs.kieler.edgeLabelPlacement
139 )))|(% colspan="1" %)(% colspan="1" %)
140 (((
141 Enum
142 )))|(% colspan="1" %)(% colspan="1" %)
143 (((
144 Labels
145 )))|(% colspan="1" %)(% colspan="1" %)
146 (((
147 UNDEFINED
148 )))
149 |(((
150 [[Edge Routing>>doc:||anchor="edgeRouting"]]
151 )))|(((
152 de.cau.cs.kieler.edgeRouting
153 )))|(((
154 Enum
155 )))|(((
156 Parents
157 )))|(((
158 UNDEFINED
159 )))
160 |(% colspan="1" %)(% colspan="1" %)
161 (((
162 Edge Type
163 )))|(% colspan="1" %)(% colspan="1" %)
164 (((
165 de.cau.cs.kieler.edgeType
166 )))|(% colspan="1" %)(% colspan="1" %)
167 (((
168 Enum
169 )))|(% colspan="1" %)(% colspan="1" %)
170 (((
171 Edges
172 )))|(% colspan="1" %)(% colspan="1" %)
173 (((
174 NONE
175 )))
176 |(((
177 Expand Nodes
178 )))|(((
179 de.cau.cs.kieler.expandNodes
180 )))|(((
181 Boolean
182 )))|(((
183 Parents
184 )))|(((
185 false
186 )))
187 |(% colspan="1" %)(% colspan="1" %)
188 (((
189 Font Name
190 )))|(% colspan="1" %)(% colspan="1" %)
191 (((
192 de.cau.cs.kieler.fontName
193 )))|(% colspan="1" %)(% colspan="1" %)
194 (((
195 String
196 )))|(% colspan="1" %)(% colspan="1" %)
197 (((
198 Labels
199 )))|(% colspan="1" %)(% colspan="1" %)
200 (((
201
202 )))
203 |(% colspan="1" %)(% colspan="1" %)
204 (((
205 Font Size
206 )))|(% colspan="1" %)(% colspan="1" %)
207 (((
208 de.cau.cs.kieler.fontSize
209 )))|(% colspan="1" %)(% colspan="1" %)
210 (((
211 Int
212 )))|(% colspan="1" %)(% colspan="1" %)
213 (((
214 Labels
215 )))|(% colspan="1" %)(% colspan="1" %)
216 (((
217
218 )))
219 |(% colspan="1" %)(% colspan="1" %)
220 (((
221 Hypernode
222 )))|(% colspan="1" %)(% colspan="1" %)
223 (((
224 de.cau.cs.kieler.hypernode
225 )))|(% colspan="1" %)(% colspan="1" %)
226 (((
227 Boolean
228 )))|(% colspan="1" %)(% colspan="1" %)
229 (((
230 Nodes
231 )))|(% colspan="1" %)(% colspan="1" %)
232 (((
233 false
234 )))
235 |(((
236 Interactive
237 )))|(((
238 de.cau.cs.kieler.interactive
239 )))|(((
240 Boolean
241 )))|(((
242 Parents
243 )))|(((
244 false
245 )))
246 |(((
247 Label Spacing
248 )))|(((
249 de.cau.cs.kieler.labelSpacing
250 )))|(((
251 Float
252 )))|(((
253 Edges
254 Nodes
255 )))|(((
256 -1.0
257 )))
258 |(((
259 Layout Hierarchy
260 )))|(((
261 de.cau.cs.kieler.layoutHierarchy
262 )))|(((
263 Boolean
264 )))|(((
265 Parents
266 )))|(((
267 false
268 )))
269 |(((
270 [[Layout Algorithm>>doc:||anchor="layoutAlgorithm"]]
271 )))|(((
272 de.cau.cs.kieler.algorithm
273 )))|(((
274 String
275 )))|(((
276 Parents
277 )))|(((
278
279 )))
280 |(% colspan="1" %)(% colspan="1" %)
281 (((
282 Minimal Height
283 )))|(% colspan="1" %)(% colspan="1" %)
284 (((
285 de.cau.cs.kieler.minHeight
286 )))|(% colspan="1" %)(% colspan="1" %)
287 (((
288 Float
289 )))|(% colspan="1" %)(% colspan="1" %)
290 (((
291 Nodes
292 Parents
293 )))|(% colspan="1" %)(% colspan="1" %)
294 (((
295 0.0
296 )))
297 |(% colspan="1" %)(% colspan="1" %)
298 (((
299 Minimal Width
300 )))|(% colspan="1" %)(% colspan="1" %)
301 (((
302 de.cau.cs.kieler.minWidth
303 )))|(% colspan="1" %)(% colspan="1" %)
304 (((
305 Float
306 )))|(% colspan="1" %)(% colspan="1" %)
307 (((
308 Nodes
309 Parents
310 )))|(% colspan="1" %)(% colspan="1" %)
311 (((
312 0.0
313 )))
314 |(% colspan="1" %)(% colspan="1" %)
315 (((
316 No Layout
317 )))|(% colspan="1" %)(% colspan="1" %)
318 (((
319 de.cau.cs.kieler.noLayout
320 )))|(% colspan="1" %)(% colspan="1" %)
321 (((
322 Boolean
323 )))|(% colspan="1" %)(% colspan="1" %)
324 (((
325
326 )))|(% colspan="1" %)(% colspan="1" %)
327 (((
328 false
329 )))
330 |(% colspan="1" %)(% colspan="1" %)
331 (((
332 Node Label Placement
333 )))|(% colspan="1" %)(% colspan="1" %)
334 (((
335 de.cau.cs.kieler.nodeLabelPlacement
336 )))|(% colspan="1" %)(% colspan="1" %)
337 (((
338 EnumSet
339 )))|(% colspan="1" %)(% colspan="1" %)
340 (((
341 Nodes
342 )))|(% colspan="1" %)(% colspan="1" %)
343 (((
344
345 )))
346 |(((
347 Port Constraints
348 )))|(((
349 de.cau.cs.kieler.portConstraints
350 )))|(((
351 Enum
352 )))|(((
353 Nodes
354 )))|(((
355 UNDEFINED
356 )))
357 |(% colspan="1" %)(% colspan="1" %)
358 (((
359 Port Label Placement
360 )))|(% colspan="1" %)(% colspan="1" %)
361 (((
362 de.cau.cs.kieler.portLabelPlacement
363 )))|(% colspan="1" %)(% colspan="1" %)
364 (((
365 Enum
366 )))|(% colspan="1" %)(% colspan="1" %)
367 (((
368 Nodes
369 )))|(% colspan="1" %)(% colspan="1" %)
370 (((
371 OUTSIDE
372 )))
373 |(% colspan="1" %)(% colspan="1" %)
374 (((
375 [[Port Offset>>doc:||anchor="portOffset"]]
376 )))|(% colspan="1" %)(% colspan="1" %)
377 (((
378 de.cau.cs.kieler.offset
379 )))|(% colspan="1" %)(% colspan="1" %)
380 (((
381 Float
382 )))|(% colspan="1" %)(% colspan="1" %)
383 (((
384 Ports
385 )))|(% colspan="1" %)(% colspan="1" %)
386 (((
387
388 )))
389 |(% colspan="1" %)(% colspan="1" %)
390 (((
391 Port Side
392 )))|(% colspan="1" %)(% colspan="1" %)
393 (((
394 de.cau.cs.kieler.portSide
395 )))|(% colspan="1" %)(% colspan="1" %)
396 (((
397 Enum
398 )))|(% colspan="1" %)(% colspan="1" %)
399 (((
400 Ports
401 )))|(% colspan="1" %)(% colspan="1" %)
402 (((
403 UNDEFINED
404 )))
405 |(((
406 Position
407 )))|(((
408 de.cau.cs.kieler.position
409 )))|(((
410 Object
411 )))|(((
412 Labels
413 Nodes
414 Ports
415 )))|(((
416
417 )))
418 |(((
419 Priority
420 )))|(((
421 de.cau.cs.kieler.priority
422 )))|(((
423 Int
424 )))|(((
425 Edges
426 Nodes
427 )))|(((
428
429 )))
430 |(% colspan="1" %)(% colspan="1" %)
431 (((
432 Randomization Seed
433 )))|(% colspan="1" %)(% colspan="1" %)
434 (((
435 de.cau.cs.kieler.randomSeed
436 )))|(% colspan="1" %)(% colspan="1" %)
437 (((
438 Int
439 )))|(% colspan="1" %)(% colspan="1" %)
440 (((
441 Parents
442 )))|(% colspan="1" %)(% colspan="1" %)
443 (((
444
445 )))
446 |(% colspan="1" %)(% colspan="1" %)
447 (((
448 Separate Connected Components
449 )))|(% colspan="1" %)(% colspan="1" %)
450 (((
451 de.cau.cs.kieler.separateConnComp
452 )))|(% colspan="1" %)(% colspan="1" %)
453 (((
454 Boolean
455 )))|(% colspan="1" %)(% colspan="1" %)
456 (((
457 Parents
458 )))|(% colspan="1" %)(% colspan="1" %)
459 (((
460
461 )))
462 |(% colspan="1" %)(% colspan="1" %)
463 (((
464 Size Constraint
465 )))|(% colspan="1" %)(% colspan="1" %)
466 (((
467 de.cau.cs.kieler.sizeConstraint
468 )))|(% colspan="1" %)(% colspan="1" %)
469 (((
470 EnumSet
471 )))|(% colspan="1" %)(% colspan="1" %)
472 (((
473 Nodes
474 )))|(% colspan="1" %)(% colspan="1" %)
475 (((
476
477 )))
478 |(% colspan="1" %)(% colspan="1" %)
479 (((
480 Size Options
481 )))|(% colspan="1" %)(% colspan="1" %)
482 (((
483 de.cau.cs.kieler.sizeOptions
484 )))|(% colspan="1" %)(% colspan="1" %)
485 (((
486 EnumSet
487 )))|(% colspan="1" %)(% colspan="1" %)
488 (((
489 Nodes
490 )))|(% colspan="1" %)(% colspan="1" %)
491 (((
492 DEFAULT_MINIMUM_SIZE
493 )))
494 |(% colspan="1" %)(% colspan="1" %)
495 (((
496 Spacing
497 )))|(% colspan="1" %)(% colspan="1" %)
498 (((
499 de.cau.cs.kieler.spacing
500 )))|(% colspan="1" %)(% colspan="1" %)
501 (((
502 Float
503 )))|(% colspan="1" %)(% colspan="1" %)
504 (((
505 Parents
506 )))|(% colspan="1" %)(% colspan="1" %)
507 (((
508 -1.0
509 )))
510
511 = The Most Important Options =
512
513 While most layout options are used to affect how the active layout algorithm computes concrete coordinates for the graph elements, there are some layout options that have a special role in KIML.
514
515 == Layout Algorithm ==
516
517
518
519 {{id name="layoutAlgorithm"/}}
520
521 The option with identifier {{code language="none"}}de.cau.cs.kieler.algorithm{{/code}} specifies which layout algorithm to use for the content of a composite node. The value can be either the identifier of a layout algorithm or the identifier of a layout type. In the latter case the algorithm with highest priority of that type is applied.
522
523 The following layout types are predefined:
524
525 * **Layered** - The layer-based method emphasizes the direction of edges by pointing as many edges as possible into the same direction. The nodes are arranged in layers and then reordered such that the number of edge crossings is minimized. Afterwards, concrete coordinates are computed for the nodes and edge bend points.
526 * **Orthogonal** - Orthogonal methods follow the "topology-shape-metrics" approach, which first applies a planarization technique, resulting in a planar representation of the graph, then compute an orthogonal shape, and finally determine concrete coordinates for nodes and edge bend points by applying a compaction method.
527 * **Force** - Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces.
528 * **Circular** - Circular layout algorithms emphasize biconnected components of a graph by arranging them in circles. This is useful if a drawing is desired where such components are clearly grouped, or where cycles are shown as prominent properties of the graph.
529 * **Tree** - Specialized layout methods for trees, i.e. acyclic graphs. The regular structure of graphs that have no undirected cycles can be emphasized using an algorithm of this type.
530
531 === Available Algorithms and Libraries ===
532
533 * **The [[KLay Project>>doc:Layout Algorithms (KLay)]]** - Java implementations of standard layout approaches, augmented with special processing of graph features such as ports and edge labels.
534 * **Randomizer** - Distributes the nodes randomly; not very useful, but it can show how important a good layout is for understanding a graph.
535 * (((
536 **Box Layout** - Ignores edges, places all nodes in rows. Can be used to layout collections of unconnected boxes, such as Statechart regions.
537 )))
538 * **Fixed Layout** - Does not compute a new layout, but leaves all nodes and edges where they are. If the Position and Bend Points options are set for the elements of the graph, the pre-defined layout is applied.
539 * **OGDF** ((% style="color: rgb(0,0,0);" %)[[www.ogdf.net>>url:http://www.ogdf.net/||shape="rect"]](%%)) - A self-contained C++ class library for the automatic layout of diagrams. The version that is shipped with KIELER is compiled as an executable that reads files in OGML format and outputs the computed concrete layout.
540 * **Graphviz** ([[www.graphviz.org>>url:http://www.graphviz.org/||shape="rect"]]) - An open source graph visualization tool with several graph layout programs, web and interactive graphical interfaces, auxiliary tools, libraries, and language bindings. Graphviz needs to be installed separately in order to be used within KIELER, since it is called in a separate process using the DOT language for communication.
541
542 == Diagram Type ==
543
544
545
546 {{id name="diagramType"/}}
547
548 Diagram types are used to classify graphical diagrams for setting default layout option values for a set of similar diagrams. The diagram type of an element is specified with the layout option {{code language="none"}}de.cau.cs.kieler.diagramType{{/code}}. Layout algorithms can declare which diagram types they support well, and give a priority value for each supported type. KIML decides at runtime which layout algorithm has the highest priority for a given diagram, so that the most suitable algorithm is always used. Usual values for such priorities are between 1 and 10, where the highest value should only be assigned if the algorithm is especially designed for diagrams of the respective type, or if it has proven to be very adequate for them. Lower values should be given if the algorithm is able to draw the diagrams correctly, but with lower quality of the resulting layout.
549
550 The following diagram types are predefined:
551
552 * **General** - This type is automatically assigned to all diagrams for which no specific type is declared. A layout algorithm that has the highest priority on the //General// diagram type is taken as the default algorithm when no further information on a diagram is available to KIML.
553 * **State Machine** - All kinds of state machines, automata, and activity diagrams. Examples: [[doc:SCCharts SyncCharts]], UML Activity diagrams.
554 * **Data Flow Diagram** - Actor-oriented diagrams, where connections are mostly done between //ports// of nodes. These diagrams can only be handled properly by very special layout algorithms, such as those developed in the [[KLay project>>doc:Layout Algorithms (KLay)]].
555 * **Class Diagram** - Class diagrams such as Ecore diagrams for the [[EMF>>url:http://www.eclipse.org/modeling/emf/||shape="rect"]] or UML Class diagrams.
556 * **Use Case Diagram** - Use case diagrams as defined by the UML.
557 * **Unconnected Boxes** - Sets of nodes that have no connections and are treated as resizable boxes. This is related to mathematical [[packing problems>>url:http://en.wikipedia.org/wiki/Packing_problem||shape="rect"]]. Example: Regions in [[doc:SCCharts SyncCharts]].
558
559 == Other Options ==
560
561 * **Layout Hierarchy** ({{code language="none"}}de.cau.cs.kieler.layoutHierarchy{{/code}}) - If this option is supported and active, the layout algorithm is requested to process the full hierarchy contained in the input node. This means that instead of executing another algorithm on each hierarchy level, all levels are arranged in a single algorithm execution.
562 * **Hypernode** ({{code language="none"}}de.cau.cs.kieler.hypernode{{/code}}) - A node that is marked as hypernode has a special role in the graph structure, since all its incident edges are treated as parts of the same [[hyperedge>>url:http://en.wikipedia.org/wiki/Hypergraph||shape="rect"]]. Example: relation vertices in [[Ptolemy>>url:http://ptolemy.eecs.berkeley.edu/||shape="rect"]] models.
563 * **Comment Box** ({{code language="none"}}de.cau.cs.kieler.commentBox{{/code}}) - A node that is marked as comment box is treated as a label that needs to be placed somewhere. This is different to normal node labels, which are usually regarded as fixed.
564 * **No Layout** ({{code language="none"}}de.cau.cs.kieler.noLayout{{/code}}) - Elements that are marked with this option are excluded from layout. This is used to identify diagram objects that should not be regarded as graph elements.
565
566 = Detailed Documentation =
567
568 This section explains every layout option in more detail.
569
570 == Edge Routing ==
571
572
573
574 {{id name="edgeRouting"/}}
575
576 This option influences the way in which edges are routed between the nodes they connect. The following settings are available:
577
578 * POLYLINE
579 Edges consist of one or more segments defined by a list of bend points.
580 * ORTHOGONAL
581 Edges are routed orthogonally, meaning that each segment of an edge runs either horizontally or vertically, but never at an angle.
582 * SPLINE
583 Edges are routed as splines (smooth curves). (% style="color: rgb(153,51,0);" %)**TODO:** Add more documentation on how the returned bend points are to be interpreted.
584 * UNDEFINED
585 No particular edge routing style is selected. The result produced by the layout algorithm may be undefined.
586
587 (% style="color: rgb(153,51,0);" %)**TODO:** Add an image illustrating the different routing styles.
588
589 == Port Offset ==
590
591
592
593 {{id name="portOffset"/}}
594
595 The port offset is used to specify how much space a layout algorithm should leave between a port and the border of its node. This is usually zero, but doesn't have to be. If the offset is not defined for a given port, a layout algorithm can try to infer the offset from the port's coordinates and its node's size in the input graph. This of course requires both properties to be set to sensible values.
596
597 Set this property if one of the following cases applies:
598
599 * The port constraints on a node are set to FREE, FIXED_SIDES or FIXED_ORDER.
600 * The port constraints on a node are set to FIXED_RATIO or FIXED_POS, and the size of the node is not fixed. (Note that this is especially true for ports of compound nodes.)