Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes how layout options are applied by KIML during the layout process. After having read this, you should be able to answer the following questions:

  • What is a are layout configurationoptions?
  • How do layout options end up in KGraph elements?
  • How can I set layout options on elements programmatically?

...

Contents

Table of Contents

Layout Options and What They

...

Are Good For

Even the most basic layout algorithm has some settings for you to play with. This might be something as simple as the space left between different nodes, or something as complex as changing how node labels are placed and how that influences the size of each node. Each such setting must be registered with KIML as a layout option, and each algorithm must specify exactly which of these options it supports. Registering a layout option is done through one of KIML's extension points and can look like this:

Code Block
languagehtml/xml
<extension point="de.cau.cs.kieler.kiml.layoutProviders">
    <layoutOption
        id="de.cau.cs.kieler.nodeLabelPlacement"
        name="Node Label Placement"
        description="Hints for where node labels are to be placed; if empty, the node label's position is not modified."
        advanced="true"
        appliesTo="nodes"
        type="enumset"
        class="de.cau.cs.kieler.kiml.options.NodeLabelPlacement"
        default="">
     </layoutOption>
</extension>

Let's walk through the parameters of available for layout options :Options usually only make sense for a subset of objects. For example, the amount of space to be left around a diagram should be configured on the diagram's root element, not on a label; how node labels are placed should be set on each node, but not on edges. Therefor(not every available parameter appears in the example above):

  • id – A unique identifier for this layout option. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness.
  • type – Defines the data type of this option; must be either boolean, string, int, float, enum, enumset, or object. The types enum, enumset, and object require the class attribute to be set.
  • name – A user friendly name of this layout option, to be displayed in the UI.
  • description – A user friendly description of this layout option, to be displayed in the UI. The description should contain all information needed to understand what this option does.
  • advanced – Whether the option should only be shown in advanced mode in the layout view; default is false.
  • appliesTo – A comma separated list of targets on which the layout option can be applied; a target can be either parents (for nodes that contain further nodes), nodes (for all nodes regardless of whether they contain further nodes or not), edges, ports, or labels. If omitted, the layout option is not shown to the user in the layout view, which is a good thing for options that will be set programmatically anyway.
  • class – An optional Java class giving more detail on the data type. For enum and enumset options this attribute must hold the Enum class of the option. For object options it must hold the class name of an IDataObject implementation.
  • default – The default value to use when no other value can be determined for this option.
  • lowerBound – An optional lower bound on the values of this layout option. This is used when a layout configuration is determined automatically.
  • upperBound – An optional upper bound on the values of this layout option. This is used when a layout configuration is determined automatically.
  • variance – An optional variance for values of this layout option. This is used when a layout configuration is determined automatically. The variance is taken as multiplier for Gaussian distributions when new values are determined. Options with uniform distibution, such as Boolean or enumeration types, do not need a variance value, since all values have equal probability. A variance of 0 implies that the option shall not be used in automatic configuration, regardless of its type.
Warning
titleToDo

Provide a better explanation of what the latter three parameters are used for. Are they only relevant to evolutionary layout?

If a layout algorithm supports a particular layout option, it must tell KIML so. Here's an example:

Code Block
languagehtml/xml
<extension point="de.cau.cs.kieler.kiml.layoutProviders">
    <layoutAlgorithm ...>
        <knownOption
            option="de.cau.cs.kieler.borderSpacing"
            default="20">
        </knownOption>
    </layoutAlgorithm>
</extension>

This tells KIML that the defined layout algorithm supports the border spacing option. And even more, it overrides the default value declared by the layout option and sets it to 20.

The Layout Options Manager

Warning
titleToDo

Write this section.


Programmatically Setting Layout Options

Warning
titleToDo

Write this section. This will be about when to use the different kinds of layout configurations, mainly SemanticLayoutConfig and VolatileLayoutConfig.