infovis.tree.visualization.treemap
Class Treemap

java.lang.Object
  extended by infovis.tree.visualization.treemap.Treemap
All Implemented Interfaces:
Layout
Direct Known Subclasses:
SliceAndDice, Squarified

public abstract class Treemap
extends Object
implements Layout

Base class for all Treemap algorithms.

Version:
$Revision: 1.23 $
Author:
Jean-Daniel Fekete

Constructor Summary
Treemap()
           
 
Method Summary
 boolean beginBox(Rectangle2D.Float box)
          Checks whether the specified box should be drawn and initialize the node's Shape to its final bounds.
 GeneralPath borderShape(float xmin, float ymin, float xmax, float ymax, int node)
          Computes the shape of the border.
abstract  void computeShapes(Rectangle2D bounds, TreemapVisualization vis)
          Computes the shapes of the treemap.
 void computeShapes(Rectangle2D bounds, Visualization vis)
          Computes the layout.
 void finish()
          Method start should be called before starting to draw shapes.
 Dimension getPreferredSize(Visualization vis)
          Computes and return the preferred size for this layout and this visualization.
 void invalidate(Visualization vis)
          Invalidate the cached state of the layout.
 void removeBorder(Rectangle2D.Float box, int node)
          Method removeBorder only removes the border from the given box.
 void start()
          Method start should be called before starting to draw shapes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface infovis.visualization.Layout
getName
 

Constructor Detail

Treemap

public Treemap()
Method Detail

start

public void start()
Method start should be called before starting to draw shapes.


finish

public void finish()
Method start should be called before starting to draw shapes.


beginBox

public boolean beginBox(Rectangle2D.Float box)
Checks whether the specified box should be drawn and initialize the node's Shape to its final bounds.

Parameters:
box - the bounding box
Returns:
true if the treemap algorithm should continue to go deeper, false otherwise.

removeBorder

public void removeBorder(Rectangle2D.Float box,
                         int node)
Method removeBorder only removes the border from the given box.

Parameters:
box - the rectangle containing the box whose border should be drawn. It is modified by the method and will hold the remaining part of the box after the border is drawn.
node - the tree node to draw.

borderShape

public GeneralPath borderShape(float xmin,
                               float ymin,
                               float xmax,
                               float ymax,
                               int node)
Computes the shape of the border.

Parameters:
xmin - left coord
ymin - upper coord
xmax - right coord
ymax - lower coord
node - the node
Returns:
a shape for the border

computeShapes

public void computeShapes(Rectangle2D bounds,
                          Visualization vis)
Computes the layout.

Specified by:
computeShapes in interface Layout
Parameters:
bounds - the allocated bounds of the visualization.
vis - the visualization.

invalidate

public void invalidate(Visualization vis)
Invalidate the cached state of the layout.

Call this method from the visualization when it gets invalidated.

Specified by:
invalidate in interface Layout
Parameters:
vis - the visualization.

getPreferredSize

public Dimension getPreferredSize(Visualization vis)
Computes and return the preferred size for this layout and this visualization.

Specified by:
getPreferredSize in interface Layout
Parameters:
vis - the visualization
Returns:
the preferred size for this layout and this visualization.

computeShapes

public abstract void computeShapes(Rectangle2D bounds,
                                   TreemapVisualization vis)
Computes the shapes of the treemap.

Parameters:
vis - the TreemapVisualization
bounds - the external bounds of the treemap.


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.