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


Java MutableTransformerDecorator类代码示例

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


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

示例1: vertexHit

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的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

示例2: paint

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的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

示例3: vertexHit

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的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

示例4: paint

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

	Graphics2D g2d = (Graphics2D)g;

	Ellipse2D ellipse = new Ellipse2D.Double();
	for(DBCMVertex v : (Iterable<DBCMVertex>) layout.getGraph().getVertices()) {
		Double radius = (Double) ((BalloonLayout)layout).getRadii().get(v);
		if(radius == null) continue;
		Point2D p = (Point2D) 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:SEMOSS,项目名称:semoss,代码行数:27,代码来源:BalloonLayoutRings.java

示例5: paint

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
	 * Method paint. Paints the rings on the graph.
	 *
	 * @param g Graphics - the graphics to be painted.
	 */
	@Override
	public void paint( Graphics g ) {
		Collection<Double> depths = getDepths();
		g.setColor( Color.gray );
		Graphics2D g2d = (Graphics2D) g;
		Point2D center = radialLayout.getCenter();

		Ellipse2D ellipse = new Ellipse2D.Double();
		for ( double d : depths ) {
			ellipse.setFrameFromDiagonal( center.getX() - d, center.getY() - d,
					center.getX() + d, center.getY() + d );
			AffineTransform at = AffineTransform.getTranslateInstance( 0, 0 );
			Shape shape = at.createTransformedShape( ellipse );
			//Shape shape = 
			//	vv.getRenderContext().getMultiLayerTransformer().transform(ellipse);
//				vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).transform(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:Ostrich-Emulators,项目名称:semtool,代码行数:35,代码来源:RadialTreeLayoutRings.java

示例6: paint

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
 * Method paint. Paints the rings on the graph.
 *
 * @param g Graphics - the graphics to be painted.
 */
@Override
public void paint( Graphics g ) {
	g.setColor( Color.gray );

	Graphics2D g2d = (Graphics2D) g;

	Ellipse2D ellipse = new Ellipse2D.Double();
	for ( SEMOSSVertex v : layout.getGraph().getVertices() ) {
		Double radius = layout.getRadii().get( v );
		if ( radius == null ) {
			continue;
		}
		Point2D p = layout.apply( 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:Ostrich-Emulators,项目名称:semtool,代码行数:36,代码来源:BalloonLayoutRings.java

示例7: getVertices

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
     * returns the vertices that are contained in the passed shape.
     * The shape is in screen coordinates, and the graph vertices
     * are transformed to screen coordinates before they are tested
     * for inclusion
     */
    public Collection<V> getVertices(Layout<V, E> layout, Shape rectangle) {
    	Set<V> pickedVertices = new HashSet<V>();
    	
//    	 remove the view transform from the rectangle
    	rectangle = ((MutableTransformerDecorator)vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)).getDelegate().inverseTransform(rectangle);

        while(true) {
            try {
                for(V v : getFilteredVertices(layout)) {
                    Point2D p = layout.transform(v);
                    if(p == null) continue;
                   	// get the shape
                    Shape shape = vv.getRenderContext().getVertexShapeTransformer().transform(v);

                    AffineTransform xform = 
                        AffineTransform.getTranslateInstance(p.getX(), p.getY());
                    shape = xform.createTransformedShape(shape);
                    
                    shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
                    Rectangle2D bounds = shape.getBounds2D();
                    p.setLocation(bounds.getCenterX(),bounds.getCenterY());

                    if(rectangle.contains(p)) {
                    	pickedVertices.add(v);
                    }
                }
                break;
            } catch(ConcurrentModificationException cme) {}
        }
        return pickedVertices;
    }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:38,代码来源:ViewLensShapePickSupport.java

示例8: vertexHit

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的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);
    }
    MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
    if(vt instanceof MutableTransformerDecorator) {
    	vt = ((MutableTransformerDecorator)vt).getDelegate();
    }
    return vt.transform(s).intersects(deviceRectangle);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:16,代码来源:BasicVertexRenderer.java

示例9: paint

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
public void paint(Graphics g) {
		getDepths();
		g.setColor(Color.gray);
		Graphics2D g2d = (Graphics2D)g;
		Point2D center = radialLayout.getCenter();

		Ellipse2D ellipse = new Ellipse2D.Double();
		for(double d : depths) {
			ellipse.setFrameFromDiagonal(center.getX()-d, center.getY()-d, 
					center.getX()+d, center.getY()+d);
			AffineTransform at = AffineTransform.getTranslateInstance(0, 0);
			Shape shape = at.createTransformedShape(ellipse);
			//Shape shape = 
			//	vv.getRenderContext().getMultiLayerTransformer().transform(ellipse);
//				vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).transform(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:SEMOSS,项目名称:semoss,代码行数:28,代码来源:RadialTreeLayoutRings.java

示例10: getVertex

import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/** 
 * Iterates over Vertices, checking to see if x,y is contained in the
 * Vertex's Shape. If (x,y) is contained in more than one vertex, use
 * the vertex whose center is closest to the pick point.
 * @see edu.uci.ics.jung.visualization.picking.PickSupport#getVertex(double, double)
 */
public V getVertex(Layout<V, E> layout, double x, double y) {

    V closest = null;
    double minDistance = Double.MAX_VALUE;
    Point2D ip = ((MutableTransformerDecorator)vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)).getDelegate().inverseTransform(new Point2D.Double(x,y));
    x = ip.getX();
    y = ip.getY();

    while(true) {
        try {
            for(V v : getFilteredVertices(layout)) {
            	// get the shape
                Shape shape = vv.getRenderContext().getVertexShapeTransformer().transform(v);
                // transform the vertex location to screen coords
                Point2D p = layout.transform(v);
                if(p == null) continue;
                AffineTransform xform = 
                    AffineTransform.getTranslateInstance(p.getX(), p.getY());
                shape = xform.createTransformedShape(shape);
                
                // use the LAYOUT transform to move the shape center without
                // modifying the actual shape
                Point2D lp = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, p);
                AffineTransform xlate = AffineTransform.getTranslateInstance(
                		lp.getX()-p.getX(),lp.getY()-p.getY());
                shape = xlate.createTransformedShape(shape);
                // now use the VIEW transform to modify the actual shape
                
                shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.VIEW, shape);
                	//vv.getRenderContext().getMultiLayerTransformer().transform(shape);
                
                // see if this vertex center is closest to the pick point
                // among any other containing vertices
                if(shape.contains(x, y)) {

                	if(style == Style.LOWEST) {
                		// return the first match
                		return v;
                	} else if(style == Style.HIGHEST) {
                		// will return the last match
                		closest = v;
                	} else {
                		Rectangle2D bounds = shape.getBounds2D();
                		double dx = bounds.getCenterX() - x;
                		double dy = bounds.getCenterY() - y;
                		double dist = dx * dx + dy * dy;
                		if (dist < minDistance) {
                			minDistance = dist;
                			closest = v;
                		}
                	}
                }
            }
            break;
        } catch(ConcurrentModificationException cme) {}
    }
    return closest;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:65,代码来源:ViewLensShapePickSupport.java


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