本文整理汇总了Java中prefuse.action.ActionList.add方法的典型用法代码示例。如果您正苦于以下问题:Java ActionList.add方法的具体用法?Java ActionList.add怎么用?Java ActionList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.action.ActionList
的用法示例。
在下文中一共展示了ActionList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColorizeActions
import prefuse.action.ActionList; //导入方法依赖的package包/类
private ActionList createColorizeActions( Color color )
{
ActionList list = new ActionList();
list.add(
new ColorAction(
DATA_ID,
VisualItem.FILLCOLOR, color.getRGB()
)
);
list.add(
new ColorAction(
DATA_ID,
VisualItem.STROKECOLOR, color.darker().getRGB()
)
);
return list;
}
示例2: TimeOverviewView
import prefuse.action.ActionList; //导入方法依赖的package包/类
public TimeOverviewView(JRangeSlider time_window_slider) {
super(new Visualization());
this.time_window_slider = time_window_slider;
time_window_slider.addChangeListener(this);
// save the reference to global data
this.d = Data.getData();
eth = new FastEdgeTimeHistogram(d);
ActionList draw = new ActionList(ActionList.INFINITY,200);
draw.add(new RepaintAction());
m_vis.putAction("draw", draw);
// TODO: this might have a locking issue
m_vis.run("draw");
}
示例3: updateInstanceVisualizationColors
import prefuse.action.ActionList; //导入方法依赖的package包/类
public static void updateInstanceVisualizationColors( HVConfig config, Visualization vis )
{
ColorAction colorize = createInstanceVisualizationColorAction( config );
ActionList draw = (ActionList)vis.removeAction( "draw" );
draw.remove( 1 ).cancel();
draw.add( 1, colorize );
vis.putAction( "draw", draw );
}
示例4: HistogramGraph
import prefuse.action.ActionList; //导入方法依赖的package包/类
/**
* @param histoTable
* a histogrammized version of dataTable
* @param startingField
* the name of the field (column) of the data table
* whose histogram is to be shown in the histogram graph.
*/
public HistogramGraph( HistogramTable histoTable, String startingField, Color histogramColor )
{
super( new Visualization() );
m_histoTable = histoTable;
startingField = getStartingField( startingField );
// --------------------------------------------------------------------
// STEP 1: setup the visualized data
m_vis.addTable( DATA_ID, m_histoTable );
initializeRenderer();
// --------------------------------------------------------------------
// STEP 2: create actions to process the visual data
ActionList colors = createColorizeActions( histogramColor );
m_vis.putAction( "color", colors );
ActionList draw = new ActionList();
draw.add( initializeAxes( startingField ) );
draw.add( colors );
draw.add( new RepaintAction() );
m_vis.putAction( "draw", draw );
// --------------------------------------------------------------------
// STEP 3: set up a display and ui components to show the visualization
initializeWindowCharacteristics();
// --------------------------------------------------------------------
// STEP 4: launching the visualization
m_vis.run( "draw" );
}
示例5: setBarColor
import prefuse.action.ActionList; //导入方法依赖的package包/类
public void setBarColor( Color color )
{
m_vis.removeAction( "color" );
ActionList colors = createColorizeActions( color );
m_vis.putAction( "color", colors );
ActionList draw = (ActionList)m_vis.getAction( "draw" );
draw.remove( 1 ).cancel();
draw.add( 1, colors );
}
示例6: setCurrentLayout
import prefuse.action.ActionList; //导入方法依赖的package包/类
public void setCurrentLayout(LayoutInfo currentLayout) {
// 切换布局管理器
currentLayout.getLayout().setLayoutBounds(new Rectangle(this.display.getWidth(), this.display.getHeight()));
Action treeLayout = this.display.getVisualization().getAction("treeLayout");
this.display.getVisualization().putAction("treeLayout", currentLayout.getLayout());
ActionList filter = (ActionList) this.display.getVisualization().getAction("filter");
filter.remove(treeLayout);
filter.add(currentLayout.getLayout());
this.currentLayout = currentLayout;
this.deleteSpecifiedPosition();
}
示例7: setNewMetadataColorAction
import prefuse.action.ActionList; //导入方法依赖的package包/类
public void setNewMetadataColorAction(HashMap<String, Color> map,
Color iColor, Color mColor) {
this.stopActions();
ActionList fill = new ActionList();
ColorAction fc1 = new ColorAction("graph.nodes", mPredicateIdentifier,
VisualItem.FILLCOLOR, ColorLib.color(iColor));
ColorAction fc2 = new ColorAction("graph.nodes", mPredicateMetadata,
VisualItem.FILLCOLOR, ColorLib.color(mColor));
fill.add(fc1);
fill.add(fc2);
if (map != null && map.size() > 0) {
ArrayList<String> arr = new ArrayList<String>();
arr.addAll(map.keySet());
int[] palette = new int[arr.size()];
int i = 0;
for (String key : arr) {
Color c = map.get(key);
palette[i] = ColorLib.color(c);
Predicate predicate = ExpressionParser
.predicate("publisher = '" + key + "'");
ColorAction fillColor = new ColorAction("graph.nodes",
predicate, VisualItem.FILLCOLOR, palette[i]);
fill.add(fillColor);
i++;
}
}
mVis.putAction("fill", fill);
this.DEFAULT_IDENTIFIER_COLOR = iColor;
this.DEFAULT_METADATA_COLOR = mColor;
this.startActions();
}
示例8: createTreeVisualization
import prefuse.action.ActionList; //导入方法依赖的package包/类
public static Visualization createTreeVisualization( HVContext context, String currentGroupId )
{
updateTreeNodeRoles( context, currentGroupId );
Tree hierarchyTree = context.getHierarchy().getTree();
TreeLayoutData layoutData = context.getHierarchy().getTreeLayoutData();
Visualization vis = new Visualization();
if ( context.isHierarchyDataLoaded() ) {
final float strokeWidth = 3;
vis.add( HVConstants.HIERARCHY_DATA_NAME, hierarchyTree );
NodeRenderer r = new NodeRenderer( layoutData.getNodeSize() );
DefaultRendererFactory drf = new DefaultRendererFactory( r );
EdgeRenderer edgeRenderer = new EdgeRenderer( prefuse.Constants.EDGE_TYPE_LINE );
edgeRenderer.setDefaultLineWidth( strokeWidth );
drf.setDefaultEdgeRenderer( edgeRenderer );
vis.setRendererFactory( drf );
NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout(
HVConstants.HIERARCHY_DATA_NAME,
layoutData.getTreeOrientation(),
layoutData.getDepthSpace(),
layoutData.getSiblingSpace(),
layoutData.getSubtreeSpace()
);
treeLayout.setRootNodeOffset( 0 );
treeLayout.setLayoutBounds(
new Rectangle2D.Double(
0, 0,
layoutData.getLayoutWidth(), layoutData.getLayoutHeight()
)
);
ColorAction edgesColor = new ColorAction(
HVConstants.HIERARCHY_DATA_NAME + ".edges",
VisualItem.STROKECOLOR,
ColorLib.color( Color.lightGray )
);
ColorAction nodeBorderColor = new ColorAction(
HVConstants.HIERARCHY_DATA_NAME + ".nodes",
VisualItem.STROKECOLOR,
ColorLib.color( Color.lightGray )
);
ColorAction nodeFillColor = new NodeColorAction(
context,
HVConstants.HIERARCHY_DATA_NAME + ".nodes",
VisualItem.FILLCOLOR
);
StrokeAction nodeBorderStroke = new StrokeAction(
HVConstants.HIERARCHY_DATA_NAME + ".nodes",
StrokeLib.getStroke( strokeWidth )
);
ActionList designList = new ActionList();
designList.add( edgesColor );
designList.add( nodeBorderColor );
designList.add( nodeFillColor );
designList.add( nodeBorderStroke );
ActionList layout = new ActionList();
layout.add( treeLayout );
layout.add( new RepaintAction() );
vis.putAction( "design", designList );
vis.putAction( "layout", layout );
vis.putAction( "nodeColor", nodeFillColor );
// TODO we can here implement a heuristic that will check if after enlarging
// the border lines (rows and columns) of pixels do not contain other values
// than background colour. If so, then we are expanding one again, otherwise
// we have appropriate size of image
}
return vis;
}
示例9: initializeAxes
import prefuse.action.ActionList; //导入方法依赖的package包/类
/**
* @param fieldName
* the name of the field (column) to display
*/
private ActionList initializeAxes( String fieldName )
{
AxisLayout xAxis = new AxisLayout(
DATA_ID, fieldName,
Constants.X_AXIS, VisiblePredicate.TRUE
);
xAxis.setLayoutBounds( m_dataB );
m_vis.putAction( "x", xAxis );
String countField = HistogramTable.getCountField( fieldName );
AxisLayout yAxis = new AxisLayout(
DATA_ID, countField,
Constants.Y_AXIS, VisiblePredicate.TRUE
);
yAxis.setLayoutBounds( m_dataB );
m_vis.putAction( "y", yAxis );
DecimalFormat valueNumberFormat = new DecimalFormat();
valueNumberFormat.setMaximumFractionDigits( 2 );
valueNumberFormat.setMinimumFractionDigits( 2 );
DecimalFormat countNumberFormat = new DecimalFormat();
countNumberFormat.setMaximumFractionDigits( 0 );
countNumberFormat.setMinimumFractionDigits( 0 );
AxisLabelLayout xLabels = new AxisLabelLayout( XLABELS_ID, xAxis, m_xlabB );
xLabels.setNumberFormat( valueNumberFormat );
m_vis.putAction( XLABELS_ID, xLabels );
AxisLabelLayout yLabels = new AxisLabelLayout( YLABELS_ID, yAxis, m_ylabB );
yLabels.setNumberFormat( countNumberFormat );
m_vis.putAction( YLABELS_ID, yLabels );
updateAxes( fieldName, xAxis, yAxis, xLabels, yLabels );
ActionList axes = new ActionList();
axes.add( xAxis );
axes.add( yAxis );
axes.add( xLabels );
axes.add( yLabels );
return axes;
}
示例10: DLGVisualizer
import prefuse.action.ActionList; //导入方法依赖的package包/类
public DLGVisualizer(int dx,int dy,DLG g) throws Exception {
// initialize display and data
super(new Visualization());
initDataGroups(g);
// set up the renderers
// draw the nodes as basic shapes
// Renderer nodeR = new ShapeRenderer(20);
LabelRenderer nodeR = new LabelRenderer("name");
nodeR.setHorizontalPadding(4);
nodeR.setVerticalPadding(2);
nodeR.setRoundedCorner(8, 8); // round the corners
EdgeRenderer edgeR = new LabelEdgeRenderer(Constants.EDGE_TYPE_LINE,Constants.EDGE_ARROW_FORWARD);
edgeR.setArrowHeadSize(6,6);
// draw aggregates as polygons with curved edges
PolygonRenderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
polyR.setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory(nodeR,edgeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nFill);
colors.add(nEdges);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
ForceDirectedLayout fdl = new ForceDirectedLayout(GRAPH, true);
ForceSimulator m_fsim = new ForceSimulator();
m_fsim.addForce(new NBodyForce());
if (g instanceof TreeDLG) {
m_fsim.addForce(new SpringForce(1E-4f,100));
} else {
m_fsim.addForce(new SpringForce(1E-4f,200));
}
m_fsim.addForce(new DragForce());
fdl.setForceSimulator(m_fsim);
layout.add(colors);
layout.add(fdl);
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(dx,dy);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// ActionList draw = new ActionList();
// draw.add(new GraphDistanceFilter(GRAPH, 50));
// m_vis.putAction("draw", draw);
// set things running
m_vis.run("layout");
}
示例11: RenderPrefuseGraph
import prefuse.action.ActionList; //导入方法依赖的package包/类
/**
* @param prefuseDisplay
* @param graph
* @param id
*/
public RenderPrefuseGraph(Display prefuseDisplay, Graph graph, String id) {
/* default color for nodes and edges
* both is overwritten later (NodeRenderer and TextLayoutDecorator) */
ColorAction fill = new ColorAction("GraphDataModifier.nodes", VisualItem.FILLCOLOR, ColorLib.rgb(0, 200, 0));
ColorAction edges = new ColorAction("GraphDataModifier.edges", VisualItem.STROKECOLOR, ColorLib.rgb(0, 0, 0));
ColorAction arrow = new ColorAction("GraphDataModifier.edges", VisualItem.FILLCOLOR, ColorLib.rgb(0, 0, 0));
fill.add(VisualItem.FIXED, ColorLib.rgb(0, 250, 0));
fill.add(VisualItem.HIGHLIGHT, ColorLib.rgb(0, 250, 0));
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(fill); // add default node color
layout.add(edges); // add default edge color
layout.add(arrow); // add default edge color
// set layout as force directed layout without (all objects must be displayed)
ForceDirectedLayoutExtended fdle = new ForceDirectedLayoutExtended("GraphDataModifier", false);
PrefuseForceAbstractLayoutStorage.addForceDirectedLayout(fdle, id);
layout.add(fdle);
layout.add(new TextLayoutDecorator("nodedec"));
layout.add(new TextLayoutDecorator("NodeExtraData"));
layout.add(new TextLayoutDecorator("EdgeExtraData"));
layout.add(new RepaintAction());
layout.add(new TextLayoutDecorator("edgeDeco"));
final Visualization vis = new Visualization();
vis.add("GraphDataModifier", graph);
vis.putAction("layout", layout);
NodeRenderer nodeRender = new NodeRenderer();
EdgeRender edgeRender = new EdgeRender(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD);
edgeRender.setArrowHeadSize(10, 10);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeRender);
drf.setDefaultEdgeRenderer(edgeRender);
drf.add(new InGroupPredicate("edgeDeco"), new LabelRenderer(ColumnNames.NAME));
drf.add(new InGroupPredicate("nodedec"), new LabelRenderer(ColumnNames.NAME));
final Schema DECATOR_SCHEMA = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA.setDefault(VisualItem.INTERACTIVE, false);
DECATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.rgb(255, 255, 255));
final Schema DECATOR_SCHEMA_EDGES = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA_EDGES.setDefault(VisualItem.INTERACTIVE, true);
DECATOR_SCHEMA_EDGES.setDefault(VisualItem.TEXTCOLOR, ColorLib.rgb(255, 255, 255));
DECATOR_SCHEMA.setDefault(VisualItem.FONT, FontUsed.getFont());
DECATOR_SCHEMA.setDefault(VisualItem.TEXTCOLOR, ColorLib.gray(0));
// add extra name field (should be done before the normal name field [for edges], otherwise normal field is covered with extra name background)
final Schema DECATOR_SCHEMA_NAME_EXTRA = PrefuseLib.getVisualItemSchema();
DECATOR_SCHEMA_NAME_EXTRA.setDefault(VisualItem.SIZE, NameExtraDataSize);
DECATOR_SCHEMA_NAME_EXTRA.setDefault(VisualItem.INTERACTIVE, false);
drf.add(new InGroupPredicate("NodeExtraData"), new LabelRenderer(ColumnNames.NAME_DATA));
vis.addDecorators("NodeExtraData", "GraphDataModifier.nodes", DECATOR_SCHEMA_NAME_EXTRA);
drf.add(new InGroupPredicate("EdgeExtraData"), new LabelRenderer(ColumnNames.NAME_DATA));
// disabled because unhappy with the optical result
// vis.addDecorators("EdgeExtraData", "GraphDataModifier.edges", DECATOR_SCHEMA_NAME_EXTRA);
// add short name decorators
vis.addDecorators("edgeDeco", "GraphDataModifier.edges", DECATOR_SCHEMA_EDGES);
vis.addDecorators("nodedec", "GraphDataModifier.nodes", DECATOR_SCHEMA);
vis.setRendererFactory(drf);
prefuseDisplay.setVisualization(vis);
vis.run("layout");
}
示例12: StackedGraphDisplay
import prefuse.action.ActionList; //导入方法依赖的package包/类
StackedGraphDisplay()
{
super( new Visualization() );
setBackground( ColorLib.getColor( 0, 51, 88 ) );
LabelRenderer labelRenderer = new LabelRenderer( NAME_LABEL );
labelRenderer.setVerticalAlignment( Constants.BOTTOM );
labelRenderer.setHorizontalAlignment( Constants.LEFT );
EdgeRenderer usesRenderer = new EdgeRenderer( Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD );
usesRenderer.setHorizontalAlignment1( Constants.CENTER );
usesRenderer.setHorizontalAlignment2( Constants.CENTER );
usesRenderer.setVerticalAlignment1( Constants.BOTTOM );
usesRenderer.setVerticalAlignment2( Constants.TOP );
Predicate usesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==true", true );
// set up the renderers - one for nodes and one for LABELS
DefaultRendererFactory rf = new DefaultRendererFactory();
rf.add( new InGroupPredicate( GRAPH_NODES ), new NodeRenderer() );
rf.add( new InGroupPredicate( LABELS ), labelRenderer );
rf.add( usesPredicate, usesRenderer );
m_vis.setRendererFactory( rf );
// border colors
ColorAction borderColor = new BorderColorAction( GRAPH_NODES );
ColorAction fillColor = new FillColorAction( GRAPH_NODES );
// uses edge colors
ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 50, 50, 50 ) );
ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 50, 50, 50 ) );
// color settings
ActionList colors = new ActionList();
colors.add( fillColor );
colors.add( borderColor );
colors.add( usesColor );
colors.add( usesArrow );
m_vis.putAction( COLORS_ACTION, colors );
ActionList autoPan = new ActionList();
autoPan.add( colors );
autoPan.add( new AutoPanAction() );
autoPan.add( new RepaintAction() );
m_vis.putAction( AUTO_PAN_ACTION, autoPan );
// create the layout action list
stackedLayout = new StackedLayout( GRAPH );
ActionList layout = new ActionList();
layout.add( stackedLayout );
layout.add( new LabelLayout( LABELS ) );
layout.add( autoPan );
m_vis.putAction( LAYOUT_ACTION, layout );
// initialize our display
Dimension size = new Dimension( 400, 400 );
setSize( size );
setPreferredSize( size );
setItemSorter( new ExtendedTreeDepthItemSorter( true ) );
addControlListener( new HoverControl() );
addControlListener( new FocusControl( 1, COLORS_ACTION ) );
addControlListener( new WheelMouseControl() );
addControlListener( new PanControl( true ) );
addControlListener( new ItemSelectionControl() );
setDamageRedraw( true );
}
示例13: AggregateDemo
import prefuse.action.ActionList; //导入方法依赖的package包/类
public AggregateDemo() {
// initialize display and data
super(new Visualization());
//initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
LabelRenderer nodeR = new LabelRenderer();
nodeR.setImageField("image");
nodeR.setTextField(null);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new MyForcedDirectedLayout(GRAPH));
layout.add(new AggregateLayout(AGGR));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(false);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
//m_vis.run("layout");
}
示例14: AggregateDemo
import prefuse.action.ActionList; //导入方法依赖的package包/类
public AggregateDemo() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout(AGGR));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}
示例15: CodyTestWindow
import prefuse.action.ActionList; //导入方法依赖的package包/类
public CodyTestWindow() {
// initialize display and data
super(new Visualization());
initDataGroups();
// set up the renderers
// draw the nodes as basic shapes
Renderer nodeR = new ShapeRenderer(20);
// draw aggregates as polygons with curved edges
Renderer polyR = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
((PolygonRenderer)polyR).setCurveSlack(0.15f);
DefaultRendererFactory drf = new DefaultRendererFactory();
drf.setDefaultRenderer(nodeR);
drf.add("ingroup('aggregates')", polyR);
m_vis.setRendererFactory(drf);
// set up the visual operators
// first set up all the color actions
ColorAction nStroke = new ColorAction(NODES, VisualItem.STROKECOLOR);
nStroke.setDefaultColor(ColorLib.gray(100));
nStroke.add("_hover", ColorLib.gray(50));
ColorAction nFill = new ColorAction(NODES, VisualItem.FILLCOLOR);
nFill.setDefaultColor(ColorLib.gray(255));
nFill.add("_hover", ColorLib.gray(200));
ColorAction nEdges = new ColorAction(EDGES, VisualItem.STROKECOLOR);
nEdges.setDefaultColor(ColorLib.gray(100));
ColorAction aStroke = new ColorAction(AGGR, VisualItem.STROKECOLOR);
aStroke.setDefaultColor(ColorLib.gray(200));
aStroke.add("_hover", ColorLib.rgb(255,100,100));
int[] palette = new int[] {
ColorLib.rgba(255,200,200,150),
ColorLib.rgba(200,255,200,150),
ColorLib.rgba(200,200,255,150)
};
ColorAction aFill = new DataColorAction(AGGR, "id",
Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
// bundle the color actions
ActionList colors = new ActionList();
colors.add(nStroke);
colors.add(nFill);
colors.add(nEdges);
colors.add(aStroke);
colors.add(aFill);
// now create the main layout routine
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(colors);
layout.add(new ForceDirectedLayout(GRAPH, true));
layout.add(new AggregateLayout(AGGR));
layout.add(new RepaintAction());
m_vis.putAction("layout", layout);
// set up the display
setSize(500,500);
pan(250, 250);
setHighQuality(true);
addControlListener(new AggregateDragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
// set things running
m_vis.run("layout");
}