public class PolicyGlyphPainter2D extends java.lang.Object implements StatePolicyPainter
Modifier and Type | Class and Description |
---|---|
static class |
PolicyGlyphPainter2D.PolicyGlyphRenderStyle
MAXACTION paints only glphys for only those actions that have the highest likelihood
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,ActionGlyphPainter> |
actionNameToGlyphPainter
The map from action names to glyphs that will be used to represent them.
|
protected PolicyGlyphPainter2D.PolicyGlyphRenderStyle |
renderStyle
The render style to use
|
protected double |
softTieDelta
The max probability difference from the most likely action for which an action that is not the most likely will still be rendered under the
MAXACTIONSOFTTIE rendering style.
|
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
|
Constructor and Description |
---|
PolicyGlyphPainter2D() |
Modifier and Type | Method and Description |
---|---|
PolicyGlyphPainter2D.PolicyGlyphRenderStyle |
getRenderStyle()
Returns the rendering style
|
double |
getSoftTieRenderStyleDelta()
Returns the soft difference between max actions to determine ties when the MAXACTIONSOFSOFTTIE render style is used.
|
void |
paintStatePolicy(java.awt.Graphics2D g2,
State s,
Policy policy,
float cWidth,
float cHeight)
Paints a representation of the given policy for a specific state to a 2D graphics context.
|
protected float[] |
rescaleRect(float x,
float y,
float width,
float height,
float scale)
Takes in a rectangle specification and scales it equally along each direction by a scale factor.
|
void |
setActionNameGlyphPainter(java.lang.String actionName,
ActionGlyphPainter actionPainter)
Sets which glyph painter to use for an action with the given name
|
void |
setRenderStyle(PolicyGlyphPainter2D.PolicyGlyphRenderStyle renderStyle)
Sets the rendering style
|
void |
setSoftTieRenderStyleDelta(double delta)
Sets the soft difference between max actions to determine ties when the MAXACTIONSOFSOFTTIE render style is used.
|
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.
|
protected java.lang.Object xKey
protected java.lang.Object yKey
protected VariableDomain xRange
protected VariableDomain yRange
protected double xWidth
protected double yWidth
protected PolicyGlyphPainter2D.PolicyGlyphRenderStyle renderStyle
protected double softTieDelta
protected java.util.Map<java.lang.String,ActionGlyphPainter> actionNameToGlyphPainter
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 setActionNameGlyphPainter(java.lang.String actionName, ActionGlyphPainter actionPainter)
actionName
- the name of the actionactionPainter
- the glyph painter used to represent itpublic PolicyGlyphPainter2D.PolicyGlyphRenderStyle getRenderStyle()
public void setRenderStyle(PolicyGlyphPainter2D.PolicyGlyphRenderStyle renderStyle)
renderStyle
- the rending style to usepublic void setSoftTieRenderStyleDelta(double delta)
delta
- the delta for determining ties.public double getSoftTieRenderStyleDelta()
public void paintStatePolicy(java.awt.Graphics2D g2, State s, Policy policy, float cWidth, float cHeight)
StatePolicyPainter
paintStatePolicy
in interface StatePolicyPainter
g2
- graphics context to which the object should be painteds
- the state of the object to be paintedpolicy
- the policy that can be used on state scWidth
- width of the canvas sizecHeight
- height of the canvas sizeprotected float[] rescaleRect(float x, float y, float width, float height, float scale)
x
- the left side of the rectangley
- the top side of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglescale
- the scale factor