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


Java MutableTransformer类代码示例

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


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

示例1: centerVisualization

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
public void centerVisualization(V vertex, final boolean immediate) {
    if (vertex != null) {
        Layout<V,E> layout = this.getGraphLayout();
        Point2D q = layout.transform(vertex);
        Point2D lvc = this.getRenderContext().getMultiLayerTransformer().inverseTransform(this.getCenter());
        final int steps = (immediate ? 1 : 10);
        final double dx = (lvc.getX() - q.getX()) / steps;
        final double dy = (lvc.getY() - q.getY()) / steps;

        new Thread() {
            public void run() {
                MutableTransformer transformer = GraphVisualizationPanel.this.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT); 
                for (int i = 0; i < steps; i++) {
                    transformer.translate(dx, dy);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException ex) {
                    }
                }
            }
        }.start();
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:GraphVisualizationPanel.java

示例2: vertexHit

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
protected boolean vertexHit(RenderContext<V, E> rc, Shape s) {
	JComponent vv = rc.getScreenDevice();
	Rectangle deviceRectangle = null;
	if (vv != null) {
		Dimension d = vv.getSize();
		deviceRectangle = new Rectangle(0, 0, d.width, d.height);
	}
	if (deviceRectangle != null) {
		MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
		if (vt instanceof MutableTransformerDecorator) {
			vt = ((MutableTransformerDecorator) vt).getDelegate();
		}
		return vt.transform(s).intersects(deviceRectangle);
	} else {
		return false;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:18,代码来源:TreeModelNodeRenderer.java

示例3: paint

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
public void paint(Graphics g) {
	g.setColor(Color.gray);

	Graphics2D g2d = (Graphics2D)g;

	Ellipse2D ellipse = new Ellipse2D.Double();
	for(String v : layout.getGraph().getVertices()) {
		Double radius = layout.getRadii().get(v);
		if(radius == null) continue;
		Point2D p = layout.transform(v);
		ellipse.setFrame(-radius, -radius, 2*radius, 2*radius);
		AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY());
		Shape shape = at.createTransformedShape(ellipse);
		
		MutableTransformer viewTransformer =
			vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
		
		if(viewTransformer instanceof MutableTransformerDecorator) {
			shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
		} else {
			shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT,shape);
		}

		g2d.draw(shape);
	}
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:27,代码来源:BalloonLayoutDemo.java

示例4: mouseClicked

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
	if (e.getButton() == MouseEvent.BUTTON1 && (plusFocused || minusFocused)) {
		Point2D center = viewer.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW,
				viewer.getCenter());
		MutableTransformer transformer = viewer.getRenderContext().getMultiLayerTransformer()
				.getTransformer(Layer.LAYOUT);

		if (plusFocused) {
			transformer.scale(zoomFactor, zoomFactor, center);
			viewer.repaint();
		} else if (minusFocused) {
			transformer.scale(1 / zoomFactor, 1 / zoomFactor, center);
			viewer.repaint();
		}

		Stream.of(listeners.getListeners(JungListener.class)).forEach(l -> l.transformFinished());
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:20,代码来源:ZoomingPaintable.java

示例5: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	if (down != null) {
		MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer()
				.getTransformer(Layer.LAYOUT);
		Point2D p1 = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
		Point2D p2 = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());

		modelTransformer.translate(p2.getX() - p1.getX(), p2.getY() - p1.getY());
		down = e.getPoint();
		vv.repaint();

		changed = true;
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:18,代码来源:BetterTranslatingGraphMousePlugin.java

示例6: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
   * check the modifiers. If accepted, use the mouse drag motion
   * to rotate the graph
*/
  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);
          // rotate
          vv.setCursor(cursor);
          
          Point2D center = vv.getCenter();
          Point2D q = down;
          Point2D p = e.getPoint();
          Point2D v1 = new Point2D.Double(center.getX()-p.getX(), center.getY()-p.getY());
          Point2D v2 = new Point2D.Double(center.getX()-q.getX(), center.getY()-q.getY());
          double theta = angleBetween(v1, v2);
          modelTransformer.rotate(theta, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, center));
          down.x = e.getX();
          down.y = e.getY();
      
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:28,代码来源:RotatingGraphMousePlugin.java

示例7: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  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;
          }
      
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:29,代码来源:ViewTranslatingGraphMousePlugin.java

示例8: mouseWheelMoved

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
* zoom the display in or out, depending on the direction of the
* mouse wheel motion.
*/
  public void mouseWheelMoved(MouseWheelEvent e) {
      boolean accepted = checkModifiers(e);
      float delta = this.delta;
      if(accepted == true) {
          VisualizationViewer vv = (VisualizationViewer)e.getSource();
          MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          MutableTransformer viewTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
          int amount = e.getWheelRotation();
          if(amount < 0) {
              delta = -delta;
          }
          changeMagnification(modelTransformer, delta);
          changeMagnification(viewTransformer, delta);
          vv.repaint();
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:22,代码来源:LensMagnificationGraphMousePlugin.java

示例9: scale

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
 * scale to the absolute value passed as 'amount'.
 * 
 */
public void scale(VisualizationViewer<?,?> vv, float amount, Point2D at) {
    MutableTransformer layoutTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
    MutableTransformer viewTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
    double modelScale = layoutTransformer.getScale();
    double viewScale = viewTransformer.getScale();
    double inverseModelScale = Math.sqrt(crossover)/modelScale;
    double inverseViewScale = Math.sqrt(crossover)/viewScale;
    
    Point2D transformedAt = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, at);
    
    // return the transformers to 1.0
    layoutTransformer.scale(inverseModelScale, inverseModelScale, transformedAt);
    viewTransformer.scale(inverseViewScale, inverseViewScale, at);

    super.scale(vv, amount, at);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:21,代码来源:AbsoluteCrossoverScalingControl.java

示例10: mousePressed

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
 * Check the event modifiers. Set the 'down' point for later
 * use. If this event satisfies the modifiers, change the cursor
 * 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);
        vv.repaint();
    }
    super.mousePressed(e);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:23,代码来源:LensTranslatingGraphMousePlugin.java

示例11: testViewCenter

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
 * called to set up translating the lens center or changing the size
 * @param transformer
 * @param point
 */
private void testViewCenter(MutableTransformer transformer, Point2D point) {
    if(transformer instanceof LensTransformer) {
        LensTransformer ht =
            (LensTransformer)transformer;
        double distanceFromCenter = ht.getDistanceFromCenter(point);
        if(distanceFromCenter < 10) {
            ht.setViewCenter(point);
            dragOnLens = true;
        } else if(Math.abs(distanceFromCenter - ht.getViewRadius()) < 10) {
            edgeOffset = ht.getViewRadius() - distanceFromCenter;
            ht.setViewRadius(distanceFromCenter+edgeOffset);
            dragOnEdge = true;
        }
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:21,代码来源:LensTranslatingGraphMousePlugin.java

示例12: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          vv.setCursor(cursor);
          try {
              Point2D q = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
              Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
              float dx = (float) (p.getX()-q.getX());
              float dy = (float) (p.getY()-q.getY());
              
              modelTransformer.translate(dx, dy);
              down.x = e.getX();
              down.y = e.getY();
          } catch(RuntimeException ex) {
              System.err.println("down = "+down+", e = "+e);
              throw ex;
          }
      
          e.consume();
          vv.repaint();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:30,代码来源:TranslatingGraphMousePlugin.java

示例13: vertexHit

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
protected boolean vertexHit(RenderContext<V,E> rc, Shape s) {
    JComponent vv = rc.getScreenDevice();
    Rectangle deviceRectangle = null;
    if(vv != null) {
        Dimension d = vv.getSize();
        deviceRectangle = new Rectangle(
                0,0,
                d.width,d.height);
    }
    if (deviceRectangle != null) {
    	MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
    	if(vt instanceof MutableTransformerDecorator) {
    		vt = ((MutableTransformerDecorator)vt).getDelegate();
    	}
    	return vt.transform(s).intersects(deviceRectangle);
    } else {
    	return false;
    }
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:20,代码来源:TreeModelNodeRenderer.java

示例14: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
   * check the modifiers. If accepted, use the mouse drag motion
   * to rotate the graph
*/
  public void mouseDragged(MouseEvent e) {
      if(down == null) return;
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer =
              vv.getLayoutTransformer();
          // rotate
          vv.setCursor(cursor);
          
          Point2D center = vv.getCenter();
          Point2D q = down;
          Point2D p = e.getPoint();
          Point2D v1 = new Point2D.Double(center.getX()-p.getX(), center.getY()-p.getY());
          Point2D v2 = new Point2D.Double(center.getX()-q.getX(), center.getY()-q.getY());
          double theta = angleBetween(v1, v2);
          modelTransformer.rotate(theta, vv.inverseViewTransform(center));
          down.x = e.getX();
          down.y = e.getY();
      
          e.consume();
      }
  }
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:28,代码来源:RotatingGraphMousePlugin.java

示例15: mouseDragged

import edu.uci.ics.jung.visualization.transform.MutableTransformer; //导入依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer viewTransformer = vv.getViewTransformer();
          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;
          }
      
          e.consume();
      }
  }
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:29,代码来源:ViewTranslatingGraphMousePlugin.java


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