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


Java PluggableRenderer类代码示例

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


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

示例1: ViewLensSupport

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
public ViewLensSupport(VisualizationViewer vv, LensTransformer lensTransformer,
        ModalGraphMouse lensGraphMouse) {
    super(vv, lensGraphMouse);
    this.renderer = vv.getRenderer();
    this.lensTransformer = lensTransformer;
    Dimension d = vv.getSize();
    if(d.width == 0 || d.height == 0) {
        d = vv.getPreferredSize();
    }
    lensTransformer.setViewRadius(d.width/5);

    if(renderer instanceof PluggableRenderer) {
        this.pluggableRenderer = (PluggableRenderer)renderer;
    } else {
        this.pluggableRenderer = new PluggableRenderer();
    }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:18,代码来源:ViewLensSupport.java

示例2: main

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	JFrame jf = new JFrame();
	Graph g = getGraph();
       VisualizationViewer vv = new VisualizationViewer(new SpringLayout(g), new PluggableRenderer());
       jf.getContentPane().add(vv);
	jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	jf.pack();
       jf.setVisible(true);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:10,代码来源:SimpleGraphDraw.java

示例3: GraphPreviewPanel

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
/**
 * create an instance of a simple graph with controls to demo the zoom features.
 *
 * @param peopleList
 *            the people list
 * @param links
 *            the links
 * @throws UNISoNException
 *             the UNI so n exception
 */
public GraphPreviewPanel(final LinkedList<String> peopleList, final List<Relationship> links)
        throws UNISoNException {
	// create a simple graph for the demo
	this.graph = new DirectedSparseGraph();
	final Vertex[] v = this.createEdges(links, peopleList);

	final PluggableRenderer pr = new PluggableRenderer();
	pr.setVertexStringer(new UnicodeVertexStringer(v, peopleList));
	pr.setVertexPaintFunction(
	        new PickableVertexPaintFunction(pr, Color.lightGray, Color.white, Color.yellow));
	pr.setGraphLabelRenderer(new DefaultGraphLabelRenderer(Color.cyan, Color.cyan));
	final VertexIconAndShapeFunction dvisf = new VertexIconAndShapeFunction(
	        new EllipseVertexShapeFunction());
	pr.setVertexShapeFunction(dvisf);
	pr.setVertexIconFunction(dvisf);
	this.vv = new VisualizationViewer(new FRLayout(this.graph), pr);
	this.vv.setPickSupport(new ShapePickSupport());
	pr.setEdgeShapeFunction(new EdgeShape.QuadCurve());
	this.vv.setBackground(Color.white);

	// add my listener for ToolTips
	this.vv.setToolTipFunction(new DefaultToolTipFunction());

	// create a frome to hold the graph
	final GraphZoomScrollPane panel = new GraphZoomScrollPane(this.vv);
	this.add(panel);
	// this.add(vv);
	final ModalGraphMouse gm = new DefaultModalGraphMouse();
	this.vv.setGraphMouse(gm);

	// showLabels = true;
}
 
开发者ID:leonarduk,项目名称:unison,代码行数:43,代码来源:GraphPreviewPanel.java

示例4: main

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	JFrame jf = new JFrame();
	Graph g = getGraph();
       VisualizationViewer vv = new VisualizationViewer(new edu.uci.ics.jung.visualization.contrib.KKLayout(g), new PluggableRenderer());
       jf.getContentPane().add(vv);
	jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	jf.pack();
       jf.setVisible(true);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:10,代码来源:SimpleGraphDraw.java

示例5: startFunction

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
public JPanel startFunction() {
    Graph g = getGraph();
    
    pr = new PluggableRenderer();
    Layout layout = new FRLayout(g);
    vv = new VisualizationViewer(layout, pr);
    // add Shape based pick support
    vv.setPickSupport(new ShapePickSupport());
    PickedState picked_state = vv.getPickedState();
    
    affineTransformer = vv.getLayoutTransformer();
    
    // create decorators
    vcf = new SeedColor(picked_state);
    ewcs = 
        new EdgeWeightStrokeFunction(edge_weight);
    vsh = new VertexStrokeHighlight(picked_state);
    ff = new FontHandler();
    vs_none = new ConstantVertexStringer(null);
    es_none = new ConstantEdgeStringer(null);
    vssa = new VertexShapeSizeAspect(voltages);
    show_edge = new DirectionDisplayPredicate(true, true);
    show_arrow = new DirectionDisplayPredicate(true, false);
    show_vertex = new VertexDisplayPredicate(false);

    // uses a gradient edge if unpicked, otherwise uses picked selection
    edgePaint = new GradientPickedEdgePaintFunction( new PickableEdgePaintFunction(picked_state,Color.black,Color.cyan), 
            vv, vv, picked_state);
    
    pr.setVertexPaintFunction(vcf);
    pr.setVertexStrokeFunction(vsh);
    pr.setVertexStringer(vs_none);
    pr.setVertexFontFunction(ff);
    pr.setVertexShapeFunction(vssa);
    pr.setVertexIncludePredicate(show_vertex);
    
    pr.setEdgePaintFunction( edgePaint );
    pr.setEdgeStringer(es_none);
    pr.setEdgeFontFunction(ff);
    pr.setEdgeStrokeFunction(ewcs);
    pr.setEdgeIncludePredicate(show_edge);
    pr.setEdgeShapeFunction(new EdgeShape.Line());
    pr.setEdgeArrowPredicate(show_arrow);
    JPanel jp = new JPanel();
    jp.setLayout(new BorderLayout());
    
    vv.setBackground(Color.white);
    GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
    jp.add(scrollPane);
    gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);
    gm.add(new PopupGraphMousePlugin());

    addBottomControls( jp );
    vssa.setScaling(true);

    vv.setToolTipFunction(new VoltageTips());
    vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");
    

    
    return jp;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:64,代码来源:PluggableRendererDemo.java

示例6: PluggableRendererDecorator

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
public PluggableRendererDecorator(PluggableRenderer delegate) {
    this.delegate = delegate;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:4,代码来源:PluggableRendererDecorator.java

示例7: getDelegate

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
/**
 * @return Returns the delegate.
 */
public PluggableRenderer getDelegate() {
    return delegate;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:7,代码来源:PluggableRendererDecorator.java

示例8: setDelegate

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
/**
 * @param delegate The delegate to set.
 */
public void setDelegate(PluggableRenderer delegate) {
    this.delegate = delegate;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:7,代码来源:PluggableRendererDecorator.java

示例9: TransformingPluggableRenderer

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
/**
 * create an instance
 *
 */
public TransformingPluggableRenderer(PluggableRenderer delegate) {
    super(delegate);
    this.transformer = new MutableAffineTransformer();
    this.tg2d = new TransformingGraphics(transformer);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:10,代码来源:TransformingPluggableRenderer.java

示例10: labelEdge

import edu.uci.ics.jung.visualization.PluggableRenderer; //导入依赖的package包/类
/**
 * overloaded to use TransformingGraphics
 * @param g2d
 * @param e
 * @param label
 * @param x1
 * @param x2
 * @param y1
 * @param y2
 */
protected void labelEdge(TransformingGraphics g2d, Edge e, String label, int x1, int x2, int y1, int y2) 
{
    Point2D p = g2d.getTransformer().transform(new Point2D.Float(x1, y1));
    Point2D q = g2d.getTransformer().transform(new Point2D.Float(x2, y2));
    x1 = (int)p.getX();
    y1 = (int)p.getY();
    x2 = (int)q.getX();
    y2 = (int)q.getY();
    
    int distX = x2 - x1;
    int distY = y2 - y1;
    double totalLength = Math.sqrt(distX * distX + distY * distY);

    double closeness = getEdgeLabelClosenessFunction().getNumber(e).doubleValue();

    int posX = (int) (x1 + (closeness) * distX);
    int posY = (int) (y1 + (closeness) * distY);

    int xDisplacement = (int) (PluggableRenderer.LABEL_OFFSET * (distY / totalLength));
    int yDisplacement = (int) (PluggableRenderer.LABEL_OFFSET * (-distX / totalLength));
    
    Component component = prepareRenderer(getGraphLabelRenderer(), label, isPicked(e), e);
    Dimension d = component.getPreferredSize();
    
    Font font = getEdgeFontFunction().getFont(e);
    if(font != null)
        component.setFont(font);    
    
    Shape edgeShape = getEdgeShapeFunction().getShape(e);
    
    double parallelOffset = 1;
    Integer parallelCount = (Integer)e.getUserDatum("parallelCount");
    if(parallelCount != null) {
        parallelOffset += parallelCount.intValue();
    }

    if(edgeShape instanceof Ellipse2D) {
        parallelOffset += edgeShape.getBounds().getHeight();
        parallelOffset = -parallelOffset;
    }
    
    parallelOffset *= d.height;
    
    AffineTransform old = g2d.getTransform();
    AffineTransform xform = new AffineTransform(old);
    xform.translate(posX+xDisplacement, posY+yDisplacement);
    if(getGraphLabelRenderer().isRotateEdgeLabels()) {
        // float thetaRadians = (float) Math.atan2(dy, dx);
        double dx = x2 - x1;
        double dy = y2 - y1;
        double theta = Math.atan2(dy, dx);
        if(dx < 0) {
            theta += Math.PI;
            parallelOffset = -parallelOffset;
        }
        xform.rotate(theta);
    }
    
    xform.translate(-d.width/2, -(d.height/2-parallelOffset));
    g2d.setTransform(xform);
    getRendererPane().paintComponent(g2d.getDelegate(), component, getScreenDevice(), 
            0, 0,
            d.width, d.height, true);
    g2d.setTransform(old);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:76,代码来源:TransformingPluggableRenderer.java


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