VASSAL.build.module.map.boardPicker.board
Interface MapGrid

All Known Implementing Classes:
RegionGrid, SquareGrid, HexGrid

public interface MapGrid

A MapGrid overlays a map board to constrain the legal locations of GamePieces


Inner Class Summary
static class MapGrid.BadCoords
           
 
Method Summary
 void draw(java.awt.Graphics g, java.awt.Rectangle bounds, java.awt.Rectangle visibleRect, double scale, boolean reversed)
          Draw the grid
 GridNumbering getGridNumbering()
           
 java.awt.Point getLocation(java.lang.String location)
           
 boolean isVisible()
          Whether this grid should be drawn on the map
 java.lang.String locationName(java.awt.Point p)
           
 int range(java.awt.Point p1, java.awt.Point p2)
           
 java.awt.Point snapTo(java.awt.Point p)
           
 

Method Detail

snapTo

public java.awt.Point snapTo(java.awt.Point p)
Returns:
the nearest grid location to the given point

locationName

public java.lang.String locationName(java.awt.Point p)
Returns:
a string describing the location containing the given point

getLocation

public java.awt.Point getLocation(java.lang.String location)
                           throws MapGrid.BadCoords
Returns:
A point p such that locationName(p).equals(location)

range

public int range(java.awt.Point p1,
                 java.awt.Point p2)
Returns:
the range between two points, in some unit appropriate to the grid (e.g. hexes or squares)

isVisible

public boolean isVisible()
Whether this grid should be drawn on the map

draw

public void draw(java.awt.Graphics g,
                 java.awt.Rectangle bounds,
                 java.awt.Rectangle visibleRect,
                 double scale,
                 boolean reversed)
Draw the grid
Parameters:
bounds - the boundaries of the grid (in magnified coordinates)
scale - the magnification factor

getGridNumbering

public GridNumbering getGridNumbering()