本文整理汇总了Java中prefuse.util.force.ForceSimulator类的典型用法代码示例。如果您正苦于以下问题:Java ForceSimulator类的具体用法?Java ForceSimulator怎么用?Java ForceSimulator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ForceSimulator类属于prefuse.util.force包,在下文中一共展示了ForceSimulator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:codydunne,项目名称:netgrok,代码行数:31,代码来源:PolarDonutFDRLayout.java
示例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());
}
开发者ID:luox12,项目名称:onecmdb,代码行数:25,代码来源:ForceDirectedLayout.java
示例3: initSimulator
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
/**
* Loads the simulator with all relevant force items and springs.
* @param fsim the force simulator driving this layout
*/
protected void initSimulator(ForceSimulator fsim) {
// make sure we have force items to work with
TupleSet ts = m_vis.getGroup(m_nodeGroup);
if ( ts == null ) return;
try {
ts.addColumns(FORCEITEM_SCHEMA);
} catch ( IllegalArgumentException iae ) { /* ignored */ }
float startX = (referrer == null ? 0f : (float)referrer.getX());
float startY = (referrer == null ? 0f : (float)referrer.getY());
startX = Float.isNaN(startX) ? 0f : startX;
startY = Float.isNaN(startY) ? 0f : startY;
Iterator iter = m_vis.visibleItems(m_nodeGroup);
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
ForceItem fitem = (ForceItem)item.get(FORCEITEM);
fitem.mass = getMassValue(item);
double x = item.getEndX();
double y = item.getEndY();
fitem.location[0] = (Double.isNaN(x) ? startX : (float)x);
fitem.location[1] = (Double.isNaN(y) ? startY : (float)y);
fsim.addItem(fitem);
}
if ( m_edgeGroup != null ) {
iter = m_vis.visibleItems(m_edgeGroup);
while ( iter.hasNext() ) {
EdgeItem e = (EdgeItem)iter.next();
NodeItem n1 = e.getSourceItem();
ForceItem f1 = (ForceItem)n1.get(FORCEITEM);
NodeItem n2 = e.getTargetItem();
ForceItem f2 = (ForceItem)n2.get(FORCEITEM);
float coeff = getSpringCoefficient(e);
float slen = getSpringLength(e);
fsim.addSpring(f1, f2, (coeff>=0?coeff:-1.f), (slen>=0?slen:-1.f));
}
}
}
开发者ID:luox12,项目名称:onecmdb,代码行数:43,代码来源:ForceDirectedLayout.java
示例4: 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());
}
开发者ID:codydunne,项目名称:netgrok,代码行数:25,代码来源:CodysFDR.java
示例5: 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");
}
开发者ID:santiontanon,项目名称:RHOG,代码行数:72,代码来源:DLGVisualizer.java
示例6: MyForcedDirectedLayout
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
public MyForcedDirectedLayout(String graph, ForceSimulator fsim) {
super(graph, fsim, false);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:4,代码来源:MyForcedDirectedLayout.java
示例7: 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");
}
开发者ID:santiontanon,项目名称:fterm,代码行数:79,代码来源:ArgumentationGraphVisualizer.java
示例8: getForceSimulator
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
/**
* Get the force simulator driving this layout.
* @return the force simulator
*/
public ForceSimulator getForceSimulator() {
return m_fsim;
}
开发者ID:luox12,项目名称:onecmdb,代码行数:8,代码来源:ForceDirectedLayout.java
示例9: setForceSimulator
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
/**
* Set the force simulator driving this layout.
* @param fsim the force simulator
*/
public void setForceSimulator(ForceSimulator fsim) {
m_fsim = fsim;
}
开发者ID:luox12,项目名称:onecmdb,代码行数:8,代码来源:ForceDirectedLayout.java
示例10: getForceSimulator
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
/**
* Get the force simulator driving this layout.
* @return the force simulator
*/
public ForceSimulator getForceSimulator() {
return m_fsim;
}
开发者ID:codydunne,项目名称:netgrok,代码行数:8,代码来源:PolarDonutFDRLayout.java
示例11: setForceSimulator
import prefuse.util.force.ForceSimulator; //导入依赖的package包/类
/**
* Set the force simulator driving this layout.
* @param fsim the force simulator
*/
public void setForceSimulator(ForceSimulator fsim) {
m_fsim = fsim;
}
开发者ID:codydunne,项目名称:netgrok,代码行数:8,代码来源:PolarDonutFDRLayout.java
注:本文中的prefuse.util.force.ForceSimulator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论