Search this API

y.layout.orthogonal
Class CompactOrthogonalLayouter

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.PartitionLayouter
          extended by y.layout.orthogonal.CompactOrthogonalLayouter
All Implemented Interfaces:
Layouter, LayoutStage

public class CompactOrthogonalLayouter
extends PartitionLayouter

This class is a variant of OrthogonalLayouter that tries to arrange nodes in a more compact way, even allowing to specify a desired aspect ratio for the bounds of the calculated layout. This is especially important if you want to print the layout on a paper with predefined size. As a disadvantage, this algorithm will usually produce less elegant edge routes than OrthogonalLayouter does.

The algorithm is realized as a PartitionLayouter, that uses PartitionLayouter.EdgeBetweennessPartitionFinder to partition the graph, OrthogonalLayouter to layout the graph partitions, PartitionLayouter.ComponentPartitionPlacer to place the partitions, and finally PartitionLayouter.ChannelInterEdgeRouter to route the edges between partitions. Each of these strategies can be individually configured and/or replaced.

Here is a sample output of the layouter with aspect ratio of the resulting layout bounds set to 1.


Nested Class Summary
 
Nested classes/interfaces inherited from class y.layout.PartitionLayouter
PartitionLayouter.ChannelInterEdgeRouter, PartitionLayouter.ComponentPartitionPlacer, PartitionLayouter.EdgeBetweennessPartitionFinder, PartitionLayouter.InterEdgeRouter, PartitionLayouter.OrthogonalInterEdgeRouter, PartitionLayouter.PartitionFinder, PartitionLayouter.PartitionPlacer
 
Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
CompactOrthogonalLayouter()
          Create a new instance of this class with a default aspect ratio of 1 and a default grid spacing of 20.
 
Method Summary
 double getAspectRatio()
          Returns the desired aspect ratio of the resulting layout bounds.
 int getGridSpacing()
          Returns the grid spacing used to place the nodes.
 void setAspectRatio(double aspectRatio)
          Sets the desired aspect ratio (i.e. the quotient width/height) of the resulting layout bounds.
 void setGridSpacing(int gridSpacing)
          Sets the grid spacing to be used.
 
Methods inherited from class y.layout.PartitionLayouter
canLayout, doLayout, getInterEdgeRouter, getPartitionFinder, getPartitionPlacer, setInterEdgeRouter, setPartitionFinder, setPartitionPlacer
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompactOrthogonalLayouter

public CompactOrthogonalLayouter()
Create a new instance of this class with a default aspect ratio of 1 and a default grid spacing of 20.

Method Detail

getGridSpacing

public int getGridSpacing()
Returns the grid spacing used to place the nodes.


setGridSpacing

public void setGridSpacing(int gridSpacing)
Sets the grid spacing to be used. By default, a value of 20 is set. Setting the grid spacing will only have an effect if the configurable stages have not been replaced by other implementations.
Note: When setting configurable stages after specifying grid spacing, it is assumed that the aforementioned stages are already properly configured and the previously set grid spacing will not be passed to these stages.


getAspectRatio

public double getAspectRatio()
Returns the desired aspect ratio of the resulting layout bounds.


setAspectRatio

public void setAspectRatio(double aspectRatio)
Sets the desired aspect ratio (i.e. the quotient width/height) of the resulting layout bounds. By default a value of 1 is set. This setting will only have an effect if the set PartitionLayouter.PartitionPlacer is of the pre-configured type PartitionLayouter.ComponentPartitionPlacer.
Note: When setting configurable stages after specifying aspect ratio, it is assumed that the aforementioned stages are already properly configured and the previously set aspect ratio will not be passed to these stages.


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