20 package net.sf.gridarta.model.mapgrid;
22 import java.awt.Point;
24 import org.junit.Assert;
25 import org.junit.Test;
87 final StringBuilder sb =
new StringBuilder();
89 for (
int y = 0; y < size.
getHeight(); y++) {
90 for (
int x = 0; x < size.
getWidth(); x++) {
91 final int flags = mapGrid.
getFlags(x, y);
105 sb.append(Integer.toHexString(value));
108 Assert.assertEquals(expectedBorder, sb.toString());
void resize(@NotNull final Size2D newSize)
Resizes the MapGrid.
static final int GRID_FLAG_SELECTION_NORTH
Selection - is set for squares at the north edge of the selected area.
void selectArea(@NotNull final Point pos1, @NotNull final Point pos2, @NotNull final SelectionMode selectionMode)
Selects or deselects all squares in an area.
int getFlags(final int x, final int y)
Returns the flags of a square.
Size2D getSize()
Returns size of grid.
Base package of all Gridarta classes.
static final int GRID_FLAG_SELECTION_EAST
Selection - is set for squares at the east edge of the selected area.
int getWidth()
Returns the width of the area.
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
FLIP
All squares that are preselected change state of selection.
static final int GRID_FLAG_SELECTION_SOUTH
Selection - is set for squares at the south edge of the selected area.
void select(@NotNull final Point pos, @NotNull final SelectionMode selectionMode)
Selects or deselects a single square.
ADD
All squares that are preselected get selected.
static void checkSelectionBorder(final MapGrid mapGrid, final String expectedBorder)
Checks that the map border selection flags of a MapGrid instance is as expected.
static final int GRID_FLAG_SELECTION_WEST
Selection - is set for squares at the west edge of the selected area.
Modes that describe how squares get selected.
void testSelectionBorderUpdates()
Test case for selection border updates.
SUB
All squares that are preselected get unselected.
int getHeight()
Returns the height of the area.
The class Size2D represents a 2d rectangular area.