Interface MapGrid
- All Known Subinterfaces:
GeometricGrid
- All Known Implementing Classes:
HexGrid
,RegionGrid
,SquareGrid
,ZonedGrid
public interface MapGrid
A MapGrid overlays a map board to constrain
the legal locations of GamePieces
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MapGrid.BadCoords
-
Method Summary
Modifier and Type Method Description void
draw(Graphics g, Rectangle bounds, Rectangle visibleRect, double scale, boolean reversed)
Draw the gridGridNumbering
getGridNumbering()
Point
getLocation(String location)
boolean
isLocationRestricted(Point p)
boolean
isVisible()
Whether this grid should be drawn on the mapString
localizedLocationName(Point p)
String
locationName(Point p)
int
range(Point p1, Point p2)
Point
snapTo(Point p)
-
Method Details
-
snapTo
- Returns:
- the nearest grid location to the given point
-
isLocationRestricted
- Returns:
- true if the given point may not be a local location. I.e., if this grid will attempt to snap it to the nearest grid location
-
locationName
- Returns:
- a string describing the location containing the given point
-
localizedLocationName
-
getLocation
- Returns:
- A point p such that locationName(p).equals(location).
- Throws:
MapGrid.BadCoords
- if the location is not valid or formatted incorrectly.
-
range
- Returns:
- the range between two points, in some unit appropriate to the grid (e.g. hexes or squares)
-
isVisible
boolean isVisible()Whether this grid should be drawn on the map -
draw
Draw the grid- Parameters:
bounds
- the boundaries of the grid (in magnified coordinates)scale
- the magnification factor
-
getGridNumbering
GridNumbering getGridNumbering()
-