Wiki source code of KIML Layout Options

Version 17.1 by msp on 2014/03/07 16:46

Hide last authors
cds 1.1 1 {{warning}}
cds 11.1 2 This is preliminary and incomplete documentation. You've been warned.
cds 1.1 3 {{/warning}}
4
cds 4.1 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.
cds 1.1 6
7 **Contents**
8
9
cds 7.1 10
11 {{toc/}}
12
cds 1.1 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.
cds 3.1 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.
cds 1.1 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 )))|(((
msp 17.1 77
cds 1.1 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 (((
cds 3.1 90 Nodes
cds 1.1 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 (((
msp 16.1 108 [[Diagram Type>>doc:||anchor="diagramType"]]
cds 1.1 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 )))|(((
msp 17.1 131
cds 1.1 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 (((
cds 3.1 144 Labels
cds 1.1 145 )))|(% colspan="1" %)(% colspan="1" %)
146 (((
msp 17.1 147
cds 1.1 148 )))
149 |(((
cds 13.1 150 [[Edge Routing>>doc:||anchor="edgeRouting"]]
cds 1.1 151 )))|(((
152 de.cau.cs.kieler.edgeRouting
153 )))|(((
154 Enum
155 )))|(((
156 Parents
157 )))|(((
msp 17.1 158
cds 1.1 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 (((
cds 3.1 171 Edges
cds 1.1 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 (((
cds 3.1 198 Labels
cds 1.1 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 (((
cds 3.1 214 Labels
cds 1.1 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 (((
cds 3.1 230 Nodes
cds 1.1 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 )))|(((
msp 17.1 256
cds 1.1 257 )))
258 |(((
259 Layout Hierarchy
260 )))|(((
261 de.cau.cs.kieler.layoutHierarchy
262 )))|(((
263 Boolean
264 )))|(((
265 Parents
266 )))|(((
267 false
268 )))
269 |(((
msp 16.1 270 [[Layout Algorithm>>doc:||anchor="layoutAlgorithm"]]
cds 1.1 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 (((
cds 3.1 291 Nodes
292 Parents
cds 1.1 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 (((
cds 3.1 308 Nodes
309 Parents
cds 1.1 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 )))|(((
msp 17.1 355
cds 1.1 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 (((
cds 10.1 375 [[Port Offset>>doc:||anchor="portOffset"]]
cds 1.1 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 (((
cds 3.1 384 Ports
cds 1.1 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 (((
cds 3.1 400 Ports
cds 1.1 401 )))|(% colspan="1" %)(% colspan="1" %)
402 (((
msp 17.1 403
cds 1.1 404 )))
msp 17.1 405 |(% colspan="1" %)(% colspan="1" %)
406 (((
407 Port Spacing
408 )))|(% colspan="1" %)(% colspan="1" %)
409 (((
410 de.cau.cs.kieler.portSpacing
411 )))|(% colspan="1" %)(% colspan="1" %)
412 (((
413 Float
414 )))|(% colspan="1" %)(% colspan="1" %)
415 (((
416 Nodes
417 )))|(% colspan="1" %)(% colspan="1" %)
418 (((
419
420 )))
cds 1.1 421 |(((
422 Position
423 )))|(((
424 de.cau.cs.kieler.position
425 )))|(((
426 Object
427 )))|(((
428 Labels
429 Nodes
430 Ports
431 )))|(((
432
433 )))
434 |(((
435 Priority
436 )))|(((
437 de.cau.cs.kieler.priority
438 )))|(((
439 Int
440 )))|(((
441 Edges
442 Nodes
443 )))|(((
444
445 )))
446 |(% colspan="1" %)(% colspan="1" %)
447 (((
448 Randomization Seed
449 )))|(% colspan="1" %)(% colspan="1" %)
450 (((
451 de.cau.cs.kieler.randomSeed
452 )))|(% colspan="1" %)(% colspan="1" %)
453 (((
454 Int
455 )))|(% colspan="1" %)(% colspan="1" %)
456 (((
457 Parents
458 )))|(% colspan="1" %)(% colspan="1" %)
459 (((
460
461 )))
462 |(% colspan="1" %)(% colspan="1" %)
463 (((
464 Separate Connected Components
465 )))|(% colspan="1" %)(% colspan="1" %)
466 (((
467 de.cau.cs.kieler.separateConnComp
468 )))|(% colspan="1" %)(% colspan="1" %)
469 (((
470 Boolean
471 )))|(% colspan="1" %)(% colspan="1" %)
472 (((
473 Parents
474 )))|(% colspan="1" %)(% colspan="1" %)
475 (((
476
477 )))
478 |(% colspan="1" %)(% colspan="1" %)
479 (((
480 Size Constraint
481 )))|(% colspan="1" %)(% colspan="1" %)
482 (((
483 de.cau.cs.kieler.sizeConstraint
484 )))|(% colspan="1" %)(% colspan="1" %)
485 (((
486 EnumSet
487 )))|(% colspan="1" %)(% colspan="1" %)
488 (((
489 Nodes
490 )))|(% colspan="1" %)(% colspan="1" %)
491 (((
492
493 )))
494 |(% colspan="1" %)(% colspan="1" %)
495 (((
496 Size Options
497 )))|(% colspan="1" %)(% colspan="1" %)
498 (((
499 de.cau.cs.kieler.sizeOptions
500 )))|(% colspan="1" %)(% colspan="1" %)
501 (((
502 EnumSet
503 )))|(% colspan="1" %)(% colspan="1" %)
504 (((
505 Nodes
506 )))|(% colspan="1" %)(% colspan="1" %)
507 (((
508 DEFAULT_MINIMUM_SIZE
509 )))
510 |(% colspan="1" %)(% colspan="1" %)
511 (((
512 Spacing
513 )))|(% colspan="1" %)(% colspan="1" %)
514 (((
515 de.cau.cs.kieler.spacing
516 )))|(% colspan="1" %)(% colspan="1" %)
517 (((
518 Float
519 )))|(% colspan="1" %)(% colspan="1" %)
520 (((
521 Parents
522 )))|(% colspan="1" %)(% colspan="1" %)
523 (((
msp 17.1 524
cds 1.1 525 )))
526
527 = The Most Important Options =
528
msp 16.1 529 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.
cds 1.1 530
msp 16.1 531 == Layout Algorithm ==
532
533 {{id name="layoutAlgorithm"/}}
534
535 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.
536
537 The following layout types are predefined:
538
539 * **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.
540 * **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.
541 * **Force** - Layout algorithms that follow physical analogies by simulating a system of attractive and repulsive forces.
542 * **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.
543 * **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.
544
545 === Available Algorithms and Libraries ===
546
547 * **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.
548 * **Randomizer** - Distributes the nodes randomly; not very useful, but it can show how important a good layout is for understanding a graph.
549 * (((
550 **Box Layout** - Ignores edges, places all nodes in rows. Can be used to layout collections of unconnected boxes, such as Statechart regions.
551 )))
552 * **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.
553 * **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.
554 * **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.
555
556 == Diagram Type ==
557
558 {{id name="diagramType"/}}
559
560 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.
561
562 The following diagram types are predefined:
563
564 * **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.
565 * **State Machine** - All kinds of state machines, automata, and activity diagrams. Examples: [[doc:SCCharts SyncCharts]], UML Activity diagrams.
566 * **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)]].
567 * **Class Diagram** - Class diagrams such as Ecore diagrams for the [[EMF>>url:http://www.eclipse.org/modeling/emf/||shape="rect"]] or UML Class diagrams.
568 * **Use Case Diagram** - Use case diagrams as defined by the UML.
569 * **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]].
570
571 == Other Options ==
572
573 * **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.
574 * **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.
575 * **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.
576 * **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.
577
cds 1.1 578 = Detailed Documentation =
579
580 This section explains every layout option in more detail.
581
cds 12.1 582 == Edge Routing ==
583
584 {{id name="edgeRouting"/}}
585
586 This option influences the way in which edges are routed between the nodes they connect. The following settings are available:
587
588 * POLYLINE
589 Edges consist of one or more segments defined by a list of bend points.
590 * ORTHOGONAL
591 Edges are routed orthogonally, meaning that each segment of an edge runs either horizontally or vertically, but never at an angle.
592 * SPLINE
593 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.
594 * UNDEFINED
595 No particular edge routing style is selected. The result produced by the layout algorithm may be undefined.
596
cds 14.1 597 (% style="color: rgb(153,51,0);" %)**TODO:** Add an image illustrating the different routing styles.
598
cds 8.1 599 == Port Offset ==
cds 1.1 600
cds 9.1 601 {{id name="portOffset"/}}
cds 5.1 602
cds 1.1 603 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.
cds 3.1 604
605 Set this property if one of the following cases applies:
606
607 * The port constraints on a node are set to FREE, FIXED_SIDES or FIXED_ORDER.
608 * 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.)