Search this API

y.layout.orthogonal
Class OrthogonalGroupLayouter

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

public class OrthogonalGroupLayouter
extends CanonicMultiStageLayouter

This class provides a layout algorithm which produces orthogonal drawings of hierarchically grouped graphs.

Here is a sample output of the layouter.


Field Summary
static Object EDGE_LAYOUT_DESCRIPTOR_DPKEY
          DataProvider key used to retrieve EdgeLayoutDescriptor instances for each edge in the graph.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
OrthogonalGroupLayouter()
          Creates a new instance of OrthogonalGroupLayouter
 
Method Summary
protected  boolean canLayoutCore(LayoutGraph graph)
          Subclasses have to provide information whether or not they can layout the given graph.
protected  EdgeLayoutDescriptor createEdgeLayoutDescriptor()
          Factory method that creates the default EdgeLayoutDescriptor.
 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.
 EdgeLayoutDescriptor getEdgeLayoutDescriptor()
          Returns the EdgeLayoutDescriptor instance used for all those edges, that do not have a specific layout descriptor assigned.
 int getGrid()
          Returns the grid distance.
 double getLayoutQuality()
          Returns the currently set layout quality.
 boolean isConsiderNodeLabelsEnabled()
          Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).
 boolean isIntegratedEdgeLabelingEnabled()
          Returns whether integrated edge labeling is enabled.
 boolean isPostprocessingEnabled()
          Determines if an additional postprocessing step is used that improves compactness and reduces the number of edge bends.
 void setComponentLayouter(LayoutStage layouter)
          Note that the component layouter set here should work in such a way that isolated components inside groups should be reported separately.
 void setConsiderNodeLabelsEnabled(boolean enabled)
          Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps).
 void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
          Sets the EdgeLayoutDescriptor instance used for all those edges, that do not have a specific layout descriptor assigned.
 void setGrid(int grid)
          Sets the grid distance.
 void setIntegratedEdgeLabelingEnabled(boolean enabled)
          Specifies whether or not to use integrated edge labeling.
 void setLayoutQuality(double q)
          Sets the desired layout quality.
 void setPostprocessingEnabled(boolean enable)
          Specifies if an additional postprocessing step is used that improves compactness and reduces the number of edge bends.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, 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

EDGE_LAYOUT_DESCRIPTOR_DPKEY

public static final Object EDGE_LAYOUT_DESCRIPTOR_DPKEY
DataProvider key used to retrieve EdgeLayoutDescriptor instances for each edge in the graph. Different settings will affect the routing of the edges during the layout.

Constructor Detail

OrthogonalGroupLayouter

public OrthogonalGroupLayouter()
Creates a new instance of OrthogonalGroupLayouter

Method Detail

isPostprocessingEnabled

public boolean isPostprocessingEnabled()
Determines if an additional postprocessing step is used that improves compactness and reduces the number of edge bends.

Returns:
true if the postprocessing step is applied and false otherwise.

setPostprocessingEnabled

public void setPostprocessingEnabled(boolean enable)
Specifies if an additional postprocessing step is used that improves compactness and reduces the number of edge bends. The postprocessing is enabled by default.

Parameters:
enable - true if the postprocessing step should be applied.

createEdgeLayoutDescriptor

protected EdgeLayoutDescriptor createEdgeLayoutDescriptor()
Factory method that creates the default EdgeLayoutDescriptor. May not return null!

Returns:
a new EdgeLayoutDescriptor (new EdgeLayoutDescriptor())

getEdgeLayoutDescriptor

public EdgeLayoutDescriptor getEdgeLayoutDescriptor()
Returns the EdgeLayoutDescriptor instance used for all those edges, that do not have a specific layout descriptor assigned.

Returns:
the current instance
See Also:
OrthogonalLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY, createEdgeLayoutDescriptor()

setEdgeLayoutDescriptor

public void setEdgeLayoutDescriptor(EdgeLayoutDescriptor edgeLayoutDescriptor)
Sets the EdgeLayoutDescriptor instance used for all those edges, that do not have a specific layout descriptor assigned.

Throws:
NullPointerException - if the argument is null
Parameters:
edgeLayoutDescriptor - the new descriptor
See Also:
OrthogonalLayouter.EDGE_LAYOUT_DESCRIPTOR_DPKEY

setConsiderNodeLabelsEnabled

public void setConsiderNodeLabelsEnabled(boolean enabled)
Specifies whether or not to consider node labels when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). This method is a convenience method that assures that the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.setTranslateNodeLabelsEnabled(boolean) is set to true. Note that setting this option may overwrite the currently set label layouter. Hence, to combine this option with a generic edge labeling algorithm, the generic labeling has to be applied in an additional step after calculating the layout.

Parameters:
enabled - whether to enable this feature

isConsiderNodeLabelsEnabled

public boolean isConsiderNodeLabelsEnabled()
Returns whether or not node labels are taken into account when calculating node positions (thereby preventing possible node/node label or node label/node label overlaps). This method is a convenience method checks whether the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.isTranslateNodeLabelsEnabled() returns true.
The default is false.

Throws:
IllegalStateException - if the current label layouter is not of type LabelLayoutTranslator.
Returns:
whether this feature is enabled.

setIntegratedEdgeLabelingEnabled

public void setIntegratedEdgeLabelingEnabled(boolean enabled)
Specifies whether or not to use integrated edge labeling. This method is a convenience method that assures that the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.setTranslateEdgeLabelsEnabled(boolean) is set to true

Parameters:
enabled - whether to enable this feature

isIntegratedEdgeLabelingEnabled

public boolean isIntegratedEdgeLabelingEnabled()
Returns whether integrated edge labeling is enabled. This method is a convenience method that checks if the label layouter is of type LabelLayoutTranslator and LabelLayoutTranslator.isTranslateEdgeLabelsEnabled() returns true.
The default is false.

Throws:
IllegalStateException - if the current label layouter is not of type LabelLayoutTranslator.
Returns:
whether this feature is enabled.

setLayoutQuality

public void setLayoutQuality(double q)
Sets the desired layout quality. Higher quality means less connection crossings and smaller layout area, but also increased computation time.

By default best layout quality (value 1) is set.

Parameters:
q - a value between 0 and 1.

getLayoutQuality

public double getLayoutQuality()
Returns the currently set layout quality.


setGrid

public void setGrid(int grid)
Sets the grid distance.


setComponentLayouter

public void setComponentLayouter(LayoutStage layouter)
Note that the component layouter set here should work in such a way that isolated components inside groups should be reported separately. E.g. instances of IsolatedGroupComponentLayouter can be set here. If the component layouter should be customized, the suggested way of doing this is to CanonicMultiStageLayouter.getComponentLayouter() and cast it to ComponentLayouter.

Overrides:
setComponentLayouter in class CanonicMultiStageLayouter
Parameters:
layouter - the new component layouter, which needs to report isolated groups separately. E.g. IsolatedGroupComponentLayouter

getGrid

public int getGrid()
Returns the grid distance.


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

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

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

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