public class GridEditorTools
extends java.lang.Object
Constructor and Description |
---|
GridEditorTools() |
Modifier and Type | Method and Description |
---|---|
static org.eclipse.gef.GraphicalViewer |
createViewer(org.eclipse.swt.widgets.Composite container,
org.eclipse.gef.EditPartFactory factory)
Creates a basic GEF viewer in the specified container and with the
specified EditPartFactory.
|
static java.util.List<org.eclipse.draw2d.geometry.Point> |
getOctant(int size,
int octantIndex)
Given a square grid of a certain size and an octant index, this method
computes a list of (x, y) -> (column, row) values for all positions in
the grid in the octant.
|
static java.util.List<org.eclipse.draw2d.geometry.Point> |
getQuadrant(int size,
int quadrantIndex)
Given a square grid of a certain size and a quadrant index, this method
computes a list of (x, y) -> (column, row) values for all positions in
the grid in the quadrant.
|
static java.util.List<org.eclipse.draw2d.geometry.Point> |
getSextant(int radius,
int sextantIndex,
boolean rotated)
Selects a sextant of a hexagon-based grid.
|
static void |
setViewerContents(org.eclipse.gef.GraphicalViewer viewer,
Grid model)
Updates the GEF viewer's contents based on the model.
|
public static org.eclipse.gef.GraphicalViewer createViewer(org.eclipse.swt.widgets.Composite container, org.eclipse.gef.EditPartFactory factory)
container
- The Composite that will contain the viewer.factory
- The factory used to create the viewer's EditParts.public static void setViewerContents(org.eclipse.gef.GraphicalViewer viewer, Grid model)
viewer
- The GraphicalViewer to update.model
- The model to use for the Graphical Viewer.public static java.util.List<org.eclipse.draw2d.geometry.Point> getOctant(int size, int octantIndex)
size
- The size of the grid (length and width are the same).octantIndex
- The index of the octant. 0 starts in the top-right octant, and
the indices circle counter-clockwise to the last octant in the
bottom right just below the x-axis.public static java.util.List<org.eclipse.draw2d.geometry.Point> getQuadrant(int size, int quadrantIndex)
size
- The size of the grid (length and width are the same).quadrantIndex
- The index of the octant. 0 starts in the top-right quadrant,
and the indices circle counter-clockwise to the last quadrant
in the bottom right just below the x-axis.public static java.util.List<org.eclipse.draw2d.geometry.Point> getSextant(int radius, int sextantIndex, boolean rotated)
radius
- The radius (including the center) of the grid of hexagons.sextantIndex
- The index of the sextant we would like to examine.rotated
- Whether or not the hexagon-based grid is oriented such that
the flat sides of the hexagons are vertical.