y.layout.orthogonal
Class DirectedOrthogonalLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.orthogonal.DirectedOrthogonalLayouter
All Implemented Interfaces:
Layouter

public class DirectedOrthogonalLayouter
extends CanonicMultiStageLayouter

This class is a variant of OrthogonalLayouter that can route edges in a way that they point to a main layout direction. Also, this class can route edges that connect to the same node in a shared bus-structure. A typical use case for this layout algorithm are UML class diagrams that contain some relationships like generalization or realization which are best expressed by upward-pointing edges.

Directed edges are marked by a boolean data provider that is registered with the key DIRECTED_EDGE_DPKEY to the input graph. Edge groups at a common node can be specified by registering data providers with the keys PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY.

Like OrthogonalLayouter this layout algorithm can consider edge label data when laying out a graph. That means that the layout of edge labels will be part of the resulting layout and the layout of nodes and edges is chosen in such a way that the edge labels do not conflict with the rest of the layout. See classes LabelLayoutData, LabelLayoutConstants LabelLayoutKeys and LabelLayoutTranslator on how to setup the integrated edge label layout feature.

Here is an sample output of the layout algorithm. Note that all edges painted in red are marked as directed edges. Also, the directed edges at each node have been put into the same edge group.

 
Your browser does not support SVG content.

Field Summary
static Object DIRECTED_EDGE_DPKEY
          DataProvider key that is used to mark edges that should be routed in a way that point in the main layout direction.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
DirectedOrthogonalLayouter()
          Creates a new instance of this class.
 
Method Summary
protected  boolean canLayoutCore(LayoutGraph graph)
          Subclasses have to provide information whether or not they can layout the given graph.
 void doLayout(LayoutGraph graph)
          Calculates a layout for the given graph.
protected  void doLayoutCore(LayoutGraph graph)
          Subclasses have to provide core layout code in this method.
 int getGrid()
          Returns the currently set grid spacing.
 boolean getUseSketchDrawing()
          Returns if the existing drawing should be used as sketch.
 void setGrid(int grid)
          Sets the grid spacing to be used.
 void setUseSketchDrawing(boolean value)
          Sets if the existing drawing should be used as sketch.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setComponentLayouterEnabled, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setParallelEdgeLayouterEnabled, setSelfLoopLayouter, setSelfLoopLayouterEnabled, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTED_EDGE_DPKEY

public static final Object DIRECTED_EDGE_DPKEY
DataProvider key that is used to mark edges that should be routed in a way that point in the main layout direction. The main layout direction can be set by using method CanonicMultiStageLayouter.setLayoutOrientation(byte) .

Constructor Detail

DirectedOrthogonalLayouter

public DirectedOrthogonalLayouter()
Creates a new instance of this class.

Method Detail

getGrid

public int getGrid()
Returns the currently set grid spacing.


setGrid

public void setGrid(int grid)
Sets the grid spacing to be used. By default a value of 20 is set.


getUseSketchDrawing

public boolean getUseSketchDrawing()
Returns if the existing drawing should be used as sketch.

Returns:
true if the existing drawing is used as sketch false otherwise.

setUseSketchDrawing

public void setUseSketchDrawing(boolean value)
Sets if the existing drawing should be used as sketch.

Parameters:
value - true if the existing drawing should be used as sketch false otherwise.

doLayout

public void doLayout(LayoutGraph graph)
Description copied from class: CanonicMultiStageLayouter
Calculates a layout for the given graph. The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph. This method is not side effect free in the sense that the order of edges or nodes in the input graph may change during the layout process.

Specified by:
doLayout in interface Layouter
Overrides:
doLayout in class CanonicMultiStageLayouter

doLayoutCore

protected void doLayoutCore(LayoutGraph graph)
Description copied from class: CanonicMultiStageLayouter
Subclasses have to provide core layout code in this method.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter

canLayoutCore

protected boolean canLayoutCore(LayoutGraph graph)
Description copied from class: CanonicMultiStageLayouter
Subclasses have to provide information whether or not they can layout the given graph.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
Returns:
true for all graphs.

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