public class DataShapeAction extends ShapeAction
Assignment Action that assigns shape values for a group of items based upon
a data field. 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.
The data field will be assumed to be nominal, and shapes will
be assigned to unique values in the order they are encountered. Note that
if the number of unique values is greater than
Constants.SHAPE_COUNT
(when no palette is given) or
the length of a specified palette, then duplicate shapes will start
being assigned.
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
).
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
m_dataField |
protected java.util.Map |
m_ordinalMap |
protected int[] |
m_palette |
protected static int |
NO_SHAPE |
m_defaultShape
m_predicate
m_group
DEFAULT_STEP_TIME, INFINITY
Constructor and Description |
---|
DataShapeAction(java.lang.String group,
java.lang.String field)
Create a new DataShapeAction.
|
DataShapeAction(java.lang.String group,
java.lang.String field,
int[] palette)
Create a new DataShapeAction.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDataField()
Returns the data field used to encode shape values.
|
int |
getShape(VisualItem item)
Returns a shape value for the given item.
|
void |
setDataField(java.lang.String field)
Set the data field used to encode shape values.
|
void |
setDefaultShape(int defaultShape)
This operation is not supported by the DataShapeAction type.
|
protected void |
setup()
Perform any necessary setup before this encoder can be used.
|
add, add, add, add, getDefaultSize, process
add, clear, finish, lookup, remove, run, setVisualization
getFilterPredicate, setFilterPredicate
getGroup, setGroup
getVisualization, run
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
protected static final int NO_SHAPE
protected java.lang.String m_dataField
protected int[] m_palette
protected java.util.Map m_ordinalMap
public DataShapeAction(java.lang.String group, java.lang.String field)
group
- the data group to processfield
- the data field to base shape assignments onpublic DataShapeAction(java.lang.String group, java.lang.String field, int[] palette)
group
- the data group to processfield
- the data field to base shape assignments onpalette
- a palette of shape values to use for the encoding.
By default, shape values are assumed to be one of the integer SHAPE
codes included in the Constants
class.public java.lang.String getDataField()
public void setDataField(java.lang.String field)
field
- the data field to map to shape valuespublic void setDefaultShape(int defaultShape)
setDefaultShape
in class ShapeAction
defaultShape
- the new default shape valuejava.lang.UnsupportedOperationException
ShapeAction.setDefaultShape(int)
protected void setup()
EncoderAction
setup
in class EncoderAction
EncoderAction.setup()
public int getShape(VisualItem item)
ShapeAction
getShape
in class ShapeAction
item
- the item for which to get the shape valueShapeAction.getShape(prefuse.visual.VisualItem)
Copyright ? 2013 Regents of the University of California