Package edu.uci.ics.jung.algorithms.layout.util

Examples of edu.uci.ics.jung.algorithms.layout.util.VisRunner


     * This method will animate the transition between two layouts.
     *
     */
    private void animateLayoutChanges() {
        if (!(layout instanceof CircleLayout)) {
            Relaxer relaxer = new VisRunner((IterativeContext) layout);
            relaxer.stop();
            relaxer.prerelax();
            StaticLayout<Object, Object> staticLayout = new StaticLayout<Object, Object>(g, layout);
            LayoutTransition<Object, Object> lt = new LayoutTransition<Object, Object>(vv, vv.getGraphLayout(),
                            staticLayout);
            Animator animator = new Animator(lt);
            animator.start();
View Full Code Here


        }
      }});

    elayout.setSize(new BoundingSphere(new Point3d(), 200));
    elayout.initialize();
    VisRunner runner = new VisRunner((IterativeContext)elayout);
    runner.relax();

//    for(int i=0; i<objTrans.numChildren(); i++) {
//      System.err.println("objTrans child ["+i+"] is "+objTrans.getChild(i));
//    }
View Full Code Here

          relaxer = null;
        }
        if(layout instanceof IterativeContext) {
          layout.initialize();
            if(relaxer == null) {
              relaxer = new VisRunner((IterativeContext)this.layout);
              relaxer.prerelax();
              relaxer.relax();
            }
        }
        fireStateChanged();
View Full Code Here

  public LayoutTransition(VisualizationViewer<V,E> vv, Layout<V, E> startLayout, Layout<V, E> endLayout) {
    this.vv = vv;
    this.startLayout = startLayout;
    this.endLayout = endLayout;
    if(endLayout instanceof IterativeContext) {
      Relaxer relaxer = new VisRunner((IterativeContext)endLayout);
      relaxer.prerelax();
    }
    this.transitionLayout =
      new StaticLayout<V,E>(startLayout.getGraph(), startLayout);
    vv.setGraphLayout(transitionLayout);
  }
View Full Code Here

                v_prev = v1;

                layout.initialize();

            Relaxer relaxer = new VisRunner((IterativeContext)layout);
            relaxer.stop();
            relaxer.prerelax();
            StaticLayout<Number,Number> staticLayout =
              new StaticLayout<Number,Number>(g, layout);
        LayoutTransition<Number,Number> lt =
          new LayoutTransition<Number,Number>(vv, vv.getGraphLayout(),
              staticLayout);
View Full Code Here

      }});
        this.g = og;
        //create a graphdraw
        layout = new FRLayout<Number,Number>(g);
        layout.setSize(new Dimension(600,600));
    Relaxer relaxer = new VisRunner((IterativeContext)layout);
    relaxer.stop();
    relaxer.prerelax();

    Layout<Number,Number> staticLayout =
      new StaticLayout<Number,Number>(g, layout);

        vv = new VisualizationViewer<Number,Number>(staticLayout, new Dimension(600,600));

        JRootPane rp = this.getRootPane();
        rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().setBackground(java.awt.Color.lightGray);
        getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

        vv.setGraphMouse(new DefaultModalGraphMouse<Number,Number>());

        vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
        vv.setForeground(Color.white);

        vv.addComponentListener(new ComponentAdapter() {

      /**
       * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
       */
      @Override
      public void componentResized(ComponentEvent arg0) {
        super.componentResized(arg0);
        System.err.println("resized");
        layout.setSize(arg0.getComponent().getSize());
      }});

        getContentPane().add(vv);
        switchLayout = new JButton("Switch to SpringLayout");
        switchLayout.addActionListener(new ActionListener() {

            @SuppressWarnings("unchecked")
            public void actionPerformed(ActionEvent ae) {
              Dimension d = vv.getSize();//new Dimension(600,600);
                if (switchLayout.getText().indexOf("Spring") > 0) {
                    switchLayout.setText("Switch to FRLayout");
                    layout =
                      new SpringLayout<Number,Number>(g, new ConstantTransformer(EDGE_LENGTH));
                    layout.setSize(d);
                Relaxer relaxer = new VisRunner((IterativeContext)layout);
                relaxer.stop();
                relaxer.prerelax();
                StaticLayout<Number,Number> staticLayout =
                  new StaticLayout<Number,Number>(g, layout);
            LayoutTransition<Number,Number> lt =
              new LayoutTransition<Number,Number>(vv, vv.getGraphLayout(),
                  staticLayout);
            Animator animator = new Animator(lt);
            animator.start();
          //  vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
            vv.repaint();

                } else {
                    switchLayout.setText("Switch to SpringLayout");
                    layout = new FRLayout<Number,Number>(g, d);
                    layout.setSize(d);
                Relaxer relaxer = new VisRunner((IterativeContext)layout);
                relaxer.stop();
                relaxer.prerelax();
                StaticLayout<Number,Number> staticLayout =
                  new StaticLayout<Number,Number>(g, layout);
            LayoutTransition<Number,Number> lt =
              new LayoutTransition<Number,Number>(vv, vv.getGraphLayout(),
                  staticLayout);
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.algorithms.layout.util.VisRunner

Copyright © 2018 www.massapicom. 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.