|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.portrayal.SimplePortrayal2D
sim.portrayal.simple.FacetedPortrayal2D
public class FacetedPortrayal2D
A wrapper for multiple Portrayal2Ds which calls on one or the other one according to the underlying state of the object, which must be Valuable or a Number of some sort. The particular sub-portrayal (called a "facet") chosen is based on the integer value returned (or converted to an integer if it's a double). Optionally FacetedPortrayal2D will call on all* its underlying portrayals at one time. If any array element is null, FacetedPortrayal2D will assume it represents the object itself (assuming the object itself is also a SimplePortrayal2D).
Field Summary | |
---|---|
SimplePortrayal2D[] |
children
|
Fields inherited from class sim.portrayal.SimplePortrayal2D |
---|
TYPE_HIT_OBJECT, TYPE_SELECTED_OBJECT |
Constructor Summary | |
---|---|
FacetedPortrayal2D(SimplePortrayal2D[] children)
If child is null, then the underlying model object is presumed to be a Portrayal2D and will be used. |
|
FacetedPortrayal2D(SimplePortrayal2D[] children,
boolean portrayAllChildren)
If child is null, then the underlying model object is presumed to be a Portrayal2D and will be used. |
Method Summary | |
---|---|
void |
draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
Draw a the given object with an origin at (info.draw.x, info.draw.y), and with the coordinate system scaled by so that 1 unit is in the x and y directions are equal to info.draw.width and info.draw.height respectively in pixels. |
Inspector |
getInspector(LocationWrapper wrapper,
GUIState state)
If portrayAllChildren, Calls on the first child to return the inspector. |
java.lang.String |
getName(LocationWrapper wrapper)
If portrayAllChildren, Calls on the first child to return the name. |
boolean |
hitObject(java.lang.Object object,
DrawInfo2D range)
Return true if the given object, when drawn, intersects with a provided rectangle, for hit testing purposes. |
boolean |
setSelected(LocationWrapper wrapper,
boolean selected)
If portrayAllChildren, Returns true if any ONE of the children returns true. |
Methods inherited from class sim.portrayal.SimplePortrayal2D |
---|
getStatus, handleMouseEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public SimplePortrayal2D[] children
Constructor Detail |
---|
public FacetedPortrayal2D(SimplePortrayal2D[] children, boolean portrayAllChildren)
public FacetedPortrayal2D(SimplePortrayal2D[] children)
Method Detail |
---|
public void draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)
Portrayal2D
draw
in interface Portrayal2D
draw
in class SimplePortrayal2D
public boolean hitObject(java.lang.Object object, DrawInfo2D range)
SimplePortrayal2D
hitObject
in class SimplePortrayal2D
public boolean setSelected(LocationWrapper wrapper, boolean selected)
setSelected
in interface Portrayal
setSelected
in class SimplePortrayal2D
public Inspector getInspector(LocationWrapper wrapper, GUIState state)
getInspector
in interface Portrayal
getInspector
in class SimplePortrayal2D
public java.lang.String getName(LocationWrapper wrapper)
getName
in interface Portrayal
getName
in class SimplePortrayal2D
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |