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


Java RenderContext.getVertexIconTransformer方法代码示例

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


在下文中一共展示了RenderContext.getVertexIconTransformer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paintIconForVertex

import edu.uci.ics.jung.visualization.RenderContext; //导入方法依赖的package包/类
/**
 * Paint <code>v</code>'s icon on <code>g</code> at <code>(x,y)</code>.
 */
protected void paintIconForVertex(RenderContext<V, E> rc, V v, Layout<V, E> layout) {
	GraphicsDecorator g = rc.getGraphicsContext();
	boolean vertexHit = true;
	// get the shape to be rendered
	Shape shape = rc.getVertexShapeTransformer().transform(v);

	Point2D p = layout.transform(v);
	p = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p);
	float x = (float) p.getX();
	float y = (float) p.getY();
	// create a transform that translates to the location of
	// the vertex to be rendered
	AffineTransform xform = AffineTransform.getTranslateInstance(x, y);
	// transform the vertex shape with xtransform
	shape = xform.createTransformedShape(shape);

	vertexHit = vertexHit(rc, shape);
	// rc.getViewTransformer().transform(shape).intersects(deviceRectangle);

	if (vertexHit) {
		if (rc.getVertexIconTransformer() != null) {
			Icon icon = rc.getVertexIconTransformer().transform(v);
			if (icon != null) {

				g.draw(icon, rc.getScreenDevice(), shape, (int) x, (int) y);

			} else {
				paintShapeForVertex(rc, v, shape);
			}
		} else {
			paintShapeForVertex(rc, v, shape);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:38,代码来源:TreeModelNodeRenderer.java

示例2: paintIconForVertex

import edu.uci.ics.jung.visualization.RenderContext; //导入方法依赖的package包/类
public void paintIconForVertex(RenderContext<V,E> rc, V v, Layout<V,E> layout) {
	
    Point2D p = layout.transform(v);
    p = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p);
    float x = (float)p.getX();
    float y = (float)p.getY();

    GraphicsDecorator g = rc.getGraphicsContext();
    boolean outlineImages = false;
    Transformer<V,Icon> vertexIconFunction = rc.getVertexIconTransformer();
    
    if(vertexIconFunction instanceof DemoVertexIconTransformer) {
        outlineImages = ((DemoVertexIconTransformer<V>)vertexIconFunction).isOutlineImages();
    }
    Icon icon = vertexIconFunction.transform(v);
    if(icon == null || outlineImages) {
        
        Shape s = AffineTransform.getTranslateInstance(x,y).
            createTransformedShape(rc.getVertexShapeTransformer().transform(v));
        paintShapeForVertex(rc, v, s);
    }
    if(icon != null) {
        int xLoc = (int) (x - icon.getIconWidth()/2);
        int yLoc = (int) (y - icon.getIconHeight()/2);
        icon.paintIcon(rc.getScreenDevice(), g.getDelegate(), xLoc, yLoc);
    }
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:28,代码来源:VertexImageShaperDemo.java

示例3: paintIconForVertex

import edu.uci.ics.jung.visualization.RenderContext; //导入方法依赖的package包/类
/**
 * Paint <code>v</code>'s icon on <code>g</code> at <code>(x,y)</code>.
 */
protected void paintIconForVertex(RenderContext<V,E> rc, V v, Layout<V,E> layout) {
    GraphicsDecorator g = rc.getGraphicsContext();
    boolean vertexHit = true;
    // get the shape to be rendered
    Shape shape = rc.getVertexShapeTransformer().transform(v);
    
    Point2D p = layout.transform(v);
    p = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p);
    float x = (float)p.getX();
    float y = (float)p.getY();
    // create a transform that translates to the location of
    // the vertex to be rendered
    AffineTransform xform = AffineTransform.getTranslateInstance(x,y);
    // transform the vertex shape with xtransform
    shape = xform.createTransformedShape(shape);
    
    vertexHit = vertexHit(rc, shape);
        //rc.getViewTransformer().transform(shape).intersects(deviceRectangle);

    if (vertexHit) {
    	if(rc.getVertexIconTransformer() != null) {
    		Icon icon = rc.getVertexIconTransformer().transform(v);
    		if(icon != null) {
    		
       			g.draw(icon, rc.getScreenDevice(), shape, (int)x, (int)y);

    		} else {
    			paintShapeForVertex(rc, v, shape);
    		}
    	} else {
    		paintShapeForVertex(rc, v, shape);
    	}
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:38,代码来源:BasicVertexRenderer.java

示例4: paintIconForVertex

import edu.uci.ics.jung.visualization.RenderContext; //导入方法依赖的package包/类
/**
 * Paint <code>v</code>'s icon on <code>g</code> at <code>(x,y)</code>.
 */
protected void paintIconForVertex(RenderContext<V,E> rc, V v, Layout<V,E> layout) {
    GraphicsDecorator g = rc.getGraphicsContext();
    boolean vertexHit = true;
    // get the shape to be rendered
    Shape shape = rc.getVertexShapeTransformer().transform(v);
    
    Point2D p = layout.transform(v);
    p = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p);
    float x = (float)p.getX();
    float y = (float)p.getY();
    // create a transform that translates to the location of
    // the vertex to be rendered
    AffineTransform xform = AffineTransform.getTranslateInstance(x,y);
    // transform the vertex shape with xtransform
    shape = xform.createTransformedShape(shape);
    
    vertexHit = vertexHit(rc, shape);
        //rc.getViewTransformer().transform(shape).intersects(deviceRectangle);

    if (vertexHit) {
            if(rc.getVertexIconTransformer() != null) {
                    Icon icon = rc.getVertexIconTransformer().transform(v);
                    if(icon != null) {
                    
                               g.draw(icon, rc.getScreenDevice(), shape, (int)x, (int)y);

                    } else {
                            paintShapeForVertex(rc, v, shape);
                    }
            } else {
                    paintShapeForVertex(rc, v, shape);
            }
    }
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:38,代码来源:TreeModelNodeRenderer.java


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