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.String |
xAttName
The name of the attribute that is used for determining the x-position on the canvas
|
protected java.lang.String |
xClassName
The name of the class that holds the x-attribute used for determining the x-position on the canvas
|
protected java.lang.String |
xObjectName
The name of the object that holds the x-attribute used for determining the x-position on the canvas
|
protected java.lang.String |
yAttName
The name of the attribute that is used for determining the y-position on the canvas
|
protected java.lang.String |
yClassName
The name of the class that holds the y-attribute used for determining the y-position on the canvas
|
protected java.lang.String |
yObjectName
The name of the object that holds the y-attribute used for determining the y-position on the canvas
|
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 |
setXYAttByObjectClass(java.lang.String xClassName,
java.lang.String xAttName,
java.lang.String yClassName,
java.lang.String yAttName)
Will set the x-y attributes to use for cell rendering to the x y attributes of the first object in the state of the designated classes.
|
void |
setXYAttByObjectReference(java.lang.String xObjectName,
java.lang.String xAttName,
java.lang.String yObjectName,
java.lang.String yAttName)
Will set the x-y attributes to use for cell rendering to the x y attributes of the designated object references.
|
void |
toggleValueStringRendering(boolean renderValueString)
Enables or disables the rendering the text specifying the value of a state in its cell.
|
protected ObjectInstance |
xObjectInstance(State s)
Returns the object instance in a state that holds the x-position information.
|
protected ObjectInstance |
yObjectInstance(State s)
Returns the object instance in a state that holds the y-position information.
|
useValueRescaling
protected java.lang.String xAttName
protected java.lang.String yAttName
protected java.lang.String xClassName
protected java.lang.String yClassName
protected java.lang.String xObjectName
protected java.lang.String yObjectName
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 setXYAttByObjectClass(java.lang.String xClassName, java.lang.String xAttName, java.lang.String yClassName, java.lang.String yAttName)
xClassName
- the object class name containing the render x-axis attributexAttName
- the render x-axis attribute nameyClassName
- the object class name containing the render y-axis attributeyAttName
- the render y-axis attribute namepublic void setXYAttByObjectReference(java.lang.String xObjectName, java.lang.String xAttName, java.lang.String yObjectName, java.lang.String yAttName)
xObjectName
- the object name reference that contains the render x-axis attributexAttName
- the render x-axis attribute nameyObjectName
- the object name reference that contains the render y-axis attributeyAttName
- the render y-axis attribute namepublic 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 sizeprotected ObjectInstance xObjectInstance(State s)
s
- the state for which to get the x-positionprotected ObjectInstance yObjectInstance(State s)
s
- the state for which to get the y-position