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


Java NodeItem类代码示例

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


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

示例1: renderProcessing

import org.gephi.preview.plugin.items.NodeItem; //导入依赖的package包/类
@Override
public void renderProcessing(Item item, ProcessingTarget target, PreviewProperties properties) {
    Float x = item.getData(NodeItem.X);
    Float y = item.getData(NodeItem.Y);
    Float size = item.getData(NodeItem.SIZE);
    Color color = item.getData(NodeItem.COLOR);
    int alpha = (int) ((properties.getFloatValue(PreviewProperty.NODE_OPACITY) / 100f) * 255f);
    if (alpha > 255) {
        alpha = 255;
    }
    PGraphics graphics = target.getGraphics();
    graphics.fill(color.getRed(), color.getGreen(), color.getBlue(), alpha);
    if (size > 21) {
        logger.print(size);
        Color stC = color.darker().darker().darker();
        graphics.stroke(stC.getRed(), stC.getGreen(), stC.getBlue(), alpha);
        graphics.strokeWeight(3f);
        graphics.ellipse(x, y, size, size);
    } else {
        graphics.stroke(color.getRed(), color.getGreen(), color.getBlue(), alpha);
        graphics.strokeWeight(1f);
        graphics.ellipse(x, y, size, size);
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:25,代码来源:frmScFDL.java

示例2: renderShapeProcessing

import org.gephi.preview.plugin.items.NodeItem; //导入依赖的package包/类
public void renderShapeProcessing(Item item, ProcessingTarget target, PreviewProperties properties, short type) {

		Float x = item.getData(NodeItem.X);
		Float y = item.getData(NodeItem.Y);
		Float size = item.getData(NodeItem.SIZE);

		Color color = item.getData(NodeItem.COLOR);
		Color borderColor = ((DependantColor) properties.getValue(PreviewProperty.NODE_BORDER_COLOR)).getColor(color);
		float borderSize = properties.getFloatValue(PreviewProperty.NODE_BORDER_WIDTH);
		int alpha = (int) ((properties.getFloatValue(PreviewProperty.NODE_OPACITY) / 100f) * 255f);
		if (alpha > 255) {
			alpha = 255;
		}
		if (target != null) {
			PGraphics graphics = target.getGraphics();

			if (borderSize > 0) {
				graphics.stroke(borderColor.getRed(), borderColor.getGreen(), borderColor.getBlue(), alpha);
				graphics.strokeWeight(borderSize);
			} else {
				graphics.noStroke();
			}
			graphics.fill(color.getRed(), color.getGreen(), color.getBlue(), alpha);

			// x and y describe the center 
			switch (type) {
			case Node.TYPE_SERVER:
				graphics.triangle(x + size / 2, y + size * SQRT_OF_12, x - size / 2, y + size * SQRT_OF_12, x, y - 2 * size * SQRT_OF_12);
				break;
			case Node.TYPE_WORKSTATION:
				graphics.rect(x, y, size, size);
				break;
			case Node.TYPE_ADMINISTRATOR:
				x -= size / 2;
				y -= size / 2;
				graphics.beginShape();
				{
					graphics.vertex(x, y + size / 2);
					graphics.vertex(x + size / 3, y + size);
					graphics.vertex(x + size / 3 * 2, y + size);
					graphics.vertex(x + size, y + size / 2);
					graphics.vertex(x + size / 3 * 2, y);
					graphics.vertex(x + size / 3, y);
				}
				graphics.endShape();
				break;
			default:
			}

		}
	}
 
开发者ID:nullbox,项目名称:Data-and-Information-Visualization-Project,代码行数:52,代码来源:MouseRenderer.java


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