public class GridBoxManager extends BoxManager
Constructor and Description |
---|
GridBoxManager() |
GridBoxManager(int cols) |
GridBoxManager(int cols,
int rows)
Construct a cols * rows array of boxes.
|
Modifier and Type | Method and Description |
---|---|
void |
addBox(Rect box) |
void |
addBox(Rect box,
Dim dim) |
Rect |
firstElement() |
Rect |
getBox(int boxNo) |
int |
getBoxCount() |
java.util.Vector<Rect> |
getBoxes(Dim dimension)
For the given dimension of the entire array of boxes, return a vector of
Rectangles describing the corners of each box, in row-major order.
|
Dim |
getBoxSize(Rect box,
Dim dimension)
For the supplied dimension of the entire array of boxes, return the size
of one (any) box.
|
int |
getCols() |
Rect |
getMidBox() |
Point |
getMidPoint(Dim dimension,
Rect box)
Given supplied dimension of the entire array of boxes, return the
midpoint of the nth box (starting with n = 0).
|
java.util.Vector<Point> |
getMidPoints(Dim dimension)
For the given dimension of the entire array of boxes, return a vector of
Points describing the midpoints of each box, in row-major order.
|
int |
getRows() |
void |
setCols(int cols) |
void |
setRows(int rows) |
addPropertyChangeListener, getBox, getBoxContainingPoint, getBoxes, getBoxesReversed, getOrigin, getScale, isAccentuateMidBox, moveToEnd, propertyChange, removeBox, removePropertyChangeListener, setAccentuateMidBox, setBox, setScale
public GridBoxManager(int cols)
public GridBoxManager(int cols, int rows)
cols
- the number of columns in the box array.rows
- the number of rows in the box array.public GridBoxManager()
public int getBoxCount()
getBoxCount
in class BoxManager
public Rect getMidBox()
getMidBox
in class BoxManager
public int getCols()
public void setCols(int cols)
public int getRows()
public void setRows(int rows)
public Dim getBoxSize(Rect box, Dim dimension)
BoxManager
getBoxSize
in class BoxManager
box
- the 0-based index of the box in the collection.dimension
- the size of the overall array of boxes, in pixelspublic java.util.Vector<Rect> getBoxes(Dim dimension)
BoxManager
getBoxes
in class BoxManager
dimension
- the size of the overall array of boxes, in pixels.public Point getMidPoint(Dim dimension, Rect box)
BoxManager
getMidPoint
in class BoxManager
dimension
- the dimensions of the overall array of boxes.box
- the box to retrieve.public java.util.Vector<Point> getMidPoints(Dim dimension)
BoxManager
getMidPoints
in class BoxManager
dimension
- the dimension of the entire array of boxes, in pixelspublic void addBox(Rect box)
addBox
in class BoxManager
public void addBox(Rect box, Dim dim)
addBox
in class BoxManager
box
- a Rect describing the left, right, top, and bottom of a box.dim
- the dimensions of the grid to which the Rect's coordinates are
relative.public Rect getBox(int boxNo)
getBox
in class BoxManager
public Rect firstElement()
firstElement
in class BoxManager