Search this API

y.layout.tree
Class MultiParentDescriptor

java.lang.Object
  extended by y.layout.tree.MultiParentDescriptor

public class MultiParentDescriptor
extends java.lang.Object

The MultiParentDescriptor provides style information for multi-parent structures.

This class is used by GenericTreeLayouter to determine the desired layout of nodes that constitute a multi-parent structure. All nodes of such a structure are placed side by side and the incident edges are routed over common points for incoming edges and for outgoing edges.


A tree graph containing multi-parent structures

See Also:
GenericTreeLayouter.MULTI_PARENT_DESCRIPTOR_DPKEY
 

Field Summary
static byte EDGE_STYLE_ORTHOGONAL
          Routing style for routing non-shared edge segments in an orthogonal fashion.
static byte EDGE_STYLE_POLYLINE
          Routing style for routing non-shared edge segments in a polyline fashion.
static byte EDGE_STYLE_STRAIGHT
          Routing style for routing non-shared edge segments straight.
 
Constructor Summary
MultiParentDescriptor()
          Creates a new MultiParentDescriptor instance with default settings.
 
Method Summary
 byte getEdgeStyle()
          Returns the routing style for edges that connect to nodes which constitute a multi-parent structure.
 double getMinimumBusDistance()
          Returns the minimum distance between the nodes of a multi-parent structure and the bus connecting these nodes.
 double getMinimumNodeDistance()
          Returns the minimum distance between two nodes belonging to the same multi-parent structure.
 double getVerticalAlignment()
          Returns the relative vertical alignment of nodes belonging to the same multi-parent structure.
 void setEdgeStyle(byte style)
          Specifies the routing style for edges that connect to nodes which constitute a multi-parent structure.
 void setMinimumBusDistance(double minimumBusDistance)
          Specifies the minimum distance between the nodes of a multi-parent structure and the bus connecting these nodes.
 void setMinimumNodeDistance(double minimumNodeDistance)
          Specifies the minimum distance between two nodes belonging to the same multi-parent structure.
 void setVerticalAlignment(double verticalAlignment)
          Specifies the relative vertical alignment of nodes belonging to the same multi-parent structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_STYLE_POLYLINE

public static final byte EDGE_STYLE_POLYLINE
Routing style for routing non-shared edge segments in a polyline fashion.

The edges connected to a multi-parent structure will share their paths until shortly above/below the multi-parent nodes. This style only applies to the part of the edges where they split to connect to different multi-parents.

See Also:
setEdgeStyle(byte), Constant Field Values
Sample Graph:

Polyline routing of edge segments that don't share a common path

EDGE_STYLE_ORTHOGONAL

public static final byte EDGE_STYLE_ORTHOGONAL
Routing style for routing non-shared edge segments in an orthogonal fashion.

The edges connected to a multi-parent structure will share their paths until shortly above/below the multi-parent nodes. This style only applies to the part of the edges where they split to connect to different multi-parents.

See Also:
setEdgeStyle(byte), Constant Field Values
Sample Graph:

Orthogonal routing of edge segments that don't share a common path

EDGE_STYLE_STRAIGHT

public static final byte EDGE_STYLE_STRAIGHT
Routing style for routing non-shared edge segments straight. This style will route the part of the edges that doesn't share the same path directly from the center of the multi-parent to the common point of the edges in the multi-parent structure.

The edges connected to a multi-parent structure will share their paths until shortly above/below the multi-parent nodes. This style only applies to the part of the edges where they split to connect to different multi-parents.

See Also:
setEdgeStyle(byte), Constant Field Values
Sample Graph:

Straight-line routing of edge segments that don't share a common path
Constructor Detail

MultiParentDescriptor

public MultiParentDescriptor()
Creates a new MultiParentDescriptor instance with default settings.

Method Detail

getMinimumNodeDistance

public double getMinimumNodeDistance()
Returns the minimum distance between two nodes belonging to the same multi-parent structure.

The distance needs to be non-negative.

Returns:
the minimum distance between nodes
See Also:
setMinimumNodeDistance(double)

setMinimumNodeDistance

public void setMinimumNodeDistance(double minimumNodeDistance)
Specifies the minimum distance between two nodes belonging to the same multi-parent structure.

The distance needs to be non-negative.

Default Value:
The default value is 15d.
Parameters:
minimumNodeDistance - the minimum distance between nodes
Throws:
java.lang.IllegalArgumentException - if the given node distance is negative
Sample Graphs:

10

50

getMinimumBusDistance

public double getMinimumBusDistance()
Returns the minimum distance between the nodes of a multi-parent structure and the bus connecting these nodes. In case the edge style is not orthogonal, the bus only consists of a common point.

The minimum distance needs to be non-negative.

Returns:
the minimum bus distance
See Also:
setMinimumBusDistance(double)

setMinimumBusDistance

public void setMinimumBusDistance(double minimumBusDistance)
Specifies the minimum distance between the nodes of a multi-parent structure and the bus connecting these nodes. In case the edge style is not orthogonal, the bus only consists of a common point.

The minimum distance needs to be non-negative.

Default Value:
The default value is 10.
Parameters:
minimumBusDistance - the minimum bus distance
Throws:
java.lang.IllegalArgumentException - if the given bus distance is negative
Sample Graphs:

10

40

getVerticalAlignment

public double getVerticalAlignment()
Returns the relative vertical alignment of nodes belonging to the same multi-parent structure.

A value of 0 means that nodes are top-aligned; a value of 1 means that nodes are bottom-aligned; a value of 0.5 means that nodes are center-aligned.

Values outside the interval [0,1] will result in a compact node placement with unaligned nodes, especially when labels are considered.

Returns:
the relative vertical alignment of multi-parent nodes
See Also:
setVerticalAlignment(double)

setVerticalAlignment

public void setVerticalAlignment(double verticalAlignment)
Specifies the relative vertical alignment of nodes belonging to the same multi-parent structure.

A value of 0 means nodes are top aligned; a value of 1 means nodes are bottom aligned; a value of 0.5 means nodes are center aligned.

Values outside the interval [0,1] will result in a compact node placement with unaligned nodes, especially when labels are considered.

Default Value:
The default value is 0.5.
Parameters:
verticalAlignment - the relative vertical alignment of multi-parent nodes
Sample Graphs:

0

0.5

1

getEdgeStyle

public byte getEdgeStyle()
Returns the routing style for edges that connect to nodes which constitute a multi-parent structure.

 
The routing style is applied only to the part of the edge route that is not shared by multiple edges.
Returns:
one of the predefined routing styles
See Also:
setEdgeStyle(byte)

setEdgeStyle

public void setEdgeStyle(byte style)
Specifies the routing style for edges that connect to nodes which constitute a multi-parent structure.

 
The routing style is applied only to the part of the edge route that is not shared by multiple edges.
Default Value:
The default value is EDGE_STYLE_ORTHOGONAL
Parameters:
style - one of the predefined routing styles
Throws:
java.lang.IllegalArgumentException - if the given routing style is unknown

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.