本文整理汇总了Java中org.gephi.preview.api.PreviewProperty类的典型用法代码示例。如果您正苦于以下问题:Java PreviewProperty类的具体用法?Java PreviewProperty怎么用?Java PreviewProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreviewProperty类属于org.gephi.preview.api包,在下文中一共展示了PreviewProperty类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderProcessing
import org.gephi.preview.api.PreviewProperty; //导入依赖的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);
}
}
示例2: jButton4ActionPerformed
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
previewController = Lookup.getDefault().lookup(PreviewController.class
);
PreviewModel previewModel = previewController.getModel();
//int opacity = Integer.parseInt(JOptionPane.showInputDialog("Edge opacity [0-100]", previewModel.getProperties().getValue(PreviewProperty.EDGE_OPACITY)).toString());
//opacity = Math.max(0, Math.max(100, opacity));
//previewModel.getProperties().putValue(PreviewProperty.EDGE_OPACITY, opacity);
Color col = ((EdgeColor) previewModel.getProperties().getValue(PreviewProperty.EDGE_COLOR)).getCustomColor();
JColorChooser jc = new JColorChooser(col);
JOptionPane.showInputDialog(jc);
jc.getColor();
previewModel.getProperties().putValue(PreviewProperty.EDGE_COLOR, new EdgeColor(jc.getColor()));
}
示例3: exportData
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
private void exportData() throws IOException {
PreviewController controller = Lookup.getDefault().lookup(
PreviewController.class);
PreviewProperties props = controller.getModel(workspace)
.getProperties();
props.putValue(PreviewProperty.VISIBILITY_RATIO, 1.0);
props.putValue("width", width);
props.putValue("height", height);
props.putValue(PreviewProperty.MARGIN, margin);
// props.putValue(PreviewProperty.EDGE_CURVED, false);
controller.refreshPreview(workspace);
ProcessingTarget target = (ProcessingTarget) controller
.getRenderTarget(RenderTarget.PROCESSING_TARGET, workspace);
target.refresh();
PGraphicsJava2D pg2 = (PGraphicsJava2D) target.getGraphics();
BufferedImage img = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
img.setRGB(0, 0, width, height, pg2.pixels, 0, width);
ImageIO.write(img, "jpg", outputStream);
outputStream.close();
props.removeSimpleValue(PreviewProperty.VISIBILITY_RATIO);
props.removeSimpleValue("width");
props.removeSimpleValue("height");
props.removeSimpleValue(PreviewProperty.MARGIN);
}
示例4: paintScale
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
private void paintScale(Graphics g) {
if (scaleImg != null) {
Graphics2D g2 = (Graphics2D) g;
previewController = Lookup.getDefault().lookup(PreviewController.class);
PreviewModel previewModel = previewController.getModel();
g2.setPaint(previewModel.getProperties().getColorValue(PreviewProperty.BACKGROUND_COLOR));
g2.fillRect(0, 0, this.getWidth(), this.getHeight());
g2.drawImage(scaleImg, null, 0, -10);
}
}
示例5: refresh
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
/**
* Refreshes the preview using the current graph from the preview controller.
*/
public void refresh(PreviewModel model, RenderTarget target) {
this.model = model;
this.target = target;
// updates fonts
//fontMap.clear(); Don't clear to prevent PFont memory leak from Processing library.
if (model != null) {
background = model.getProperties().getColorValue(PreviewProperty.BACKGROUND_COLOR);
}
// redraws the applet
initAppletLayout();
redraw();
}
示例6: getProperties
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
public PreviewProperty[] getProperties() {
return new PreviewProperty[0];
}
示例7: jCheckBox1ActionPerformed
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
previewController = Lookup.getDefault().lookup(PreviewController.class);
PreviewModel previewModel = previewController.getModel();
previewModel.getProperties().putValue(PreviewProperty.SHOW_EDGES, !jCheckBox1.isSelected());
lstParamValueChanged(null);
}
示例8: setMoving
import org.gephi.preview.api.PreviewProperty; //导入依赖的package包/类
public void setMoving(boolean moving) {
if (model != null) {
model.getProperties().putValue(PreviewProperty.MOVING, moving);
}
}
示例9: renderShapeProcessing
import org.gephi.preview.api.PreviewProperty; //导入依赖的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:
}
}
}