|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object prefuse.activity.Activity prefuse.action.Action prefuse.action.GroupAction prefuse.action.ItemAction prefuse.action.EncoderAction prefuse.action.assignment.ShapeAction
public class ShapeAction
Assignment Action that assigns shape values to VisualItems.
Shape values are simple integer codes that indicate to
appropriate renderer instances what shape should be drawn. The default
list of shape values is included in the Constants
class,
all beginning with the prefix SHAPE
. Of course, clients can
always create their own shape codes that are handled by a custom Renderer.
By default, a ShapeAction simply sets each VisualItem to be a rectangle. Clients can change this default value to achieve uniform shape assignment, or can add any number of additional rules for shape assignment. Rules are specified by a Predicate instance which, if returning true, will trigger that rule, causing either the provided shape value or the result of a delegate ShapeAction to be applied. Rules are evaluated in the order in which they are added to the ShapeAction, so earlier rules will have precedence over rules added later.
In addition, subclasses can simply override getShape(VisualItem)
to achieve custom shape assignment. In some cases, this may be the simplest
or most flexible approach.
This Action only sets the shape field of the VisualItem. For this value
to have an effect, a renderer instance that takes this shape value
into account must be used (e.g., ShapeRenderer
).
To automatically assign shape values based on varying values of a
particular data field, consider using the DataShapeAction
.
Field Summary | |
---|---|
protected int |
m_defaultShape
|
Fields inherited from class prefuse.action.ItemAction |
---|
m_predicate |
Fields inherited from class prefuse.action.GroupAction |
---|
m_group |
Fields inherited from class prefuse.action.Action |
---|
m_vis |
Fields inherited from class prefuse.activity.Activity |
---|
DEFAULT_STEP_TIME, INFINITY |
Constructor Summary | |
---|---|
ShapeAction()
Constructor. |
|
ShapeAction(java.lang.String group)
Constructor. |
|
ShapeAction(java.lang.String group,
int shape)
Constructor with a specified a default shape value. |
Method Summary | |
---|---|
void |
add(Predicate p,
int shape)
Add a shape mapping rule to this ShapeAction. |
void |
add(Predicate p,
ShapeAction f)
Add a size mapping rule to this ShapeAction. |
void |
add(java.lang.String expr,
int shape)
Add a shape mapping rule to this ShapeAction. |
void |
add(java.lang.String expr,
ShapeAction f)
Add a shape mapping rule to this ShapeAction. |
int |
getDefaultSize()
Returns the default shape value assigned to items. |
int |
getShape(VisualItem item)
Returns a shape value for the given item. |
void |
process(VisualItem item,
double frac)
Processes an individual item. |
void |
setDefaultShape(int defaultShape)
Sets the default shape value assigned to items. |
Methods inherited from class prefuse.action.EncoderAction |
---|
add, clear, finish, lookup, remove, run, setup, setVisualization |
Methods inherited from class prefuse.action.ItemAction |
---|
getFilterPredicate, setFilterPredicate |
Methods inherited from class prefuse.action.GroupAction |
---|
getGroup, setGroup |
Methods inherited from class prefuse.action.Action |
---|
getVisualization, run |
Methods inherited from class prefuse.activity.Activity |
---|
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int m_defaultShape
Constructor Detail |
---|
public ShapeAction()
public ShapeAction(java.lang.String group)
group
- the data group processed by this Action.public ShapeAction(java.lang.String group, int shape)
group
- the data group processed by this Action.shape
- the default shape value to useMethod Detail |
---|
public int getDefaultSize()
public void setDefaultShape(int defaultShape)
defaultShape
- the new default shape valuepublic void add(Predicate p, int shape)
p
- the rule Predicateshape
- the shape valuepublic void add(java.lang.String expr, int shape)
expr
- the expression String, should parse to a Predicate.shape
- the shape value
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void add(Predicate p, ShapeAction f)
p
- the rule Predicatef
- the delegate ShapeAction to usepublic void add(java.lang.String expr, ShapeAction f)
expr
- the expression String, should parse to a Predicate.f
- the delegate ShapeAction to use
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void process(VisualItem item, double frac)
ItemAction
process
in class ItemAction
item
- the VisualItem to processfrac
- the fraction of elapsed duration timeItemAction.process(prefuse.visual.VisualItem, double)
public int getShape(VisualItem item)
item
- the item for which to get the shape value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |