y.layout.tree
Class ARTreeLayouter

java.lang.Object
  |
  +--y.layout.CanonicMultiStageLayouter
        |
        +--y.layout.tree.ARTreeLayouter
All Implemented Interfaces:
Layouter

public class ARTreeLayouter
extends CanonicMultiStageLayouter

This tree layouter tries to generate compact tree layouts with a certain aspect ratio. The ratio can be specified for each subtree.

Here is a sample layout output (using an aspect ratio of 1 by 2)


Field Summary
protected  LayoutGraph graph
           
static Object PLACEMENT_CORNER
          A data provider value used to specify the placement of the root.
static Object PLACEMENT_CORNER_SIDE
          A data provider value used to specify the placement of the root.
static Object PLACEMENT_CORNER_TOP
          A data provider value used to specify the placement of the root.
static Object PLACEMENT_TOP
          A data provider value used to specify the placement of the root.
static Object RATIO
          The data provider key used to specify target aspect ratio.
static Object ROOT_PLACEMENT
          The data provider key used to specify the placement of each subtree root.
static Object ROUTING_HORIZONTAL
          A data provider value used to specify the routing policy of each subtree.
static Object ROUTING_POLICY
          The data provider key used to specify the routing policy of each subtree root.
static Object ROUTING_VERTICAL
          A data provider value used to specify the routing policy of each subtree.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
ARTreeLayouter()
           
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          The core layouter can layout trees.
protected  void createBends(EdgeLayout el, Node root, Node child, Object rootPlacement, Object routingPolicy)
           
 void doLayoutCore(LayoutGraph graph)
          Core layout routine.
 double getAspectRatio()
          Getter for property aspectRatio.
protected  double getAspectRatio(Node v)
          Returns whether or not the subtree rooted at the given node should be layed out vertically.
 double getBendDistance()
          Getter for property bendDistance.
 double getHorizontalSpace()
          Returns the horizontal distance between adjacent nodes.
 Object getRootPlacement()
          Getter for property rootPlacement.
protected  Object getRootPlacement(Object root)
           
 Object getRoutingPolicy()
          Getter for property routingPolicy.
protected  Object getRoutingPolicy(Object root)
           
 double getVerticalSpace()
          Returns the vertical distance between adjacent nodes.
 void setAspectRatio(double aspectRatio)
          Setter for property aspectRatio.
 void setBendDistance(double bendDistance)
          Setter for property bendDistance.
 void setHorizontalSpace(double hspace)
          Sets the horizontal distance between adjacent nodes.
 void setRootPlacement(Object rootPlacement)
          Setter for property rootPlacement.
 void setRoutingPolicy(Object routingPolicy)
          Setter for property routingPolicy.
 void setVerticalSpace(double vspace)
          Sets the vertical distance between adjacent nodes.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, doLayout, 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

RATIO

public static final Object RATIO
The data provider key used to specify target aspect ratio. Values larger than 1 produce layouts that are wider than high


ROOT_PLACEMENT

public static final Object ROOT_PLACEMENT
The data provider key used to specify the placement of each subtree root.


PLACEMENT_TOP

public static final Object PLACEMENT_TOP
A data provider value used to specify the placement of the root.


PLACEMENT_CORNER

public static final Object PLACEMENT_CORNER
A data provider value used to specify the placement of the root.


PLACEMENT_CORNER_SIDE

public static final Object PLACEMENT_CORNER_SIDE
A data provider value used to specify the placement of the root.


PLACEMENT_CORNER_TOP

public static final Object PLACEMENT_CORNER_TOP
A data provider value used to specify the placement of the root.


ROUTING_POLICY

public static final Object ROUTING_POLICY
The data provider key used to specify the routing policy of each subtree root.


ROUTING_HORIZONTAL

public static final Object ROUTING_HORIZONTAL
A data provider value used to specify the routing policy of each subtree.


ROUTING_VERTICAL

public static final Object ROUTING_VERTICAL
A data provider value used to specify the routing policy of each subtree.


graph

protected LayoutGraph graph
Constructor Detail

ARTreeLayouter

public ARTreeLayouter()
Method Detail

setHorizontalSpace

public void setHorizontalSpace(double hspace)
Sets the horizontal distance between adjacent nodes. By default a value of 10 is set.


getHorizontalSpace

public double getHorizontalSpace()
Returns the horizontal distance between adjacent nodes.

See Also:
ARTreeLayouter.setHorizontalSpace(double)

setVerticalSpace

public void setVerticalSpace(double vspace)
Sets the vertical distance between adjacent nodes. By default a value of 10 is set.


getVerticalSpace

public double getVerticalSpace()
Returns the vertical distance between adjacent nodes.

See Also:
ARTreeLayouter.setVerticalSpace(double)

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Core layout routine.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter

canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
The core layouter can layout trees.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter

getAspectRatio

protected double getAspectRatio(Node v)
Returns whether or not the subtree rooted at the given node should be layed out vertically.


createBends

protected void createBends(EdgeLayout el,
                           Node root,
                           Node child,
                           Object rootPlacement,
                           Object routingPolicy)

getRoutingPolicy

protected Object getRoutingPolicy(Object root)

getRootPlacement

protected Object getRootPlacement(Object root)

getAspectRatio

public double getAspectRatio()
Getter for property aspectRatio.

Returns:
Value of property aspectRatio.

getRootPlacement

public Object getRootPlacement()
Getter for property rootPlacement.

Returns:
Value of property rootPlacement.

setRootPlacement

public void setRootPlacement(Object rootPlacement)
Setter for property rootPlacement.

Parameters:
rootPlacement - New value of property rootPlacement.

getRoutingPolicy

public Object getRoutingPolicy()
Getter for property routingPolicy.

Returns:
Value of property routingPolicy.

setRoutingPolicy

public void setRoutingPolicy(Object routingPolicy)
Setter for property routingPolicy.

Parameters:
routingPolicy - New value of property routingPolicy.

getBendDistance

public double getBendDistance()
Getter for property bendDistance.

Returns:
Value of property bendDistance.

setBendDistance

public void setBendDistance(double bendDistance)
Setter for property bendDistance.

Parameters:
bendDistance - New value of property bendDistance.

setAspectRatio

public void setAspectRatio(double aspectRatio)
Setter for property aspectRatio.

Parameters:
aspectRatio - New value of property aspectRatio.

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

2003