public final class DiscretizedMap
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean[][] |
discretizedMap
A discrete version of the
Map . |
private static DiscretizedMap |
instance
Singleton object.
|
private static Map |
instanceMap
The corresponding map.
|
Modifier | Constructor and Description |
---|---|
|
DiscretizedMap(boolean[][] discretizedMap)
This constructor can be used if you have a boolean representation of the
map already.
|
private |
DiscretizedMap(Map map,
double precision)
Private method to prevent object creation.
|
Modifier and Type | Method and Description |
---|---|
private boolean[][] |
discretizeMap(Map map,
double precision)
Gets a discrete version of the
Map in a specified precision. |
static DiscretizedMap |
getInstance(Map map,
double precision)
Gets the singleton instance of the map.
|
boolean[][] |
getMap()
Gets the map.
|
private PolygonMapComponent |
getShape(Position position,
double radius)
Gets the shape of a tile based on the position and radius.
|
void |
printMap()
Prints the discrete
Map . |
private static DiscretizedMap instance
private static Map instanceMap
private boolean[][] discretizedMap
Map
.public DiscretizedMap(boolean[][] discretizedMap)
printMap()
function after generating the map using the standard
getInstance(Map, double)
method.discretizedMap
- The boolean representation of the map.private DiscretizedMap(Map map, double precision)
precision
- The precision.map
- The map.public static DiscretizedMap getInstance(Map map, double precision)
map
- The map.precision
- The precision.private boolean[][] discretizeMap(Map map, double precision)
Map
in a specified precision.map
- The map.precision
- The precision.public boolean[][] getMap()
private PolygonMapComponent getShape(Position position, double radius)
position
- The position.radius
- The radius.public void printMap()
Map
.