本文整理汇总了Java中org.gephi.preview.api.PreviewModel类的典型用法代码示例。如果您正苦于以下问题:Java PreviewModel类的具体用法?Java PreviewModel怎么用?Java PreviewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreviewModel类属于org.gephi.preview.api包,在下文中一共展示了PreviewModel类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jButton4ActionPerformed
import org.gephi.preview.api.PreviewModel; //导入依赖的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()));
}
示例2: getSingleItem
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
public Item getSingleItem(float x, float y) {
Item resultItem = null;
PreviewModel previewModel = Lookup.getDefault().lookup(PreviewController.class).getModel();
for (Item currentItem : previewModel.getItems(Item.NODE)) {
float itemSize = currentItem.getData("size");
float itemX = currentItem.getData("x");
float itemY = currentItem.getData("y");
itemSize /= 2;
if (x >= itemX - itemSize && x <= itemX + itemSize && y >= itemY - itemSize && y <= itemY + itemSize) {
resultItem = currentItem;
// assuming non-overlapping nodes, so we can stop here
break;
}
}
return resultItem;
}
示例3: paintScale
import org.gephi.preview.api.PreviewModel; //导入依赖的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);
}
}
示例4: refresh
import org.gephi.preview.api.PreviewModel; //导入依赖的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();
}
示例5: buildRenderTarget
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
@Override
public RenderTarget buildRenderTarget(PreviewModel previewModel) {
Integer width = previewModel.getProperties().getValue("width");
Integer height = previewModel.getProperties().getValue("height");
if (width != null && height != null) {
//Headless mode
width = Math.max(1, width);
height = Math.max(1, height);
return new CustomRenderTargetImpl(width, height);
} else {
//Applet mode
return new CustomRenderTargetImpl();
}
}
开发者ID:nullbox,项目名称:Data-and-Information-Visualization-Project,代码行数:16,代码来源:CustomRenderTargetBuilder.java
示例6: preProcess
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
public void preProcess(PreviewModel previewModel) {
// System.out.println("preProcess Called");
}
示例7: jCheckBox1ActionPerformed
import org.gephi.preview.api.PreviewModel; //导入依赖的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: preProcess
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
public void preProcess(PreviewModel previewModel) {
// System.err.println("preProcess Called");
}
示例9: execute
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
public boolean execute() {
try {
PreviewModel previewModel;
final PreviewController previewController = Lookup.getDefault().lookup(PreviewController.class);
//there seems to be a bug in gephi or in gephi & eclipse that needs a refresh of the preview - else the model is empty
previewController.refreshPreview();
previewModel = previewController.getModel();
AttributeModel model = Lookup.getDefault().lookup(AttributeController.class).getModel();
AttributeColumn[] nodeColums = model.getNodeTable().getColumns();
//try to find the GeoFields
AttributeColumn[] geoFields;
GeoAttributeFinder gaf = new GeoAttributeFinder();
geoFields = gaf.findGeoFields(nodeColums);
SHPExporterDialog exporterDialog;
exporterDialog = new SHPExporterDialog(nodeColums, geoFields);
exporterDialog.setTitle("SHP Export Options");
if (exporterDialog.showDialog()) {
geoFields = exporterDialog.getGeoFields();
File exportFile = exporterDialog.getFile();
//Construct Export Filenames
String baseName = exportFile.getName();
baseName = baseName.substring(0, baseName.lastIndexOf("."));
File pointFile = new File(exportFile.getParentFile(), baseName + ".node.shp");
File edgeFile = new File(exportFile.getParentFile(), baseName + ".edge.shp");
//convert data to pointFeatureSource
SimpleFeatureType pointFeatureType = getFeatureTypeForAttributes(Point.class, nodeColums);
SimpleFeatureCollection pointFeatureSource;
pointFeatureSource = getPointFeatureSource(previewModel, pointFeatureType, geoFields);
//convert data to edgeFeatureSource
AttributeColumn[] edgeColums = model.getEdgeTable().getColumns();
SimpleFeatureType edgeFeatureType = getFeatureTypeForAttributes(LineString.class, edgeColums);
SimpleFeatureCollection edgeFeatureSource;
edgeFeatureSource = getFeatureSource(false, previewModel, edgeFeatureType, geoFields);
//Create Shapefile
//Netbean securit-manager ist running wild - dunno what to do but cathc the exception
writeSHP(pointFile.toURL(), pointFeatureType, pointFeatureSource);
writeSHP(edgeFile.toURL(), edgeFeatureType, edgeFeatureSource);
return true;
}
} catch (IOException ex) {
Logger.getLogger(SHPExporter.class.getName()).log(Level.SEVERE, null, ex);
}
return true;
}
示例10: getPointFeatureSource
import org.gephi.preview.api.PreviewModel; //导入依赖的package包/类
private SimpleFeatureCollection getPointFeatureSource(PreviewModel previewModel, SimpleFeatureType featureType, AttributeColumn[] geoFields) {
boolean isPoints = true;
SimpleFeatureCollection collection = getFeatureSource(isPoints, previewModel, featureType, geoFields);
return collection;
}