本文整理汇总了Java中prefuse.action.assignment.StrokeAction类的典型用法代码示例。如果您正苦于以下问题:Java StrokeAction类的具体用法?Java StrokeAction怎么用?Java StrokeAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StrokeAction类属于prefuse.action.assignment包,在下文中一共展示了StrokeAction类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTreeVisualization
import prefuse.action.assignment.StrokeAction; //导入依赖的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;
}
示例2: initialiseGraphView
import prefuse.action.assignment.StrokeAction; //导入依赖的package包/类
private void initialiseGraphView(Graph g, String label, int orientation, Dimension size) {
setSize(size);
m_vis = new Visualization();
m_vis.addFocusGroup("selected");
m_vis.addFocusGroup("highlighted");
MultiScaleLabelRenderer tr = new MultiScaleLabelRenderer("value", label.contains("image") ? label : null);
tr.setImagePosition(Constants.TOP);
m_vis.setRendererFactory(new DefaultRendererFactory(tr));
// adds graph to visualization and sets renderer label field
setGraph(g);
int hops = Integer.MAX_VALUE;
final GraphDistanceFilter filter = new GraphDistanceFilter(graph, hops);
FontAction font = new FontAction(nodes, UIHelper.VER_8_PLAIN);
ColorAction fill = new ColorAction(nodes, VisualItem.FILLCOLOR, ColorLib.rgb(255, 255, 255));
fill.add("ingroup('highlighted')", ColorLib.rgb(241, 242, 242));
fill.add("ingroup('selected')", ColorLib.rgb(241, 242, 242));
ColorAction stroke = new ColorAction(nodes, VisualItem.STROKECOLOR, backgroundColor);
StrokeAction strokeWeight = new StrokeAction(nodes, StrokeLib.getStroke(3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
stroke.add("ingroup('highlighted')", ColorLib.rgb(224, 228, 204));
stroke.add("ingroup('selected')", ColorLib.rgb(202, 106, 33));
ActionList draw = new ActionList(500);
draw.add(font);
draw.add(filter);
draw.add(fill);
draw.add(stroke);
draw.add(strokeWeight);
draw.add(new ColorAction(nodes, VisualItem.TEXTCOLOR, ColorLib.rgb(109, 110, 113)));
draw.add(new ColorAction(edges, VisualItem.FILLCOLOR, ColorLib.gray(200)));
draw.add(new ColorAction(edges, VisualItem.STROKECOLOR, ColorLib.gray(200)));
draw.add(new RepaintAction());
ActionList animate = new ActionList();
NodeLinkTreeLayout layout = new NodeLinkTreeLayout(graph);
layout.setDepthSpacing(80);
layout.setBreadthSpacing(70);
layout.setOrientation(orientation);
animate.add(new QualityControlAnimator());
animate.add(new LocationAnimator(nodes));
animate.add(layout);
m_vis.putAction("draw", draw);
m_vis.putAction("layout", animate);
// set up a display to show the visualization
display = new Display(m_vis);
display.setSize(size);
// main display controls
display.addControlListener(new PanControl());
display.addControlListener(new ZoomControl());
display.addControlListener(new WheelZoomControl());
display.addControlListener(new ZoomToFitControl());
// now we run our action list
m_vis.run("draw");
m_vis.run("layout");
add(display);
}