当前位置: 首页>>代码示例>>Java>>正文


Java ForceSimulator.addForce方法代码示例

本文整理汇总了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
}
 
开发者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: 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

示例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");
    }
 
开发者ID:santiontanon,项目名称:RHOG,代码行数:72,代码来源:DLGVisualizer.java

示例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");
}
 
开发者ID:santiontanon,项目名称:fterm,代码行数:79,代码来源:ArgumentationGraphVisualizer.java


注:本文中的prefuse.util.force.ForceSimulator.addForce方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。