本文整理汇总了Java中prefuse.util.force.ForceSimulator.addForce方法的典型用法代码示例。如果您正苦于以下问题:Java ForceSimulator.addForce方法的具体用法?Java ForceSimulator.addForce怎么用?Java ForceSimulator.addForce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.util.force.ForceSimulator
的用法示例。
在下文中一共展示了ForceSimulator.addForce方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PolarDonutFDRLayout
import prefuse.util.force.ForceSimulator; //导入方法依赖的package包/类
/**
* Create a new PolarDonutFDRLayout.
* @param group the data group to layout. Must resolve to a Graph instance.
* @param enforceBounds indicates whether or not the layout should require
* that all node placements stay within the layout bounds.
* @param runonce indicates if the layout will be run in a run-once or
* animated fashion. In run-once mode, the layout will run for a set number
* of iterations when invoked. In animation mode, only one iteration of the
* layout is computed.
*/
public PolarDonutFDRLayout(double circleRadius, String m_group, String filter,
boolean enforceBounds, boolean runonce){
super(m_group);
this.circleRadius = circleRadius;
this.filter = filter + " and visible()";// and isnode()";
this.m_filter = (Predicate)ExpressionParser.parse(this.filter);
m_nodeGroup = PrefuseLib.getGroupName(m_group, Graph.NODES);
m_edgeGroup = PrefuseLib.getGroupName(m_group, Graph.EDGES);
m_enforceBounds = enforceBounds;
m_runonce = runonce;
m_fsim = new ForceSimulator();
m_fsim.addForce(new NBodyForce());
m_fsim.addForce(new SpringForce());
m_fsim.addForce(new DragForce());
//getForceSimulator().setSpeedLimit(.3f);//XXX: Tweak
}
示例2: ForceDirectedLayout
import prefuse.util.force.ForceSimulator; //导入方法依赖的package包/类
/**
* Create a new ForceDirectedLayout.
* @param group the data group to layout. Must resolve to a Graph instance.
* @param enforceBounds indicates whether or not the layout should require
* that all node placements stay within the layout bounds.
* @param runonce indicates if the layout will be run in a run-once or
* animated fashion. In run-once mode, the layout will run for a set number
* of iterations when invoked. In animation mode, only one iteration of the
* layout is computed.
*/
public ForceDirectedLayout(String group,
boolean enforceBounds, boolean runonce)
{
super(group);
m_nodeGroup = PrefuseLib.getGroupName(group, Graph.NODES);
m_edgeGroup = PrefuseLib.getGroupName(group, Graph.EDGES);
m_enforceBounds = enforceBounds;
m_runonce = runonce;
m_fsim = new ForceSimulator();
m_fsim.addForce(new NBodyForce());
m_fsim.addForce(new SpringForce());
m_fsim.addForce(new DragForce());
}
示例3: CodysFDR
import prefuse.util.force.ForceSimulator; //导入方法依赖的package包/类
/**
* Create a new ForceDirectedLayout.
* @param group the data group to layout. Must resolve to a Graph instance.
* @param enforceBounds indicates whether or not the layout should require
* that all node placements stay within the layout bounds.
* @param runonce indicates if the layout will be run in a run-once or
* animated fashion. In run-once mode, the layout will run for a set number
* of iterations when invoked. In animation mode, only one iteration of the
* layout is computed.
*/
public CodysFDR(String group,
boolean enforceBounds, boolean runonce)
{
super(group);
m_nodeGroup = PrefuseLib.getGroupName(group, Graph.NODES);
m_edgeGroup = PrefuseLib.getGroupName(group, Graph.EDGES);
m_enforceBounds = enforceBounds;
m_runonce = runonce;
m_fsim = new ForceSimulator();
m_fsim.addForce(new NBodyForce());
m_fsim.addForce(new SpringForce());
m_fsim.addForce(new DragForce());
}
示例4: DLGVisualizer
import prefuse.util.force.ForceSimulator; //导入方法依赖的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");
}
示例5: ArgumentationGraphVisualizer
import prefuse.util.force.ForceSimulator; //导入方法依赖的package包/类
/**
* Instantiates a new argumentation graph visualizer.
*
* @param dx
* the dx
* @param dy
* the dy
* @param ag
* the ag
* @param dm
* the dm
* @throws FeatureTermException
* the feature term exception
*/
public ArgumentationGraphVisualizer(int dx, int dy, WArgumentationFramework ag, FTKBase dm) throws FeatureTermException {
// initialize display and data
super(new Visualization());
initDataGroups(ag);
// 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);
DefaultRendererFactory drf = new DefaultRendererFactory(nodeR, edgeR);
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));
int[] palette = new int[] { ColorLib.rgba(255, 200, 200, 150), ColorLib.rgba(200, 255, 200, 150), ColorLib.rgba(200, 200, 255, 150) };
// 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());
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 DragControl());
addControlListener(new ZoomControl());
addControlListener(new PanControl());
addControlListener(new ArgumentSelectControl(ag.getArguments(), dm, this));
// ActionList draw = new ActionList();
// draw.add(new GraphDistanceFilter(GRAPH, 50));
// m_vis.putAction("draw", draw);
// set things running
m_vis.run("layout");
}