Search this API

y.layout.partial
Class PartialLayouter

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.partial.PartialLayouter
All Implemented Interfaces:
Layouter, LayoutStage

public class PartialLayouter
extends AbstractLayoutStage

This class represents a partial layouter. A partial layouter is a layout algorithm that changes the coordinates for a given set of graph elements (called partial elements). The location or size of the remaining elements (called fixed elements) is not allowed to be changed. The layout algorithm tries to place the partial elements such that the resulting drawing (including the fixed elements) has a good quality with respect to common graph drawing aesthetics.

This layouter can be applied to plain graphs as well as to grouped graphs. Note: when a partial node should be placed inside a fixed group node, it is important that there is enough free space inside the group. Otherwise, there may be overlapping node elements.

The layouter handles each selected graph element as partial element. Therefore it looks up the data provider keys PARTIAL_NODES_DPKEY and PARTIAL_EDGES_DPKEY. Partial node elements can be assigned to so called subgraph components. During the layout process each subgraph induced by the nodes of a component is first laid out using the specified core layouter setCoreLayouter(y.layout.Layouter). Then, the different components are placed one-by-one onto the drawing area such that the number of overlaps among graph elements is small. The user can specify different objectives for finding 'good' positions for subgraph components (setPositioningStrategy(byte)), e.g., SUBGRAPH_POSITIONING_STRATEGY_BARYCENTER specifies that the component should be placed close to the barycenter of its graph neighbors and SUBGRAPH_POSITIONING_STRATEGY_FROM_SKETCH specifies that the component should be placed close to its original position.

Method setComponentAssignmentStrategy(byte) allows to specify the strategy that is used to assign partial nodes to subgraph components. Possible values are COMPONENT_ASSIGNMENT_STRATEGY_CLUSTERING, COMPONENT_ASSIGNMENT_STRATEGY_CONNECTED, COMPONENT_ASSIGNMENT_STRATEGY_SINGLE and COMPONENT_ASSIGNMENT_STRATEGY_CUSTOMIZED. The last value allows to use a customized component assignment. Note: nodes of a component cannot be assigned to different group nodes.

Furthermore, the user can specify the edge routing strategy (method setEdgeRoutingStrategy(byte)) that is used for routing partial edges and edges between different subgraph components (so-called inter-edges). Possible values are EDGE_ROUTING_STRATEGY_ORGANIC, EDGE_ROUTING_STRATEGY_ORTHOGONAL, EDGE_ROUTING_STRATEGY_STRAIGHTLINE, EDGE_ROUTING_STRATEGY_OCTILINEAR and EDGE_ROUTING_STRATEGY_AUTOMATIC.


Nested Class Summary
static class PartialLayouter.StraightLineEdgeRouter
          Simple Edge Router that draws edges straight-line.
 
Field Summary
static Object COMPONENT_ASSIGNMENT_DPKEY
          DataProvider key used to store an object for each partial node of the graph.
static byte COMPONENT_ASSIGNMENT_STRATEGY_CLUSTERING
          Specifier for the strategy that is used to assign partial nodes to subgraph components.
static byte COMPONENT_ASSIGNMENT_STRATEGY_CONNECTED
          Specifier for the strategy that is used to assign partial nodes to subgraph components.
static byte COMPONENT_ASSIGNMENT_STRATEGY_CUSTOMIZED
          Specifier for the strategy that is used to assign partial nodes to subgraph components.
static byte COMPONENT_ASSIGNMENT_STRATEGY_SINGLE
          Specifier for the strategy that is used to assign partial nodes to subgraph components.
static byte EDGE_ROUTING_STRATEGY_AUTOMATIC
          Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components).
static byte EDGE_ROUTING_STRATEGY_OCTILINEAR
          Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components).
static byte EDGE_ROUTING_STRATEGY_ORGANIC
          Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components).
static byte EDGE_ROUTING_STRATEGY_ORTHOGONAL
          Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components).
static byte EDGE_ROUTING_STRATEGY_STRAIGHTLINE
          Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components).
static byte ORIENTATION_AUTO_DETECTION
          Specifies the orientation of the drawing.
static byte ORIENTATION_BOTTOM_TO_TOP
          Specifies the orientation of the drawing.
static byte ORIENTATION_LEFT_TO_RIGHT
          Specifies the orientation of the drawing.
static byte ORIENTATION_NONE
          Specifies the orientation of the drawing.
static byte ORIENTATION_RIGHT_TO_LEFT
          Specifies the orientation of the drawing.
static byte ORIENTATION_TOP_TO_BOTTOM
          Specifies the orientation of the drawing.
static Object PARTIAL_EDGES_DPKEY
          The data provider key used to look up the partial edges of the graph.
static Object PARTIAL_NODES_DPKEY
          The data provider key used to look up the partial nodes of the graph.
static String ROUTE_EDGE_DPKEY
          The data provider key used to mark edges for routing.
static byte SUBGRAPH_POSITIONING_STRATEGY_BARYCENTER
          Specifies the objective used for finding 'good' positions for subgraph components.
static byte SUBGRAPH_POSITIONING_STRATEGY_FROM_SKETCH
          Specifies the objective used for finding 'good' positions for subgraph components.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
PartialLayouter()
          Creates a new instance of the PartialLayouter.
PartialLayouter(Layouter subgraphLayouter)
          Creates a new instance of the PartialLayouter.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be laid out by this algorithm.
protected  void configureEdgeRouter(Layouter edgeRouter)
          This method is called each time edges are routed with an edge router instance.
 void doLayout(LayoutGraph graph)
          Main layout routine that assigns new layout information to the given graph.
 void doPartialLayout(LayoutGraph graph)
          This method calculates the partial layout.
 byte getComponentAssignmentStrategy()
          Returns the strategy that is used to assign partial nodes to subgraph components.
 Layouter getCoreLayouter()
          Returns the core layouter, i.e., the layout algorithm that is applied to the subgraph components.
 Layouter getEdgeRouter()
          Returns the edge router used for routing partial edges as well as edges between different subgraph components (so-called inter-edges).
 byte getEdgeRoutingStrategy()
          Return the specified edge routing strategy.
 byte getLayoutOrientation()
          Returns the layout orientation.
 long getMaximalDuration()
          Returns the time limit (in milliseconds) set for the layout algorithm.
 int getMinimalNodeDistance()
          Returns the minimum distance between two adjacent nodes.
 byte getPositioningStrategy()
          Returns the objective used for finding 'good' positions for subgraph components.
 boolean isConsiderNodeAlignment()
          Returns true, if node alignment is enabled, that is the algorithm tries to align partial nodes with other nodes.
 boolean isFixedGroupResizingEnabled()
          Returns whether or not fixed group nodes may be resized.
 boolean isMirroringAllowed()
          Returns whether or not subgraph components may be mirrored to improve the layout quality, i.e., for each component the algorithm checks which of the four possible mirrorings minimizes the edge length.
 boolean isOrientationOptimizationEnabled()
          Returns whether or not a postprocessing step should be applied to reduce the number of edges that do not comply with the desired orientation.
 boolean isPackComponentsEnabled()
          If enabled, the bounding boxes of subgraph components may overlap (elements of different components will still not overlap).
 boolean isRouteInterEdgesImmediatelyEnabled()
          Returns whether or not edges between different subgraph components should be routed immediately.
protected  void layoutSubgraph(LayoutGraph subGraph)
          Calculates the layout for the subgraph component.
protected  void placeSubgraphs(LayoutGraph graph, NodeList[] subgraphComponents)
          This method places the subgraph components one-by-one onto the drawing area.
protected  void routeEdgesBetweenFixedElements(LayoutGraph graph, EdgeList partialEdges)
          This method routes all partial edges that connect two fixed elements.
protected  void routeInterEdges(LayoutGraph graph, EdgeList interEdges)
          This method routes all inter-edges, that is edges between different subgraph components (including edges between fixed and partial elements).
 void setComponentAssignmentStrategy(byte strategy)
          Specifies the strategy that is used to assign partial nodes to subgraph components.
 void setConsiderNodeAlignment(boolean considerNodeAlignment)
          Specifies whether or not nodes should be aligned.
 void setCoreLayouter(Layouter layouter)
          Sets the core layouter, i.e., the layout algorithm that is applied to the subgraph components.
 void setEdgeRouter(Layouter edgeRouter)
          Sets a customized edge router.
 void setEdgeRoutingStrategy(byte strategy)
          This method allows to specify the edge routing strategy that is used for routing partial edges and edges between different subgraph components (so-called inter-edges).
 void setFixedGroupResizingEnabled(boolean fixedGroupResizingEnabled)
          Specifies whether or not fixed (non-partial) group nodes may be resized.
 void setLayoutOrientation(byte layoutOrientation)
          Specifies the layout orientation.
 void setMaximalDuration(long maximalDuration)
          Sets a preferred time limit (in milliseconds) for the layout algorithm.
 void setMinimalNodeDistance(int minimalNodeDistance)
          Sets the minimum distance between two adjacent nodes.
 void setMirroringAllowed(boolean mirroringAllowed)
          Specifies whether or not subgraph components may be mirrored to improve the layout quality, i.e., for each component the algorithm checks which of the four possible mirrorings minimizes the edge length.
 void setOrientationOptimizationEnabled(boolean enabled)
          Specifies whether or not a postprocessing step should be applied to reduce the number of edges that do not comply with the desired orientation.
 void setPackComponentsEnabled(boolean packComponentsEnabled)
          Packing subgraph components leads to more compact layout results.
 void setPositioningStrategy(byte strategy)
          Specifies the objective used for finding 'good' positions for subgraph components.
 void setRouteInterEdgesImmediatelyEnabled(boolean enabled)
          Whether or not edges between different subgraph components should be routed immediately.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARTIAL_NODES_DPKEY

public static final Object PARTIAL_NODES_DPKEY
The data provider key used to look up the partial nodes of the graph. The looked up data provider should provide boolean values for the nodes of that graph. The boolean value should signal whether a node is to be considered as partial or not.


PARTIAL_EDGES_DPKEY

public static final Object PARTIAL_EDGES_DPKEY
The data provider key used to look up the partial edges of the graph. The looked up data provider should provide boolean values for the edges of that graph. The boolean value should signal whether an edge is to be considered as partial or not.


ROUTE_EDGE_DPKEY

public static final String ROUTE_EDGE_DPKEY
The data provider key used to mark edges for routing. The registered data provider's getBool method will return true for edges that have to be routed and false for all other edges.

See Also:
setEdgeRouter(y.layout.Layouter), Constant Field Values

EDGE_ROUTING_STRATEGY_ORTHOGONAL

public static final byte EDGE_ROUTING_STRATEGY_ORTHOGONAL
Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components). The algorithm will use orthogonal routes for inter-edges, i.e., each edge only consists of vertical and horizontal segments.

See Also:
getEdgeRoutingStrategy(), setEdgeRoutingStrategy(byte), Constant Field Values

EDGE_ROUTING_STRATEGY_STRAIGHTLINE

public static final byte EDGE_ROUTING_STRATEGY_STRAIGHTLINE
Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components). The algorithm will use straight-line routes for inter-edges.

See Also:
getEdgeRoutingStrategy(), setEdgeRoutingStrategy(byte), Constant Field Values

EDGE_ROUTING_STRATEGY_AUTOMATIC

public static final byte EDGE_ROUTING_STRATEGY_AUTOMATIC
Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components). The algorithm automatically chooses a suitable routing strategy.

See Also:
getEdgeRoutingStrategy(), setEdgeRoutingStrategy(byte), Constant Field Values

EDGE_ROUTING_STRATEGY_ORGANIC

public static final byte EDGE_ROUTING_STRATEGY_ORGANIC
Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components). The algorithm will use organic routes for inter-edges.

See Also:
getEdgeRoutingStrategy(), setEdgeRoutingStrategy(byte), Constant Field Values

EDGE_ROUTING_STRATEGY_OCTILINEAR

public static final byte EDGE_ROUTING_STRATEGY_OCTILINEAR
Specifier for the routing strategy of inter-edges (edges between fixed and partial nodes as well as edges between different subgraph components). The algorithm will use octilinear routes for inter-edges (the slope of each segment is a multiple of 45 degree).

See Also:
getEdgeRoutingStrategy(), setEdgeRoutingStrategy(byte), Constant Field Values

COMPONENT_ASSIGNMENT_DPKEY

public static final Object COMPONENT_ASSIGNMENT_DPKEY
DataProvider key used to store an object for each partial node of the graph. All partial nodes associated with the same object are assigned to the same subgraph component. Note: nodes of a component cannot be assigned to different group nodes as well as different partition cells.

See Also:
COMPONENT_ASSIGNMENT_STRATEGY_CUSTOMIZED, getComponentAssignmentStrategy(), setComponentAssignmentStrategy(byte)

COMPONENT_ASSIGNMENT_STRATEGY_SINGLE

public static final byte COMPONENT_ASSIGNMENT_STRATEGY_SINGLE
Specifier for the strategy that is used to assign partial nodes to subgraph components. This value specifies that each partial node is assigned to a separate component.

See Also:
getComponentAssignmentStrategy(), setComponentAssignmentStrategy(byte), Constant Field Values

COMPONENT_ASSIGNMENT_STRATEGY_CONNECTED

public static final byte COMPONENT_ASSIGNMENT_STRATEGY_CONNECTED
Specifier for the strategy that is used to assign partial nodes to subgraph components. This value specifies that all partial nodes of a connected component are assigned to the same subgraph component.

See Also:
getComponentAssignmentStrategy(), setComponentAssignmentStrategy(byte), Constant Field Values

COMPONENT_ASSIGNMENT_STRATEGY_CLUSTERING

public static final byte COMPONENT_ASSIGNMENT_STRATEGY_CLUSTERING
Specifier for the strategy that is used to assign partial nodes to subgraph components. This value specifies that the algorithm should use a natural clustering algorithm to determine the subgraph components (nodes of the same cluster are in the same subgraph component).

See Also:
getComponentAssignmentStrategy(), setComponentAssignmentStrategy(byte), Constant Field Values

COMPONENT_ASSIGNMENT_STRATEGY_CUSTOMIZED

public static final byte COMPONENT_ASSIGNMENT_STRATEGY_CUSTOMIZED
Specifier for the strategy that is used to assign partial nodes to subgraph components. This value allows to use a customized component assignment, see COMPONENT_ASSIGNMENT_DPKEY.

See Also:
getComponentAssignmentStrategy(), setComponentAssignmentStrategy(byte), Constant Field Values

SUBGRAPH_POSITIONING_STRATEGY_BARYCENTER

public static final byte SUBGRAPH_POSITIONING_STRATEGY_BARYCENTER
Specifies the objective used for finding 'good' positions for subgraph components. This values specifies that each component should be placed close to the barycenter of its graph neighbors.

See Also:
getPositioningStrategy(), setPositioningStrategy(byte), Constant Field Values

SUBGRAPH_POSITIONING_STRATEGY_FROM_SKETCH

public static final byte SUBGRAPH_POSITIONING_STRATEGY_FROM_SKETCH
Specifies the objective used for finding 'good' positions for subgraph components. This values specifies that each component should be placed close to its original position.

See Also:
getPositioningStrategy(), setPositioningStrategy(byte), Constant Field Values

ORIENTATION_TOP_TO_BOTTOM

public static final byte ORIENTATION_TOP_TO_BOTTOM
Specifies the orientation of the drawing. This value specifies that the algorithm should try to place partial nodes (subgraph components) such that each predecessor of a node v is placed above v and each successor below v.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values

ORIENTATION_BOTTOM_TO_TOP

public static final byte ORIENTATION_BOTTOM_TO_TOP
Specifies the orientation of the drawing. This value specifies that the algorithm should try to place partial nodes (subgraph components) such that each predecessor of a node v is placed below v and each successor above v.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values

ORIENTATION_LEFT_TO_RIGHT

public static final byte ORIENTATION_LEFT_TO_RIGHT
Specifies the orientation of the drawing. This value specifies that the algorithm should try to place partial nodes (subgraph components) such that each predecessor of a node v is placed to the left of v and each successor to the right of v.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values

ORIENTATION_RIGHT_TO_LEFT

public static final byte ORIENTATION_RIGHT_TO_LEFT
Specifies the orientation of the drawing. This value specifies that the algorithm should try to place partial nodes (subgraph components) such that each predecessor of a node v is placed to the right of v and each successor to the left of v.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values

ORIENTATION_AUTO_DETECTION

public static final byte ORIENTATION_AUTO_DETECTION
Specifies the orientation of the drawing. This value specifies that the layout algorithm should detect the orientation automatically. Therefore it analysis the current drawing.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values

ORIENTATION_NONE

public static final byte ORIENTATION_NONE
Specifies the orientation of the drawing.

See Also:
getLayoutOrientation(), setLayoutOrientation(byte), Constant Field Values
Constructor Detail

PartialLayouter

public PartialLayouter()
Creates a new instance of the PartialLayouter.


PartialLayouter

public PartialLayouter(Layouter subgraphLayouter)
Creates a new instance of the PartialLayouter. The parameter specifies the layout algorithm that is used for the subgraph components.

Parameters:
subgraphLayouter - the layout algorithm that is applied to the subgraph components.
Method Detail

setCoreLayouter

public void setCoreLayouter(Layouter layouter)
Sets the core layouter, i.e., the layout algorithm that is applied to the subgraph components.

Specified by:
setCoreLayouter in interface LayoutStage
Overrides:
setCoreLayouter in class AbstractLayoutStage

getCoreLayouter

public Layouter getCoreLayouter()
Returns the core layouter, i.e., the layout algorithm that is applied to the subgraph components.

Specified by:
getCoreLayouter in interface LayoutStage
Overrides:
getCoreLayouter in class AbstractLayoutStage

getMaximalDuration

public long getMaximalDuration()
Returns the time limit (in milliseconds) set for the layout algorithm. By default the time limit is Integer.MAX_VALUE.

Returns:
the time limit.
See Also:
setMaximalDuration(long)

setMaximalDuration

public void setMaximalDuration(long maximalDuration)
Sets a preferred time limit (in milliseconds) for the layout algorithm. Note that restricting the maximal duration may result in a worse layout quality. Furthermore, the real runtime may exceed the maximal duration since the layout algorithm still have to find a valid solution. By default the time limit is Integer.MAX_VALUE.

Parameters:
maximalDuration - the time limit.
See Also:
getMaximalDuration()

isRouteInterEdgesImmediatelyEnabled

public boolean isRouteInterEdgesImmediatelyEnabled()
Returns whether or not edges between different subgraph components should be routed immediately.

Returns:
true if the edges should be routed immediately.
See Also:
setRouteInterEdgesImmediatelyEnabled(boolean)

setRouteInterEdgesImmediatelyEnabled

public void setRouteInterEdgesImmediatelyEnabled(boolean enabled)
Whether or not edges between different subgraph components should be routed immediately. If this option is enabled, edges are routed during the placement of the subgraph components, i.e., immediately after a component is placed, its edges to other, already placed components are routed. Otherwise these edges are routed in a separate step after placing all subgraph components. By default this option is disabled.

Parameters:
enabled - if true edges between different subgraph components should be routed immediately.
See Also:
isRouteInterEdgesImmediatelyEnabled(), routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList), placeSubgraphs(y.layout.LayoutGraph, y.base.NodeList[])

isPackComponentsEnabled

public boolean isPackComponentsEnabled()
If enabled, the bounding boxes of subgraph components may overlap (elements of different components will still not overlap).

Returns:
true, if the bounding boxes of subgraph components may overlap.
See Also:
setPackComponentsEnabled(boolean)

setPackComponentsEnabled

public void setPackComponentsEnabled(boolean packComponentsEnabled)
Packing subgraph components leads to more compact layout results. If set to true, the bounding boxes of subgraph components may overlap (elements of different components will still not overlap).

See Also:
isPackComponentsEnabled()

isFixedGroupResizingEnabled

public boolean isFixedGroupResizingEnabled()
Returns whether or not fixed group nodes may be resized.

Returns:
true, if fixed group nodes may be resized.
See Also:
setFixedGroupResizingEnabled(boolean)

setFixedGroupResizingEnabled

public void setFixedGroupResizingEnabled(boolean fixedGroupResizingEnabled)
Specifies whether or not fixed (non-partial) group nodes may be resized.

See Also:
isFixedGroupResizingEnabled()

getPositioningStrategy

public byte getPositioningStrategy()
Returns the objective used for finding 'good' positions for subgraph components.

See Also:
setPositioningStrategy(byte)

setPositioningStrategy

public void setPositioningStrategy(byte strategy)
Specifies the objective used for finding 'good' positions for subgraph components.

Parameters:
strategy - one of
See Also:
getPositioningStrategy()

getMinimalNodeDistance

public int getMinimalNodeDistance()
Returns the minimum distance between two adjacent nodes.


setMinimalNodeDistance

public void setMinimalNodeDistance(int minimalNodeDistance)
Sets the minimum distance between two adjacent nodes.

Parameters:
minimalNodeDistance - the minimum distance to use

isConsiderNodeAlignment

public boolean isConsiderNodeAlignment()
Returns true, if node alignment is enabled, that is the algorithm tries to align partial nodes with other nodes.

See Also:
setConsiderNodeAlignment(boolean)

setConsiderNodeAlignment

public void setConsiderNodeAlignment(boolean considerNodeAlignment)
Specifies whether or not nodes should be aligned. If set to true, the algorithm tries to align the center of partial nodes with other nodes.

See Also:
isConsiderNodeAlignment()

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as its argument will only success if this method returns true.


getComponentAssignmentStrategy

public byte getComponentAssignmentStrategy()
Returns the strategy that is used to assign partial nodes to subgraph components.

See Also:
setComponentAssignmentStrategy(byte)

setComponentAssignmentStrategy

public void setComponentAssignmentStrategy(byte strategy)
Specifies the strategy that is used to assign partial nodes to subgraph components.

Parameters:
strategy - one of
See Also:
getComponentAssignmentStrategy()

isOrientationOptimizationEnabled

public boolean isOrientationOptimizationEnabled()
Returns whether or not a postprocessing step should be applied to reduce the number of edges that do not comply with the desired orientation.

By default, this feature is disabled.

Returns:
true, if the postprocessing step should be applied.
See Also:
setOrientationOptimizationEnabled(boolean), getLayoutOrientation(), setLayoutOrientation(byte)

setOrientationOptimizationEnabled

public void setOrientationOptimizationEnabled(boolean enabled)
Specifies whether or not a postprocessing step should be applied to reduce the number of edges that do not comply with the desired orientation.

By default, this feature is disabled.

Parameters:
enabled - true, if the postprocessing should be applied.
See Also:
getLayoutOrientation(), setLayoutOrientation(byte)

getEdgeRouter

public Layouter getEdgeRouter()
Returns the edge router used for routing partial edges as well as edges between different subgraph components (so-called inter-edges).

See Also:
setEdgeRouter(y.layout.Layouter), setEdgeRoutingStrategy(byte)

setEdgeRouter

public void setEdgeRouter(Layouter edgeRouter)
Sets a customized edge router. The specified edge router is used for routing partial edges as well as edges between different subgraph components (so-called inter-edges). Edges that have to be routed with the specified router will be marked using this algorithm's ROUTE_EDGE_DPKEY data provider key.

Note: the customized edge router is disabled when method setEdgeRoutingStrategy(byte) is called afterwards.

Parameters:
edgeRouter - the customized edge router.
See Also:
ROUTE_EDGE_DPKEY, getEdgeRouter(), setEdgeRoutingStrategy(byte)

getEdgeRoutingStrategy

public byte getEdgeRoutingStrategy()
Return the specified edge routing strategy.

See Also:
setEdgeRoutingStrategy(byte)

setEdgeRoutingStrategy

public void setEdgeRoutingStrategy(byte strategy)
This method allows to specify the edge routing strategy that is used for routing partial edges and edges between different subgraph components (so-called inter-edges).

Note: calling this method disables a previously set customized edge router (see method setEdgeRouter(y.layout.Layouter)).

Parameters:
strategy - one of
See Also:
getEdgeRoutingStrategy(), setEdgeRouter(y.layout.Layouter)

getLayoutOrientation

public byte getLayoutOrientation()
Returns the layout orientation.

See Also:
ORIENTATION_TOP_TO_BOTTOM, ORIENTATION_BOTTOM_TO_TOP, ORIENTATION_LEFT_TO_RIGHT, ORIENTATION_RIGHT_TO_LEFT, ORIENTATION_AUTO_DETECTION, ORIENTATION_NONE

setLayoutOrientation

public void setLayoutOrientation(byte layoutOrientation)
Specifies the layout orientation.

See Also:
ORIENTATION_TOP_TO_BOTTOM, ORIENTATION_BOTTOM_TO_TOP, ORIENTATION_LEFT_TO_RIGHT, ORIENTATION_RIGHT_TO_LEFT, ORIENTATION_AUTO_DETECTION, ORIENTATION_NONE

isMirroringAllowed

public boolean isMirroringAllowed()
Returns whether or not subgraph components may be mirrored to improve the layout quality, i.e., for each component the algorithm checks which of the four possible mirrorings minimizes the edge length.

See Also:
setMirroringAllowed(boolean)

setMirroringAllowed

public void setMirroringAllowed(boolean mirroringAllowed)
Specifies whether or not subgraph components may be mirrored to improve the layout quality, i.e., for each component the algorithm checks which of the four possible mirrorings minimizes the edge length.

Parameters:
mirroringAllowed - whether or not subgraph components may be mirrored/rotated.
See Also:
isMirroringAllowed()

doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Main layout routine that assigns new layout information to the given graph.


doPartialLayout

public void doPartialLayout(LayoutGraph graph)
This method calculates the partial layout. Therefore, it calls the following methods: 1. routeEdgesBetweenFixedElements(y.layout.LayoutGraph, y.base.EdgeList) 2. layoutSubgraph(y.layout.LayoutGraph) for each subgraph component 3. placeSubgraphs(y.layout.LayoutGraph, y.base.NodeList[]) 4. routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList)

Note: the method is called after applying the OrientationLayouter. Hence, the called methods always assume that the graph is drawn from top to bottom.

Parameters:
graph - the input graph.

layoutSubgraph

protected void layoutSubgraph(LayoutGraph subGraph)
Calculates the layout for the subgraph component.

Parameters:
subGraph - the subgraph component

placeSubgraphs

protected void placeSubgraphs(LayoutGraph graph,
                              NodeList[] subgraphComponents)
This method places the subgraph components one-by-one onto the drawing area. Therefore, it considers the specified objective for finding a 'good' position, see (setPositioningStrategy(byte)).

Parameters:
graph - the input graph
subgraphComponents - each entry contains a NodeList that defines a subgraph component

routeInterEdges

protected void routeInterEdges(LayoutGraph graph,
                               EdgeList interEdges)
This method routes all inter-edges, that is edges between different subgraph components (including edges between fixed and partial elements). Therefore, it uses the edge router set with method setEdgeRouter(y.layout.Layouter). If no edge router was specified by the user, it uses an internal edge router with routing strategy getEdgeRoutingStrategy().

Parameters:
graph - the original graph.
interEdges - the edges to route.

routeEdgesBetweenFixedElements

protected void routeEdgesBetweenFixedElements(LayoutGraph graph,
                                              EdgeList partialEdges)
This method routes all partial edges that connect two fixed elements. Therefore, it uses the edge router set with method setEdgeRouter(y.layout.Layouter). If no edge router was specified by the user, it uses an internal edge router with routing strategy getEdgeRoutingStrategy().

Parameters:
graph - the original graph.
partialEdges - the edges to route.

configureEdgeRouter

protected void configureEdgeRouter(Layouter edgeRouter)
This method is called each time edges are routed with an edge router instance. Hence, it offers a way to modify the used settings.

The type of the given instance depends on the edge routing strategy, i.e., if the routing strategy is set to EDGE_ROUTING_STRATEGY_OCTILINEAR or EDGE_ROUTING_STRATEGY_ORTHOGONAL it's an instance of PartialLayouter.StraightLineEdgeRouter, if the routing strategy is set to EDGE_ROUTING_STRATEGY_ORGANIC it's an instance of SmartOrganicLayouter, and, if the routing strategy is set to EDGE_ROUTING_STRATEGY_STRAIGHTLINE it's an instance of PartialLayouter.StraightLineEdgeRouter. If the edge routing strategy is set to EDGE_ROUTING_STRATEGY_AUTOMATIC one of the above strategies is used.

Note: if a customized edge router is set (see setEdgeRouter(y.layout.Layouter)), the edge router instance is of this type.

Parameters:
edgeRouter - the instance used for routing the edges.
See Also:
setEdgeRouter(y.layout.Layouter), setEdgeRoutingStrategy(byte)

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