Versions Compared

Key

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

This page documents how KLay Layered implements label placement, port placement, and node sizing.

Note
titleWork in Progress

Everything on this page is still subject to change – this is the bleeding edge of science! We're still working on this stuff, trying out different concepts, and moving things around, all for the benefit of mankind. You're welcome.

Contents

Table of Contents

...

Matters get more complicated if we allow port positions to be changed. If the western port is moved upwards and the eastern port downwards, the labels don't overlap anymoreany more. Thus, label placement also influences port placement.

...

The insets area is the part of the node where port and node labels are placed (if they are placed inside the node as opposed to outside the node). The child area is what is left of the node with the insets subtracted. With the SizeOptions.COMPUTE_INSETS, KLay Layered can compute the child area and return it. This makes it easy to use in cases where the child area of the node is going to be used for displaying graphics or further text. If a minimum size is set on the node and the options SizeConstraint.MINIMUM_SIZE and SizeOPTIONSSizeOptions.MINIMUM_SIZE_ACCOUNTS_FOR_INSETS are set, the minimum size will effectively only apply to the child area. Thus, KLay Layered can be told to ensure that the child area of a node has at least a given size, whatever space the port labels and node labels require.

...

  • More than one port label.More than one
  • Different placements for each node label. More than one label can usually be combined into a single KLabel object if the labels are to be placed next to each other anywayAs of now, node labels are placed by arranging them in a vertical stack at the desired node label position.

General Approach

The general approach to solving label placement, port placement, and node sizing follows the following general pattern:

...

OptionTargetDescription
LayoutOptions.NODE_LABEL_PLACEMENTNode

Determines where node labels are placed. A valid set of values contains exactly one constant from each of the following sets of constants:

  • NodeLabelPlacement.INSIDE and NodeLabelPlacement.OUTSIDE
  • NodeLabelPlacement.H_LEFTNodeLabelPlacement.H_CENTER, and NodeLabelPlacement.H_RIGHT
  • NodeLabelPlacement.V_TOPNodeLabelPlacement.V_CENTER, and NodeLabelPlacement.V_BOTTOM
LayoutOptions.PORT_LABEL_PLACEMENTNodeDetermines where port labels are placed: inside or outside their node.
LayoutOptions.LABEL_SPACINGGraphDetermines the amount of space left between labels and the objects they label.
LayoutOptions.SIZE_CONSTRAINTNodeThe amount of freedom in determining the size of a node.
LayoutOptions.SIZE_OPTIONSNodeOptions for node size calculation.
LayoutOptions.MIN_WIDTHNodeThe minimal width of a node. If set, overrides the default minimal width.
LayoutOptions.MIN_HEIGHTNodeThe minimal height of a node. If set, overrides the default minimal height.
LayoutOptions.PORT_CONSTRAINTSNodeFreedom in placing ports.
Properties.PORT_SPACINGNodeHow much space should be left between ports.