Versions Compared

Key

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

...

When talking about label placement and node sizing, it helps to know what the two actually are. Let's start with node sizing:

Panel
borderStylesolid
titleNode Sizing
borderStylesolid

Node sizing is the act of determining the size of a node. In KIML, a layout algorithm can be granted different kinds of freedom in calculating the size of a node. The different kinds are expressed through a subset of the following options, as defined (and documented) in the SizeConstraint enumeration:

  • PORTS
  • PORT_LABELS
  • NODE_LABELS
  • MINIMUM_SIZE

On the one extreme, the subset can be empty, thereby fixing the node size. On the other extreme, the set can contain all options, thereby giving the layout algorithm the maximum amount of flexibility.

The way the node size is determined can also be influenced by specifying a subset of the following options, as defined (and documented) in the SizeOptions enumeration:

  • DEFAULT_MINIMUM_SIZE
  • MINIMUM_SIZE_ACCOUNTS_FOR_INSETS
  • COMPUTE_INSETS

Label placement can be divided into port label placement and node label placement:

Panel
borderStylesolid
titlePort Placement
borderStylesolid

Port placement is the act of determining the position of ports. This includes determining the side of their node where the port gets attached, determining an order between ports on the same side, and determining the final position of each port. There are different levels of constraints on placing ports, as defined (and documents) in the PortConstraints enumeration:

  • FREE
  • FIXED_SIDE
  • FIXED_ORDER
  • FIXED_RATIO
  • FIXED_POS

Port placement can take place after crossing minimization, since the order of ports must be known and port placements needs to be fixed before node placement.

borderStyle
Panel
solidtitleLabel Placement
borderStylesolid

Label placement is the act of determining the position of labels, with the aim of keeping readability high. The two most critical objectives in label placement are the following:

  1. Avoiding overlaps between labels and other graphical objects, including other labels.
  2. Making sure that each label is closer to its associated graphical feature than to other, unrelated graphical features.

KLay Layered distinguishes three kinds of labels:

  1. Node labels
  2. Port labels
  3. Edge labels
    1. Tail labels
    2. Mid labels
    3. Head labels

Node labels and port labels can be placed inside or outside of their particular node.

...

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.