public class Visualizer extends MultiLayerRenderer
MultiLayerRenderer class to provide a base instance of a StateRenderLayer in its render list
and provides methods to directly access and interface with the StateRenderLayer instance.
The StateRenderLayer instance provides 2D visualization of states by being provided a set of classes that can paint
ObjectInstances to the canvas as well as classes that can paint general domain information. Painters
for object classes as well as specific object instances can be provided. If there is a painter
for an object class and a painter for a specific object instance of that same class, then the specific object instance
painter will be used to pain that object instead of the painter for that instance's OO-MDP class.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
saAfterStateRL |
protected StateActionRenderLayer |
sarender
An optional
StateActionRenderLayer so that actions can be visualized on the same screen. |
protected StateRenderLayer |
srender
The
StateRenderLayer instance for visualizing OO-MDP states. |
bgColor, bufferedGraphics, offscreen, renderLayers| Constructor and Description |
|---|
Visualizer() |
Visualizer(StateRenderLayer srender) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObjectClassPainter(java.lang.String className,
ObjectPainter op)
Adds a class that will paint objects that belong to a given OO-MDPclass.
|
void |
addSpecificObjectPainter(java.lang.String objectName,
ObjectPainter op)
Adds a painter that will be used to paint a specific object in states
|
void |
addStaticPainter(StaticPainter sp)
Adds a static painter for the domain.
|
Visualizer |
copy() |
StateRenderLayer |
getStateRenderLayer()
Returns the
StateRenderLayer instance for visualizing OO-MDP states. |
void |
setBGColor(java.awt.Color c)
Sets the background color of the canvas
|
void |
setSetRenderLayer(StateRenderLayer srender) |
void |
setStateActionRenderLayer(StateActionRenderLayer sarender,
boolean afterStateRL)
Adds a
StateActionRenderLayer to this Visualizer. |
void |
updateState(State s)
Updates the state that needs to be painted and repaints.
|
void |
updateStateAction(State s,
AbstractGroundedAction a)
Updates the state and action for the
StateRenderLayer and StateActionRenderLayer; then repaints. |
addRenderLayer, getBgColor, initializeOffscreen, insertRenderLayerTo, numRenderLayers, paint, removeRenderLayeraddNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, updateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validateprotected StateRenderLayer srender
StateRenderLayer instance for visualizing OO-MDP states.protected StateActionRenderLayer sarender
StateActionRenderLayer so that actions can be visualized on the same screen.protected boolean saAfterStateRL
public Visualizer()
public Visualizer(StateRenderLayer srender)
public void setSetRenderLayer(StateRenderLayer srender)
public void setStateActionRenderLayer(StateActionRenderLayer sarender, boolean afterStateRL)
StateActionRenderLayer to this Visualizer.sarender - The StateActionRenderLayer to add.afterStateRL - if true, then the StateActionRenderLayer will be drawn after the StateRenderLayer is drawn
If false, then it draws before.public void setBGColor(java.awt.Color c)
setBGColor in class MultiLayerRendererc - the background color of the canvaspublic void addStaticPainter(StaticPainter sp)
sp - the static painter to add.public void addObjectClassPainter(java.lang.String className,
ObjectPainter op)
className - the name of the class that the provided painter can paintop - the painterpublic void addSpecificObjectPainter(java.lang.String objectName,
ObjectPainter op)
objectName - the name of the object this painter is used to paintop - the painterpublic StateRenderLayer getStateRenderLayer()
StateRenderLayer instance for visualizing OO-MDP states.StateRenderLayer instance for visualizing OO-MDP states.public void updateState(State s)
StateActionRenderLayer has been specified,
then it will have its state-action cleared before repainting.s - the state to paintpublic void updateStateAction(State s, AbstractGroundedAction a)
StateRenderLayer and StateActionRenderLayer; then repaints.s - the State to be painted.a - the AbstractGroundedAction to be painted.public Visualizer copy()