public class StateValuePainter2D extends StateValuePainter
Modifier and Type | Field and Description |
---|---|
protected ColorBlend |
colorBlend
The object to use for returning the color with which to fill the state cell given its value.
|
protected int |
numXCells
Option used for specifying the number of possible states that will be rendered in a row (i.e., across the x-axis).
|
protected int |
numYCells
Option used for specifying the number of possible states that will be rendered in a column (i.e., across the y-axis).
|
protected boolean |
renderValueString
Whether the numeric string for the value of the state should be rendered in its cell or not.
|
protected java.awt.Color |
vsFontColor
The font color of the value strings
|
protected int |
vsFontSize
The font point size of the value string
|
protected float |
vsOffsetFromLeft
A value between 0 and 1 indicating how far from the left of a value cell the value string should start being rendered.
|
protected float |
vsOffsetFromTop
A value between 0 and 1 indicating how from from the top of a value cell the value string should start be rendered.
|
protected int |
vsPrecision
The precision (number of decimals) shown in the value string.
|
protected java.lang.Object |
xKey
variable key for the x variable
|
protected VariableDomain |
xRange
Range of the x key
|
protected double |
xWidth
Width of x cells
|
protected java.lang.Object |
yKey
variable key for the y variable
|
protected VariableDomain |
yRange
Range of the y key
|
protected double |
yWidth
width of y cells
|
shouldRescaleValues
Constructor and Description |
---|
StateValuePainter2D()
Initializes using a
LandmarkColorBlendInterpolation
object that mixes from red (lowest value) to blue (highest value). |
StateValuePainter2D(ColorBlend colorBlend)
Initializes the value painter.
|
Modifier and Type | Method and Description |
---|---|
void |
paintStateValue(java.awt.Graphics2D g2,
State s,
double value,
float cWidth,
float cHeight)
Paints the representation of a value function for a specific state.
|
void |
rescale(double lowerValue,
double upperValue)
Used to tell this painter that it should render state values so that the minimum possible value is lowerValue and the maximum is upperValue.
|
void |
setColorBlend(ColorBlend colorBlend)
Sets the color blending used for the value function.
|
void |
setNumXCells(int numXCells)
Sets the number of states that will be rendered along a row
|
void |
setNumYCells(int numYCells)
Sets the number of states that will be rendered along a row
|
void |
setValueStringRenderingFormat(int fontSize,
java.awt.Color fontColor,
int precision,
float offsetFromLeft,
float offsetFromTop)
Sets the rendering format of the string displaying the value of each state.
|
void |
setXYKeys(java.lang.Object xKey,
java.lang.Object yKey,
VariableDomain xRange,
VariableDomain yRange,
double xWidth,
double yWidth)
Sets the variable keys for the x and y variables in the state and the width of cells along those domains.
|
void |
toggleValueStringRendering(boolean renderValueString)
Enables or disables the rendering the text specifying the value of a state in its cell.
|
useValueRescaling
protected java.lang.Object xKey
protected java.lang.Object yKey
protected VariableDomain xRange
protected VariableDomain yRange
protected double xWidth
protected double yWidth
protected ColorBlend colorBlend
protected int numXCells
protected int numYCells
protected boolean renderValueString
protected int vsFontSize
protected java.awt.Color vsFontColor
protected float vsOffsetFromLeft
protected float vsOffsetFromTop
protected int vsPrecision
public StateValuePainter2D()
LandmarkColorBlendInterpolation
object that mixes from red (lowest value) to blue (highest value).public StateValuePainter2D(ColorBlend colorBlend)
colorBlend
- the object to use for returning the color with which to fill the state cell given its value.public void setColorBlend(ColorBlend colorBlend)
colorBlend
- the color blending used for the value function.public void setXYKeys(java.lang.Object xKey, java.lang.Object yKey, VariableDomain xRange, VariableDomain yRange, double xWidth, double yWidth)
xKey
- the x variable keyyKey
- the y variable keyxRange
- the range of the x valuesyRange
- the range of the y valuesxWidth
- the width of a state along the x domainyWidth
- the width of a state alone the y domainpublic void toggleValueStringRendering(boolean renderValueString)
renderValueString
- if true, then text specifying the value of the state will be rendered; if false then it will not be rendered.public void setValueStringRenderingFormat(int fontSize, java.awt.Color fontColor, int precision, float offsetFromLeft, float offsetFromTop)
fontSize
- the font size of the stringfontColor
- the color of the fontprecision
- the precision of the value text printed (e.g., 2 means displaying 2 decimal places)offsetFromLeft
- the offset from the left side of a state's cell that the text will begin being rendered. 0 means starting on the left boundary, 1 on the right boundary.offsetFromTop
- the offset from the top side of a state's cell that the text will begin being rendered. 0 means starting on the top boundary, 1 on the bottom boundary.public void setNumXCells(int numXCells)
numXCells
- the number of states that will be rendered along a rowpublic void setNumYCells(int numYCells)
numYCells
- the number of states that will be rendered along a columnpublic void rescale(double lowerValue, double upperValue)
StateValuePainter
rescale
in class StateValuePainter
lowerValue
- the minimum value of state valuesupperValue
- the maximium value of state valuespublic void paintStateValue(java.awt.Graphics2D g2, State s, double value, float cWidth, float cHeight)
StateValuePainter
paintStateValue
in class StateValuePainter
g2
- graphics context to which the object should be painteds
- the state of the object to be paintedvalue
- the value function evaluation of state scWidth
- width of the canvas sizecHeight
- height of the canvas size