Package edu.uci.ics.jung.visualization.transform

Examples of edu.uci.ics.jung.visualization.transform.MutableTransformer


                    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()) &&
View Full Code Here


        vv.setGraphMouse(gm);
        vv.addMouseListener(this);

        // translate the layout panel down and across so that it is not hard up
        // against the side of the splitPane box.
        MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(
                        Layer.LAYOUT);
        modelTransformer.translate(25, 25);

        // setup the transformers for the visualisation
        e_eft = new EdgeFontTransformer<Object, Font>();
        e_elt = new EdgeLabelTransformer<Object, String>(vv);
        e_ept = new EdgePaintTransformer<Object, Paint>(new Color(40, 40, 40), Color.black, vv);
View Full Code Here

   * mouse wheel motion.
   */
    public void scale(VisualizationServer vv, float amount, Point2D from) {
       
        Point2D ivtfrom = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, from);
        MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
        modelTransformer.scale(amount, amount, ivtfrom);
        vv.repaint();
    }
View Full Code Here

   */
    public void mouseDragged(MouseEvent e) {
        VisualizationViewer<?,?> vv = (VisualizationViewer<?,?>)e.getSource();
        boolean accepted = checkModifiers(e);
        if(accepted) {
            MutableTransformer viewTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
            vv.setCursor(cursor);
            try {
                Point2D q = viewTransformer.inverseTransform(down);
                Point2D p = viewTransformer.inverseTransform(e.getPoint());
                float dx = (float) (p.getX()-q.getX());
                float dy = (float) (p.getY()-q.getY());
               
                viewTransformer.translate(dx, dy);
                down.x = e.getX();
                down.y = e.getY();
            } catch(RuntimeException ex) {
                System.err.println("down = "+down+", e = "+e);
                throw ex;
View Full Code Here

  protected AffineTransformer transformer;
 
  public AnnotationPaintable(RenderContext<?,?> rc, AnnotationRenderer annotationRenderer) {
    this.rc = rc;
    this.annotationRenderer = annotationRenderer;
    MutableTransformer mt = rc.getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
    if(mt instanceof AffineTransformer) {
      transformer = (AffineTransformer)mt;
    } else if(mt instanceof LensTransformer) {
      transformer = (AffineTransformer)((LensTransformer)mt).getDelegate();
    }
View Full Code Here

  public AnnotationManager(RenderContext<?,?> rc) {
    this.rc = rc;
    this.lowerAnnotationPaintable = new AnnotationPaintable(rc, annotationRenderer);
    this.upperAnnotationPaintable = new AnnotationPaintable(rc, annotationRenderer);
   
    MutableTransformer mt = rc.getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
    if(mt instanceof AffineTransformer) {
      transformer = (AffineTransformer)mt;
    } else if(mt instanceof LensTransformer) {
      transformer = (AffineTransformer)((LensTransformer)mt).getDelegate();
    }
View Full Code Here

    public void mouseDragged(MouseEvent e) {
        if(down == null) return;
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        boolean accepted = checkModifiers(e);
        if(accepted) {
            MutableTransformer modelTransformer =
              vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
            vv.setCursor(cursor);
            Point2D q = down;
            Point2D p = e.getPoint();
            float dx = (float) (p.getX()-q.getX());
            float dy = (float) (p.getY()-q.getY());

            Dimension d = vv.getSize();
            float shx = 2.f*dx/d.height;
            float shy = 2.f*dy/d.width;
            Point2D center = vv.getCenter();
            if(p.getX() < center.getX()) {
                shy = -shy;
            }
            if(p.getY() < center.getY()) {
                shx = -shx;
            }
            modelTransformer.shear(shx, shy, center);
            down.x = e.getX();
            down.y = e.getY();
       
            e.consume();
        }
View Full Code Here

        if(accepted) {
            if(vv instanceof SatelliteVisualizationViewer) {
                VisualizationViewer vvMaster =
                    ((SatelliteVisualizationViewer)vv).getMaster();
               
                MutableTransformer modelTransformerMaster =
                  vvMaster.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

                vv.setCursor(cursor);
                Point2D q = down;
                Point2D p = e.getPoint();
                float dx = (float) (p.getX()-q.getX());
                float dy = (float) (p.getY()-q.getY());

                Dimension d = vv.getSize();
                float shx = 2.f*dx/d.height;
                float shy = 2.f*dy/d.width;
                // I want to compute shear based on the view coordinates of the
                // lens center in the satellite view.
                // translate the master view center to layout coords, then translate
                // that point to the satellite view's view coordinate system....
                Point2D center = vv.getRenderContext().getMultiLayerTransformer().transform(vvMaster.getRenderContext().getMultiLayerTransformer().inverseTransform(vvMaster.getCenter()));
                if(p.getX() < center.getX()) {
                    shy = -shy;
                }
                if(p.getY() < center.getY()) {
                    shx = -shx;
                }
                modelTransformerMaster.shear(-shx, -shy, vvMaster.getCenter());

                down.x = e.getX();
                down.y = e.getY();
            }
            e.consume();
View Full Code Here

     * to the system 'move cursor'
     * @param e the event
     */
    public void mousePressed(MouseEvent e) {
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        MutableTransformer vt = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
        if(vt instanceof LensTransformer) {
          vt = ((LensTransformer)vt).getDelegate();
        }
        Point2D p = vt.inverseTransform(e.getPoint());
        boolean accepted = checkModifiers(e);
        if(accepted) {
            vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT), p);
            testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW), p);
View Full Code Here

     * to the dragging of the mouse pointer
     * @param e the event
     */
    public void mouseDragged(MouseEvent e) {
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        MutableTransformer vt = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
        if(vt instanceof LensTransformer) {
          vt = ((LensTransformer)vt).getDelegate();
        }
        Point2D p = vt.inverseTransform(e.getPoint());
        boolean accepted = checkModifiers(e);

        if(accepted ) {
            MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
            vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            if(dragOnLens) {
                setViewCenter(modelTransformer, p);
                setViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW), p);
                e.consume();
                vv.repaint();

            } else if(dragOnEdge) {

                setViewRadius(modelTransformer, p);
                setViewRadius(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW), p);
                e.consume();
                vv.repaint();
               
            } else {
             
              MutableTransformer mt = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
                Point2D iq = vt.inverseTransform(down);
                iq = mt.inverseTransform(iq);
                Point2D ip = vt.inverseTransform(e.getPoint());
                ip = mt.inverseTransform(ip);
                float dx = (float) (ip.getX()-iq.getX());
                float dy = (float) (ip.getY()-iq.getY());
               
                modelTransformer.translate(dx, dy);
                down.x = e.getX();
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.visualization.transform.MutableTransformer

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.