Examples of VisualizationViewer


Examples of edu.uci.ics.jung.visualization.VisualizationViewer

     */
    public void addTab(String name) {
        JPanel jtmp = new JPanel();
        jtmp.setLayout(new java.awt.BorderLayout(5, 5));
       
        VisualizationViewer vv = (VisualizationViewer)_parent.getMap().getVV(name);
        if (vv != null) {
//            GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
            jtmp.add(vv);
            _parent.getJtabViews().add(name, jtmp);
            updateSatellitePanel();
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

     * Adds a new view in graphManager, you want to be sure that
     * there's a corresponding tab with the same name.
     * @param name The name for the new view
     */
    public void addNewView(String name) {
        VisualizationViewer vv = (VisualizationViewer)_parent.getMap().getVV(name);
        if (vv == null) {
            _parent.getMap().addView(name);
        }
    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

   
    private void setZoomControls() {
        final ScalingControl scaler = new CrossoverScalingControl();
        jBtnZoomPlus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VisualizationViewer vv = _parent.getMap().getVV(_parent.getNameSelectedTab());
                if (scaler != null && vv != null)
                    scaler.scale(vv, 1.1f, vv.getCenter());
            }
        });

        jBtnZoomMinus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VisualizationViewer vv = _parent.getMap().getVV(_parent.getNameSelectedTab());
                if (scaler != null && vv != null)
                    scaler.scale(vv, 0.9f, vv.getCenter());
            }
        })
    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

    /**
     * Changes the satellite panel show with the one corresponding to
     * the layout shown in the selected tab
     */
    public void updateSatellitePanel() {
        VisualizationViewer satellite = _parent.getMap().getVV(_parent.getNameSelectedTab() + "satellite");
        if (_parent.getJtabViews().getComponentCount() == 0) {
            jPanelSatellite.removeAll();
        }

        if (satellite != null) {
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

                if (v.isLoadView()) {
                    viewName = v.getName();
                    loadMap = true;
                    dontSend = true;
                   
                    VisualizationViewer vv = _graphManager.getVV(viewName);

                    double scale = v.getScale();
                    if (!Double.isNaN(scale) && vv != null) {
                            Point2D p = vv.getCenter();
                            double crossover = 1.0;
                            MutableTransformer modelTransformer = vv.getLayoutTransformer();
                            MutableTransformer viewTransformer = vv.getViewTransformer();
                            if(scale < crossover) {
                                viewTransformer.setScale(scale, scale, p);
                                modelTransformer.setScale(crossover, crossover, p);
                            } else {
                                modelTransformer.setScale(scale, scale, p);
                                viewTransformer.setScale(crossover, crossover, p)
                            }
                        dontSend = true;
                    }

                    if (! (Double.isNaN(v.getLayoutTranslateX()) &&
                        Double.isNaN(v.getLayoutTranslateX())) ) {
                        translateX = v.getLayoutTranslateX();
                        translateY = v.getLayoutTranslateY();
                        dontSend = true;

                        if (vv != null) {
                            vv.getLayoutTransformer().setTranslate(translateX, translateY);
                        }
                    }
                    if (! (Double.isNaN(v.getViewTranslateX()) &&
                        Double.isNaN(v.getViewTranslateX())) ) {
                        translateX = v.getViewTranslateX();
                        translateY = v.getViewTranslateY();
                        dontSend = true;

                        if (vv != null) {
                            vv.getViewTransformer().setTranslate(translateX, translateY);
                        }
                    }
                    if (v.getBackgroundImage().length() > 0) {
                        _graphManager.putBackground(viewName, v.getBackgroundImage());
                        _graphManager.addImagePreRenderer(viewName, _graphManager.getBackground(viewName));
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

    mapper = app.getMapper();

    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.YELLOW, 3));
    final VisualizationViewer vv = app.getVv();
    vv.setLayout(new BorderLayout());
    vv.setBackground(Color.white);
    // add a mouse listener to manage mouse event on graph element
    vv.setPickSupport(new ShapePickSupport(5));
    vv.addMouseListener(new XGrapherMouseListener(app, vv, mapper));
    vv.setGraphMouse(app.getModalGraphMouse());
    this.add(vv, BorderLayout.CENTER);
  }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

  /**
   *
   * @return VisualizationViewer
   */
  public static VisualizationViewer getG() {
    VisualizationViewer vv;
    try {
      g = getGraph();
      PluggableRenderer pr = new PluggableRenderer();

      vv = new VisualizationViewer(new TemporalSpringLayout(g,20), pr);
   

      return vv;
    } catch (IOException e) {

View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

    dataBindingClient = new DataBindingClient(app.getLoader());
    Graph g = dataBindingClient.getStartGraph();
    edu.uci.ics.jung.graph.Graph jungGraph = mapper.toJung(g);

                LengthFunction f = app.getRenderer().getLengthFunction() ;
                VisualizationViewer vv = null ;
                if ( f == null)
                    vv = new VisualizationViewer(
                                    new TemporalSpringLayout(jungGraph, 50), pr);
                else
                    vv = new VisualizationViewer(
                            new TemporalSpringLayout(jungGraph,f,50),pr);

    return vv;

  }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

            Edge e = new UndirectedSparseEdge(v1, v2);
            g.addEdge(e);
        }
        FRLayout l = new FRLayout(g);
        PluggableRenderer r = new PluggableRenderer();
        VisualizationViewer vv = new VisualizationViewer((Layout) l, r);

        VisualizationImageServer vis =
                new VisualizationImageServer((edu.uci.ics.jung.algorithms.layout.Layout) vv.getGraphLayout(), vv.getGraphLayout().getCurrentSize());

//        BufferedImage image = (BufferedImage) vis.getImage(
//                new Point2D.Double(vv.getGraphLayout().getCurrentSize().getWidth() / 2,
//                vv.getGraphLayout().getCurrentSize().getHeight() / 2),
//                new Dimension(vv.getGraphLayout().getCurrentSize()));
//
//        File outputfile = new File("graph.png");
//
//        try {
//            ImageIO.write(image, "png", outputfile);
//        } catch (IOException e) {
//            // Exception handling
//        }

    vv.setBackground(Color.BLUE);
    JPanel jpanel = new JPanel();
    jpanel.setPreferredSize(new Dimension(500, 500));
    jpanel.setSize(new Dimension(500, 500));
    jpanel.add(vv);
    System.out.println("Jpanel size " + jpanel.getWidth() + "   " + jpanel.getHeight());
View Full Code Here

Examples of edu.uci.ics.jung.visualization.VisualizationViewer

            if (vv == null) {
                //springlayout and 2, FRlayout
                //TODO: render to PDF

                vv = new VisualizationViewer(layout);
                //pnlJUNGView.add(vv, BorderLayout.CENTER);
            } else {
                vv.setGraphLayout(layout);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.