本文整理汇总了Java中edu.uci.ics.jung.visualization.FourPassImageShaper.getShape方法的典型用法代码示例。如果您正苦于以下问题:Java FourPassImageShaper.getShape方法的具体用法?Java FourPassImageShaper.getShape怎么用?Java FourPassImageShaper.getShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.visualization.FourPassImageShaper
的用法示例。
在下文中一共展示了FourPassImageShaper.getShape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getShape
import edu.uci.ics.jung.visualization.FourPassImageShaper; //导入方法依赖的package包/类
/**
* get the shape from the image. If not available, get
* the shape from the delegate VertexShapeFunction
*/
public Shape getShape(Vertex v) {
Icon icon = getIcon(v);
if (icon != null && icon instanceof ImageIcon) {
Image image = ((ImageIcon) icon).getImage();
Shape shape = (Shape) shapeMap.get(image);
if (shape == null) {
shape = FourPassImageShaper.getShape(image, 30);
if(shape.getBounds().getWidth() > 0 &&
shape.getBounds().getHeight() > 0) {
// don't cache a zero-sized shape, wait for the image
// to be ready
int width = image.getWidth(null);
int height = image.getHeight(null);
AffineTransform transform = AffineTransform
.getTranslateInstance(-width / 2, -height / 2);
shape = transform.createTransformedShape(shape);
shapeMap.put(image, shape);
}
}
return shape;
} else {
return delegate.getShape(v);
}
}
示例2: getShape
import edu.uci.ics.jung.visualization.FourPassImageShaper; //导入方法依赖的package包/类
public Shape getShape(Vertex v) {
Icon icon = (Icon) iconMap.get(v);
if (icon != null && icon instanceof ImageIcon) {
Image image = ((ImageIcon) icon).getImage();
Shape shape = (Shape) shapeMap.get(image);
if (shape == null) {
if (shapeImages) {
shape = FourPassImageShaper.getShape(image, 30);
} else {
shape = new Rectangle2D.Float(0, 0,
image.getWidth(null), image.getHeight(null));
}
if(shape.getBounds().getWidth() > 0 &&
shape.getBounds().getHeight() > 0) {
int width = image.getWidth(null);
int height = image.getHeight(null);
AffineTransform transform =
AffineTransform.getTranslateInstance(-width / 2, -height / 2);
shape = transform.createTransformedShape(shape);
shapeMap.put(image, shape);
}
}
return shape;
} else {
return delegate.getShape(v);
}
}