本文整理汇总了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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}