|
||||||||||
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.SizeAction
public class SizeAction
Assignment Action that assigns size values to VisualItems.
By default, a SizeAction simply assigns a single default size value to all items (the initial default size is 1.0). Clients can change this default value to achieve uniform size assignment, or can add any number of additional rules for size assignment. Rules are specified by a Predicate instance which, if returning true, will trigger that rule, causing either the provided size value or the result of a delegate SizeAction to be applied. Rules are evaluated in the order in which they are added to the SizeAction, so earlier rules will have precedence over rules added later.
In addition, subclasses can simply override getSize(VisualItem)
to achieve custom size assignment. In some cases, this may be the simplest
or most flexible approach.
To automatically assign size values based on varying values of a
particular data field, consider using the DataSizeAction
.
Field Summary | |
---|---|
protected double |
m_defaultSize
|
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 | |
---|---|
SizeAction()
Constructor. |
|
SizeAction(java.lang.String group)
Constructor. |
|
SizeAction(java.lang.String group,
double size)
Constructor which specified a default size value. |
Method Summary | |
---|---|
void |
add(Predicate p,
double size)
Add a size mapping rule to this SizeAction. |
void |
add(Predicate p,
SizeAction f)
Add a size mapping rule to this SizeAction. |
void |
add(java.lang.String expr,
double size)
Add a size mapping rule to this SizeAction. |
void |
add(java.lang.String expr,
SizeAction f)
Add a size mapping rule to this SizeAction. |
double |
getDefaultSize()
Returns the default size value assigned to items. |
double |
getSize(VisualItem item)
Returns a size value for the given item. |
void |
process(VisualItem item,
double frac)
Processes an individual item. |
void |
setDefaultSize(double defaultSize)
Sets the default size 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 double m_defaultSize
Constructor Detail |
---|
public SizeAction()
public SizeAction(java.lang.String group)
group
- the data group processed by this Action.public SizeAction(java.lang.String group, double size)
group
- the data group processed by this Action.size
- the default size to useMethod Detail |
---|
public double getDefaultSize()
public void setDefaultSize(double defaultSize)
defaultSize
- the new default size valuepublic void add(Predicate p, double size)
p
- the rule Predicatesize
- the size valuepublic void add(java.lang.String expr, double size)
expr
- the expression String, should parse to a Predicate.size
- the size value
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void add(Predicate p, SizeAction f)
p
- the rule Predicatef
- the delegate SizeAction to usepublic void add(java.lang.String expr, SizeAction f)
expr
- the expression String, should parse to a Predicate.f
- the delegate SizeAction 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 double getSize(VisualItem item)
item
- the item for which to get the size value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |