|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTreeDraw.TreeDrawer
public class TreeDrawer
This public class provides a method to draw a tree in a java.awt.Graphics drawing environment. A tree drawer can be parametrized by setting three values:
Field Summary | |
---|---|
private double |
lineSeparation
This parameter determines the separation between tree lines and node labels. |
private double |
minHorizSpace
Minimum horizontal space between nodes, expressed in pixels. |
private double |
vertSpace
Minimum vertical space between nodes, expressed in pixels. |
Constructor Summary | |
---|---|
TreeDrawer()
Default constructor. |
Method Summary | |
---|---|
void |
draw(LabelledTree toDraw,
java.awt.Graphics toDrawIn,
double xposition,
double yposition)
|
private void |
draw(TreeDrawingInstructions tds,
java.awt.Graphics toDrawIn,
double xposition,
double yposition)
Draws a tree using its TreeDrawingInstructions. |
private TreeDrawingInstructions |
generateDrawingInstructions(LabelledTree t,
java.awt.FontMetrics fm)
Generates drawing instructions allowing to draw a tree in an environment with a given FontMetrics. |
double |
getLineSeparation()
|
double |
getMinHorizSpace()
|
double |
getVertSpace()
|
void |
setLineSeparation(double lineSeparation)
Sets the line separation parameter. |
void |
setMinHorizSpace(double minHorizSpace)
Sets the minimum horizontal space between children. |
void |
setVertSpace(double vertSpace)
Sets the vertical spacing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private double minHorizSpace
private double vertSpace
private double lineSeparation
Constructor Detail |
---|
public TreeDrawer()
Method Detail |
---|
public double getLineSeparation()
public void setLineSeparation(double lineSeparation)
public double getMinHorizSpace()
public void setMinHorizSpace(double minHorizSpace)
public double getVertSpace()
public void setVertSpace(double vertSpace)
public void draw(LabelledTree toDraw, java.awt.Graphics toDrawIn, double xposition, double yposition)
private void draw(TreeDrawingInstructions tds, java.awt.Graphics toDrawIn, double xposition, double yposition)
tds
- A TreeDrawingInstructions showing how to draw the tree.toDrawIn
- java.awt.Graphics object to draw in.xposition
- Leftmost X position to draw in.yposition
- Upmost Y position to draw in.private TreeDrawingInstructions generateDrawingInstructions(LabelledTree t, java.awt.FontMetrics fm)
t
- The labelled tree to draw.fm
- FontMetrics gotten from the Graphics object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |