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
MAXACTIONSOFTTIE paints the glyphs for all actions whose likelihood is within some threshold of the most likely action DISTSCALED paints glyphs for all actions and scales them by the likelihood of the action |
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 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 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.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-posiition on the canvas
|
protected java.lang.String |
xObjectName
The name of the object that holds the x-attribute used for determining the x-posiition 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-posiition on the canvas
|
protected java.lang.String |
yObjectName
The name of the object that holds the y-attribute used for determining the y-posiition on the canvas
|
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 |
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 |
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 |
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.
|
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.
|
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 int numXCells
protected int numYCells
protected PolicyGlyphPainter2D.PolicyGlyphRenderStyle renderStyle
protected double softTieDelta
protected java.util.Map<java.lang.String,ActionGlyphPainter> actionNameToGlyphPainter
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 setActionNameGlyphPainter(java.lang.String actionName, ActionGlyphPainter actionPainter)
actionName
- the name of the actionactionPainter
- the glyph painter used to represent itpublic 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 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 factorprotected 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