TreeMap Java Library

treemap
Class TMAlgorithm

java.lang.Object
  extended by java.util.Observable
      extended by treemap.TMAlgorithm
Direct Known Subclasses:
TMAlgorithmClassic, TMAlgorithmSquarified

public abstract class TMAlgorithm
extends java.util.Observable

The TMAlgorithm abstract class represent the algorithm of the TreeMap. It should be subclassed by every class that want to implement a particular treemap (classic treemap, squarified treemap, ...).

A subclass can also override the drawNode() method to have a customized drawing of a node.

And now with cushion treemap, thanks to Jarke J. van Wijk :-)

Version:
2.5
Author:
Christophe Bouthier [bouthier@loria.fr], Vesselin Markovsky [markovsky@semantec.bg]

Field Summary
protected  boolean border
           
protected  int borderLimit
           
protected  int borderSize
           
protected  boolean cushion
           
protected  double f
           
protected  double h
           
protected static short HORIZONTAL
           
protected  int IS
           
protected  double LX
           
protected  double LY
           
protected  double LZ
           
protected  boolean nodesTitles
           
protected  treemap.TMNodeModel root
           
protected static short VERTICAL
           
protected  TMView view
           
 
Constructor Summary
TMAlgorithm()
           
 
Method Summary
protected  treemap.TMCushionData computeCushionData(treemap.TMNodeModel father, java.awt.Rectangle area, short axis)
          Compute node's cushion data.
 void dontDrawNodesTitles()
          Don't draws the nodes titles.
protected abstract  void drawChildren(java.awt.Graphics2D g, treemap.TMNodeModelComposite node, short axis, int level)
          Draws the children of a node, by setting their drawing area first, dependant of the algorithm used.
protected  void drawNodes(java.awt.Graphics2D g, treemap.TMNodeModel node, short axis, int level)
          Draws the node and recurses the drawing on its children.
 void drawNodesTitles()
          Draws the nodes titles.
protected  void fillCushionNode(java.awt.Graphics2D g, treemap.TMNodeModel node, int level, treemap.TMCushionData data)
           
protected  void fillNode(java.awt.Graphics2D g, treemap.TMNodeModel node, int level)
          Fills the node.
 int getBorderSize()
          Returns the border size.
 javax.swing.JPanel getConfiguringView()
          Returns a view for configuring this algorithm.
 void initialize(treemap.TMNodeModel root, TMView view)
          Initialize the algorithm.
 boolean isDrawingTitles()
           
 void setBorderSize(int size)
          Sets the border size.
protected  short switchAxis(short axis)
          Switch the axis and return the new axis.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

h

protected double h

f

protected double f

cushion

protected boolean cushion

border

protected boolean border

IS

protected int IS

LX

protected final double LX
See Also:
Constant Field Values

LY

protected final double LY
See Also:
Constant Field Values

LZ

protected final double LZ
See Also:
Constant Field Values

HORIZONTAL

protected static final short HORIZONTAL
See Also:
Constant Field Values

VERTICAL

protected static final short VERTICAL
See Also:
Constant Field Values

root

protected treemap.TMNodeModel root

view

protected TMView view

borderSize

protected int borderSize

borderLimit

protected int borderLimit

nodesTitles

protected boolean nodesTitles
Constructor Detail

TMAlgorithm

public TMAlgorithm()
Method Detail

initialize

public void initialize(treemap.TMNodeModel root,
                       TMView view)
Initialize the algorithm.

Parameters:
root - the root of the TMNodeModel tree
view - the view using this algorithm

drawNodesTitles

public void drawNodesTitles()
Draws the nodes titles.


dontDrawNodesTitles

public void dontDrawNodesTitles()
Don't draws the nodes titles.


isDrawingTitles

public boolean isDrawingTitles()

setBorderSize

public void setBorderSize(int size)
Sets the border size.

Parameters:
size - the border size

getBorderSize

public int getBorderSize()
Returns the border size.

Returns:
the border size

getConfiguringView

public javax.swing.JPanel getConfiguringView()
Returns a view for configuring this algorithm.

Returns:
the configuring view

drawNodes

protected void drawNodes(java.awt.Graphics2D g,
                         treemap.TMNodeModel node,
                         short axis,
                         int level)
Draws the node and recurses the drawing on its children.

Parameters:
g - the graphic context
node - the node to draw
axis - the axis of separation
level - the level of deep

switchAxis

protected short switchAxis(short axis)
Switch the axis and return the new axis.

Parameters:
axis - the axis to switch
Returns:
the new axis

computeCushionData

protected treemap.TMCushionData computeCushionData(treemap.TMNodeModel father,
                                                   java.awt.Rectangle area,
                                                   short axis)
Compute node's cushion data.


fillCushionNode

protected void fillCushionNode(java.awt.Graphics2D g,
                               treemap.TMNodeModel node,
                               int level,
                               treemap.TMCushionData data)

fillNode

protected void fillNode(java.awt.Graphics2D g,
                        treemap.TMNodeModel node,
                        int level)
Fills the node.

Parameters:
g - the graphic context
node - the TMNodeModel to draw
level - the level of deep

drawChildren

protected abstract void drawChildren(java.awt.Graphics2D g,
                                     treemap.TMNodeModelComposite node,
                                     short axis,
                                     int level)
Draws the children of a node, by setting their drawing area first, dependant of the algorithm used.

Parameters:
g - the graphic context
node - the node whose children should be drawn
axis - the axis of separation
level - the level of deep

TreeMap Java Library

TreeMap Java Library - www.bouthier.net - treemap.sf.net - 2001