prefuse.action.assignment
Class DataShapeAction
java.lang.Object
prefuse.activity.Activity
prefuse.action.Action
prefuse.action.GroupAction
prefuse.action.ItemAction
prefuse.action.EncoderAction
prefuse.action.assignment.ShapeAction
prefuse.action.assignment.DataShapeAction
public class DataShapeAction
- extends ShapeAction
Assignment Action that assigns ShapeBuilder values to VisualItems based on a
data field.
ShapeBuilders know how to draw certain shapes. The default ShapeBuilders are
in the PredefinedShape class. Of course, clients can always create their own
ShapeBuilders.
The data field will be assumed to be of type nominal, and ShapeBuilders will
be assigned to unique values in the order they are encountered. Note that
if the number of unique values is greater than the the length of a specified palette
then duplicate shapes will start being assigned.
This Action only sets the shapeBuilder field of the VisualItem. For this value
to have an effect, a renderer instance that takes this shapeBuilder value
into account must be used (e.g., ShapeRenderer
).
- Author:
- jeffrey heer
- See Also:
PredefinedShape
Fields inherited from class prefuse.action.Action |
m_vis |
Constructor Summary |
DataShapeAction(java.lang.String group,
java.lang.String field)
Create a new DataShapeAction |
DataShapeAction(java.lang.String group,
java.lang.String field,
ShapeBuilder[] palette)
Create a new DataShapeAction. |
Method Summary |
java.lang.String |
getDataField()
Returns the data field used to encode shape values. |
ShapeBuilder |
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(ShapeBuilder defaultShape)
This operation is not supported by the DataShapeAction type. |
protected void |
setup()
Perform any necessary setup before this encoder can be used. |
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 |
m_dataField
protected java.lang.String m_dataField
m_palette
protected ShapeBuilder[] m_palette
m_ordinalMap
protected java.util.Map<java.lang.Object,java.lang.Integer> m_ordinalMap
DataShapeAction
public DataShapeAction(java.lang.String group,
java.lang.String field)
- Create a new DataShapeAction
- Parameters:
group
- the data group to processfield
- the data field to base shape assignments on
DataShapeAction
public DataShapeAction(java.lang.String group,
java.lang.String field,
ShapeBuilder[] palette)
- Create a new DataShapeAction.
- Parameters:
group
- the data group to processfield
- the data field to base shape assignments onpalette
- a palette of shape values to use for the encoding.
getDataField
public java.lang.String getDataField()
- Returns the data field used to encode shape values.
- Returns:
- the data field that is mapped to shape values
setDataField
public void setDataField(java.lang.String field)
- Set the data field used to encode shape values.
- Parameters:
field
- the data field to map to shape values
setDefaultShape
public void setDefaultShape(ShapeBuilder defaultShape)
- This operation is not supported by the DataShapeAction type.
Calling this method will result in a thrown exception.
- Overrides:
setDefaultShape
in class ShapeAction
- Parameters:
defaultShape
- the new default shape value
- Throws:
java.lang.UnsupportedOperationException
- See Also:
ShapeAction.setDefaultShape(ShapeBuilder)
setup
protected void setup()
- Description copied from class:
EncoderAction
- Perform any necessary setup before this encoder can be used. By default
does nothing. Subclasses can override this method to perform custom
setup before the Action is used.
- Overrides:
setup
in class EncoderAction
- See Also:
EncoderAction.setup()
getShape
public ShapeBuilder getShape(VisualItem<?> item)
- Description copied from class:
ShapeAction
- Returns a shape value for the given item.
- Overrides:
getShape
in class ShapeAction
- Parameters:
item
- the item for which to get the shape value
- Returns:
- the shape value for the item
- See Also:
ShapeAction.getShape(prefuse.visual.VisualItem)
Copyright © 2008 Regents of the University of California