public class Grid extends Object implements Serializable
This matrix is used to layout the vertices of a graph, where each VisualVertex is assigned to a grid point and one grid point can have only one VisualVertex.
In reality, the matrix will probably non-proportional. That is, certain columns will have different height than the other columns. This usually happens when appending Grids.
| Constructor and Description |
|---|
Grid(List visualVertices)
Creates a Grid object to be used by the vertices.
|
Grid(List visualVertices,
int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendToBottom(Grid gridtoappend)
Appends the specified grid to this grid.
|
void |
appendToRight(Grid gridtoappend)
Appends the specified grid to this grid.
|
Point |
findVisualVertex(VisualVertex v)
Returns the grid point assignment of a VisualVertex.
|
VisualVertex |
getGridPoint(int x,
int y)
Returns the VisualVertex object assigned to the specified grid point.
|
int |
getGridSize()
Return the size of the internal grid
|
int |
getHeight()
Returns the number of y grid lines.
|
int |
getStartingXGridPoint() |
int |
getStartingYGridPoint() |
int |
getWidth()
Returns the number of x grid lines.
|
protected void |
initGrid()
Initializes the grid to be of size m x m, where m is the
number of vertices in the graph.
|
protected void |
initGrid(int width,
int height) |
void |
insertEmptyGrid(int insertBeforeIndex)
Inserts an empty grid before the specified index
|
void |
setGridPoint(int x,
int y,
VisualVertex vvertex)
Assigns a VisualVertex object of the graph to the specified position in the grid.
|
String |
toString()
Returns a String representation of the Grid object.
|
public Grid(List visualVertices)
visualvertices - List of VisualVertexs that will be laid out on the grid.public Grid(List visualVertices, int width, int height)
protected void initGrid(int width,
int height)
protected void initGrid()
public int getGridSize()
public int getStartingXGridPoint()
public int getStartingYGridPoint()
public int getWidth()
public int getHeight()
public void setGridPoint(int x,
int y,
VisualVertex vvertex)
x - The vertical grid line, starting at 0, of the grid point.y - The horizontal grid line, starting at 0, of the grid point.vvertex - The VisualVertex object to be assigned to the specified grid point.public VisualVertex getGridPoint(int x, int y)
x - The vertical grid line, starting at 0, of the grid point.y - The horizontal grid line, starting at 0, of the grid point.public Point findVisualVertex(VisualVertex v)
vvertex - The VisualVertex object of which we want to find
the grid point assignment.public void appendToRight(Grid gridtoappend)
gridtoappend - Grid object that is to be appended to this Grid object.public void appendToBottom(Grid gridtoappend)
gridtoappend - Grid object that is to be appended to this Grid object.public void insertEmptyGrid(int insertBeforeIndex)
Copyright © 2019 JULIE Lab, Germany. All rights reserved.