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


Java EdgeRenderer类代码示例

本文整理汇总了Java中prefuse.render.EdgeRenderer的典型用法代码示例。如果您正苦于以下问题:Java EdgeRenderer类的具体用法?Java EdgeRenderer怎么用?Java EdgeRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EdgeRenderer类属于prefuse.render包,在下文中一共展示了EdgeRenderer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRendererFactory

import prefuse.render.EdgeRenderer; //导入依赖的package包/类
/** Sets renderers for {@link #NODES},{@link #EDGES}, {@link #AGGRS} and {@link #AGGR_DECORATORS} group. */
protected void setRendererFactory(){
	// draw aggregates as polygons with curved edges
	Renderer pr = new PolygonRenderer(Constants.POLY_TYPE_CURVE);
	((PolygonRenderer)pr).setCurveSlack(0.15f);  
	// draw node labels
	Renderer nlr = new LabelRenderer(NODE_NAME);
	((LabelRenderer)nlr).setRoundedCorner(10,10);				
	// set renderers to factory
	// nodes and egeds
	DefaultRendererFactory drf = new DefaultRendererFactory();
	drf.add(new InGroupPredicate(NODES),nlr);
	drf.add(new InGroupPredicate(AGGRS), pr);
	// edge direction 
	drf.add(new InGroupPredicate(EDGES), new EdgeRenderer(Constants.EDGE_TYPE_LINE,Constants.EDGE_ARROW_FORWARD));
	// decorators
	drf.add(new InGroupPredicate(AGGR_DECORATORS), new LabelRenderer(AGGRS_ID));
	m_vis.setRendererFactory(drf);
}
 
开发者ID:renespeck,项目名称:Cugar,代码行数:20,代码来源:AggregatePanel.java

示例2: createTreeVisualization

import prefuse.render.EdgeRenderer; //导入依赖的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;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:80,代码来源:HierarchyProcessor.java

示例3: DLGVisualizer

import prefuse.render.EdgeRenderer; //导入依赖的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

示例4: StackedGraphDisplay

import prefuse.render.EdgeRenderer; //导入依赖的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 );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:69,代码来源:StackedGraphDisplay.java

示例5: ArgumentationGraphVisualizer

import prefuse.render.EdgeRenderer; //导入依赖的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

示例6: initialiseTreeView

import prefuse.render.EdgeRenderer; //导入依赖的package包/类
@Override
public void initialiseTreeView(Tree t, Dimension size, String label, int orientation) {
    this.m_orientation = orientation;

    m_vis.add(tree, t);

    m_nodeRenderer = new LabelRenderer(null, "image");

    m_edgeRenderer = new EdgeRenderer(Constants.EDGE_TYPE_CURVE);
    m_edgeRenderer.setDefaultLineWidth(4);

    DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
    rf.add(new InGroupPredicate(treeEdges), m_edgeRenderer);
    m_vis.setRendererFactory(rf);

    int[] colorPalette = new int[]{ColorLib.rgb(51, 51, 51), ColorLib.rgb(51, 51, 51), ColorLib.rgb(51, 51, 51)};

    DataColorAction dataColorAction = new DataColorAction("tree.nodes", "type", Constants.NOMINAL, VisualItem.TEXTCOLOR, colorPalette);

    // colors
    ItemAction nodeColor = new WorkflowNodeColorAction(treeNodes);

    m_vis.putAction("textColor", dataColorAction);

    ItemAction edgeColor = new ColorAction(treeEdges,
            VisualItem.STROKECOLOR, ColorLib.rgba(51, 51, 51, 100));

    // quick repaint
    ActionList repaint = new ActionList();
    repaint.add(nodeColor);
    repaint.add(new RepaintAction());
    m_vis.putAction("repaint", repaint);

    // full paint
    ActionList fullPaint = new ActionList();
    fullPaint.add(nodeColor);
    m_vis.putAction("fullPaint", fullPaint);

    // create the tree layout action
    NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout(tree,
            m_orientation, 80, 70, 8);
    treeLayout.setLayoutAnchor(new Point2D.Double(size.width / 2, 15));
    m_vis.putAction("treeLayout", treeLayout);

    CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree,
            m_orientation);
    m_vis.putAction("subLayout", subLayout);

    createAndAddFilter(dataColorAction, nodeColor, edgeColor, treeLayout, subLayout);
    // animated transition
    createAnimation();
    // ensure size is reasonable!
    finaliseVisualizationSteps(size);
}
 
开发者ID:ISA-tools,项目名称:Automacron,代码行数:55,代码来源:WorkflowVisualisationTreeView.java


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