public static class GridWorldVisualizer.CellPainter extends java.lang.Object implements ObjectPainter
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
col |
protected int |
dheight |
protected int |
dwidth |
protected int[][] |
map |
protected int |
shape |
Constructor and Description |
---|
CellPainter(java.awt.Color col,
int[][] map)
Initializes painter for a rectangle shape cell
|
CellPainter(int shape,
java.awt.Color col,
int[][] map)
Initializes painter with filling the cell with the given shape
|
Modifier and Type | Method and Description |
---|---|
void |
paintObject(java.awt.Graphics2D g2,
OOState s,
ObjectInstance ob,
float cWidth,
float cHeight)
Paints object instance ob to graphics context g2
|
protected java.awt.Color col
protected int dwidth
protected int dheight
protected int[][] map
protected int shape
public CellPainter(java.awt.Color col, int[][] map)
col
- the color to paint the cellmap
- the wall map matrix where 1s indicate a wall in that cell and 0s indicate it is clear of wallspublic CellPainter(int shape, java.awt.Color col, int[][] map)
shape
- the shape with which to fill the cell. 0 for a rectangle, 1 for an ellipse.col
- the color to paint the cellmap
- the wall map matrix where 1s indicate a wall in that cell and 0s indicate it is clear of wallspublic void paintObject(java.awt.Graphics2D g2, OOState s, ObjectInstance ob, float cWidth, float cHeight)
ObjectPainter
paintObject
in interface ObjectPainter
g2
- graphics context to which the object should be painteds
- the state of the object to be paintedob
- the instantiated object to be paintedcWidth
- width of the canvas sizecHeight
- height of the canvas size