public class AreaGrid
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
GRID_THRESHOLD
The maximal difference between two lengths that are considered a "being the same"
|
Constructor and Description |
---|
AreaGrid(DefaultArea area) |
Modifier and Type | Method and Description |
---|---|
boolean |
cellEmpty(int x,
int y)
Checks if the cell with the specified coordinates is empty.
|
int |
findCellX(int x)
Finds a grid cell that contains the specified point
|
int |
findCellY(int y)
Finds a grid cell that contains the specified point
|
DefaultArea |
getAreaAt(int x,
int y)
Find an area at the specified position in the grid.
|
Rectangular |
getAreaBoundsAbsolute(int x1,
int y1,
int x2,
int y2)
Computes the absolute coordinates of the specified area in the grid.
|
Rectangular |
getAreaBoundsAbsolute(Rectangular area)
Computes the absolute coordinates of the specified area in the grid.
|
Rectangular |
getCellBoundsAbsolute(int x,
int y)
Computes the absolute coordinates of the specified grid cell.
|
Rectangular |
getCellBoundsRelative(int x,
int y)
Computes the coordinates of the specified grid cell relatively to the area top left corner.
|
int |
getColOfs(int col)
Finds the offset of the specified column from the grid origin.
|
int[] |
getCols() |
int |
getHeight() |
int |
getMaxIndent() |
int |
getMinIndent() |
int |
getRowOfs(int row)
Finds the offset of the specified row from the grid origin.
|
int[] |
getRows() |
int |
getWidth() |
java.lang.String |
toString() |
public static final int GRID_THRESHOLD
public AreaGrid(DefaultArea area)
public int[] getCols()
public int getHeight()
public int[] getRows()
public int getWidth()
public int getMinIndent()
public int getMaxIndent()
public java.lang.String toString()
toString
in class java.lang.Object
public DefaultArea getAreaAt(int x, int y)
x
- the x
coordinate of the grid celly
- the y
coordinate of the grid cellpublic boolean cellEmpty(int x, int y)
x
- the x
coordinate of the grid celly
- the y
coordinate of the grid cellpublic int getColOfs(int col) throws java.lang.ArrayIndexOutOfBoundsException
col
- the column indexjava.lang.ArrayIndexOutOfBoundsException
public int getRowOfs(int row) throws java.lang.ArrayIndexOutOfBoundsException
col
- the row indexjava.lang.ArrayIndexOutOfBoundsException
public Rectangular getCellBoundsRelative(int x, int y)
x
- the column index of the celly
- the row index of the cellpublic Rectangular getCellBoundsAbsolute(int x, int y)
x
- the column index of the celly
- the row index of the cellpublic Rectangular getAreaBoundsAbsolute(int x1, int y1, int x2, int y2)
x1
- the column index of the top left cell of the area.y1
- the row index of the top left cell of the area.x2
- the column index of the bottom right cell of the area.y2
- the row index of the bottom right cell of the area.public Rectangular getAreaBoundsAbsolute(Rectangular area)
The
- area coordinates in the grid.public int findCellX(int x)
x
- the x coordinate of the specified pointpublic int findCellY(int y)
y
- the y coordinate of the specified point