|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jimmc.treepar.Layout
Layout is the root object containing all of the data used to do a place and route with the treepar package.
There are three phases of use for Layout, which must be done in order:
Layout uses a channel-based algorithm. The layout is optimized for looks (as opposed to density, as is typical in a CAD application), and is intended for simple tree-structured data, as is commonly found in a family tree. It will handle arbitrary network-stuctured data, but may not make a very nice looking plot. It will insert feedthroughs when necessary, but is not particularly intelligent about where in a row a feedthrough should go.
The algorithm uses the following additional object types:
Layout can work with either horizontal rows or vertical rows. In many places, the algorithm is simplified by being able to ignore this selection. In order to reduce confusion, terms such as width, height, x, and y are avoided. Instead, a different set of terms are used.
For the dimensions of a row, thickness and length are used instead of width and height. The long dimension of the row (in the typical case) is called the length, and the short dimension is called the thickness. Thus if the rows are oriented horizontally, the thickness of a row is its height, and the length of the row is its width; whereas if the rows are oriented vertically, then the thickness is the width, and the length is the height. By using thickness and length rather than width and height the algorithm can in most places ignore the actual orientation of the rows.
For point coordinates, r and s are used instead of x any y. The r coordinate is the position of the point along the length of the rows, whereas the s coordinate is the position of the point along the thickness of the rows. Thus if the rows are oriented horizontally, then r=x and s=y; whereas if the rows are oriented vertically, then r=y and s=x.
For directions, the terms Rmore, Rless, Smore, and Sless are used, referring to the directions of greater or lesser values of the r and s coordinates. If the rows are oriented horizontally, then Rmore=east, Rless=west, Smore=north, and Sless=south; whereas if the rows are oriented vertically, then Rmore=north, Rless=south, Smore=east, and Sless=west.
Each row is assigned a row number. The channels between rows also have row numbers. All rows have even row numbers, whereas all channels have odd row numbers.
The (x,y) coordinate system has it's origin in the lower left, as with standard mathematical coordinates.
Field Summary | |
protected BoundsRectangle |
bounds
Our bounds, in which all drawable items lie. |
protected Box[] |
boxes
The set of Box objects used during the layout process. |
protected java.util.Vector |
boxVector
The set of Box objects added during the setup phase. |
protected int |
characterWidth
The width of one character. |
protected Connector[] |
connectors
The set of Connector objects used during the layout process. |
static int |
EAST
Constant for connector edges. |
protected int |
interBoxSpace
The default spacing between boxes (R dimension) |
protected int |
interRowSpace
The spacing between rows (S dimension). |
static int |
LEFT
Constant for routing angle. |
protected int |
lineHeight
The height of a character (actually, spacing between baselines). |
protected int |
maxRowLength
The maximum length of a row. |
protected Net[] |
nets
The set of Net objects used during the layout process. |
protected java.util.Dictionary |
netsDict
The set of Net objects, while collecting nets. |
protected int |
NorE
NORTH if horizontal rows; EAST if vertical rows (Smore). |
static int |
NORTH
Constant for connector edges. |
static int |
RIGHT
Constant for routing angle. |
protected Box |
rootBox
The root box to use for the place algorithm. |
protected Row[] |
rows
The set of Row objects in the layout. |
protected int |
SorW
SOUTH if horizontal rows; WEST if vertical rows (Sless). |
static int |
SOUTH
Constant for connector edges. |
static int |
STEP_ALL
Constant referring to all steps. |
static int |
STEP_BOUNDS
Constant referring to the step where bounding rectangle is calculated. |
static int |
STEP_FEEDTHROUGHS
Constant referring to the step where feedthroughs are created. |
static int |
STEP_ROUTE
Constant referring to the step where routing is done. |
static int |
STEP_ROW_NUMBERS
Constant referring to the step where row numbers are assigned. |
static int |
STEP_ROW_ORDER
Constant referring to the step where boxes within rows are ordered. |
static int |
STEP_ROW_POSITION
Constant referring to the step where row positions are calculated. |
static int |
STEP_ROW_SPACE
Constant referring to the step where row thicknesses are calculated. |
static int |
STEP_ROWS
Constant referring to the step where rows are allocated. |
static int |
STEP_SETUP_DONE
Constant referring to the first step in the place-and-route process: collecting the application-specified data into a form which is easier to process. |
protected int |
trackSpace
The amount of space between tracks in a routing channel. |
protected boolean |
useGreedyRoute
True to use a greedy routing algorithm for track assignment. |
protected boolean |
verticalRows
True if rows are vertical; false if horizontal. |
static int |
WEST
Constant for connector edges. |
Constructor Summary | |
Layout(boolean verticalRows)
Create an empty Layout. |
Method Summary | |
protected void |
addBox(Box box)
Add a box to the list of boxes in the layout. |
void |
createRows()
Figure out how many rows we need, create them, and add the boxes and nets to their rows. |
void |
dump(java.io.PrintWriter f)
For debugging, dump the layout. |
protected void |
dumpBoxes(java.io.PrintWriter f)
Dump the boxes. |
protected void |
dumpConnectors(java.io.PrintWriter f)
Dump the connectors. |
protected void |
dumpNets(java.io.PrintWriter f)
Dump the nets. |
protected void |
dumpRows(java.io.PrintWriter f)
Dump the rows. |
void |
feed()
Create feedthroughs. |
protected Box |
findBox(java.lang.String boxName)
Find a box by name. |
protected Net |
findNet(java.lang.String name)
Find a net by name. |
protected Net |
findOrCreateNet(java.lang.String name)
Find a net by name. |
BoundsRectangle |
getBounds()
Get the bounds of the layout. |
int |
getCharacterWidth()
Get the character width. |
LayoutHitText |
getHitText(int x,
int y)
Get the text line around the specified point. |
int |
getLineHeight()
Get the lineHeight. |
void |
paint(LayoutGraphics g)
Draw the layout. |
void |
placeAndRoute()
Do the complete place and route. |
void |
placeAndRoute(int step)
Do a partial place-and-route, finishing the step specified. |
void |
reFeed()
Redo feedthrougs. |
void |
route()
Do the channel route. |
void |
rowOrder(Box box)
Calculate the ordering of the boxes within the rows. |
void |
rowPosition()
Calculate the R position of each row. |
void |
rowSpace()
Calculate the thickness and S coordinate of each row. |
protected void |
setBounds()
Calculate the bounding rectangle for all paintable items in the layout. |
void |
setCharacterWidth(int characterWidth)
Set the character width. |
void |
setLineHeight(int lineHeight)
Set the lineHeight. |
void |
setRowNumbers(Box box)
Go through all of the boxes and determine which row each box goes into. |
void |
setRowOrientation(boolean vertical)
Set the orientation of the rows. |
void |
setupDone()
After all calls to addBox, call this method to indicate that the setup phase is complete. |
void |
unFeed()
Undo feedthroughs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NORTH
public static final int SOUTH
public static final int EAST
public static final int WEST
public static final int LEFT
public static final int RIGHT
public static final int STEP_SETUP_DONE
The order of the steps is:
public static final int STEP_ROW_NUMBERS
public static final int STEP_FEEDTHROUGHS
public static final int STEP_ROWS
public static final int STEP_ROW_SPACE
public static final int STEP_ROW_ORDER
public static final int STEP_ROW_POSITION
public static final int STEP_ROUTE
public static final int STEP_BOUNDS
public static final int STEP_ALL
protected java.util.Vector boxVector
protected boolean verticalRows
protected Box rootBox
protected boolean useGreedyRoute
protected int lineHeight
protected int characterWidth
protected int interRowSpace
protected int interBoxSpace
protected int trackSpace
protected int NorE
protected int SorW
protected Box[] boxes
protected java.util.Dictionary netsDict
protected Net[] nets
protected Connector[] connectors
protected Row[] rows
protected int maxRowLength
protected BoundsRectangle bounds
Constructor Detail |
public Layout(boolean verticalRows)
Method Detail |
public void setRowOrientation(boolean vertical)
vertical
- true if the typically long dimension of the rows
are vertical; false if horizontal.public void setLineHeight(int lineHeight)
public int getLineHeight()
public void setCharacterWidth(int characterWidth)
public int getCharacterWidth()
protected void addBox(Box box)
public void setupDone()
protected Net findOrCreateNet(java.lang.String name)
protected Net findNet(java.lang.String name)
public void placeAndRoute()
box
- the box to be used as the root of the layout process.
May be null.public void placeAndRoute(int step)
box
- The root box for the route; may be null.step
- The last
step to execute.
Useful for debugging.protected Box findBox(java.lang.String boxName)
boxName
- the name of the box.public void setRowNumbers(Box box)
box
- the root of the row select process.
This only matters if the network is not a simple tree.public void reFeed()
public void unFeed()
public void feed()
public void createRows()
public void rowSpace()
public void rowOrder(Box box)
box
- the initial box for the calculation.
This only matters if the network is not a simple tree.public void rowPosition()
public void route()
protected void setBounds()
public BoundsRectangle getBounds()
public LayoutHitText getHitText(int x, int y)
public void paint(LayoutGraphics g)
public void dump(java.io.PrintWriter f)
protected void dumpBoxes(java.io.PrintWriter f)
protected void dumpConnectors(java.io.PrintWriter f)
protected void dumpNets(java.io.PrintWriter f)
protected void dumpRows(java.io.PrintWriter f)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |