本文整理汇总了Java中prefuse.data.Graph.addColumn方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.addColumn方法的具体用法?Java Graph.addColumn怎么用?Java Graph.addColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Graph
的用法示例。
在下文中一共展示了Graph.addColumn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDataGroups
import prefuse.data.Graph; //导入方法依赖的package包/类
private void initDataGroups() {
// create sample graph
g = new Graph(true);
for (int i = 0; i < 3; ++i) {
Node n1 = g.addNode();
Node n2 = g.addNode();
Node n3 = g.addNode();
g.addEdge(n1, n2);
g.addEdge(n1, n3);
// g.addEdge(n2, n3);
}
g.addEdge(0, 3);
// g.addEdge(3, 6);
g.addEdge(6, 0);
// add labels for nodes and edges
g.addColumn(VisualItem.LABEL, String.class);
for (int i = 0; i < 9; i++) {
g.getNode(i).setString(VisualItem.LABEL, "Node " + i);
}
}
示例2: setupModel
import prefuse.data.Graph; //导入方法依赖的package包/类
private void setupModel(Graph g) {
g.addColumn("alias", String.class);
g.addColumn("type", String.class);
g.addColumn("mark", Boolean.class);
g.addColumn("name", String.class);
g.addColumn("checked", boolean.class);
// On Edge
g.addColumn("springCoefficient", float.class);
g.addColumn("springLength", float.class);
// On Node
g.addColumn("massValue", float.class);
g.addColumn("image", String.class);
}
示例3: initDataGroups
import prefuse.data.Graph; //导入方法依赖的package包/类
private void initDataGroups() {
// create sample graph
// 9 nodes broken up into 3 interconnected cliques
Graph g = new Graph();
for ( int i=0; i<3; ++i ) {
Node n1 = g.addNode();
Node n2 = g.addNode();
Node n3 = g.addNode();
g.addEdge(n1, n2);
g.addEdge(n1, n3);
g.addEdge(n2, n3);
}
g.addEdge(0, 3);
g.addEdge(3, 6);
g.addEdge(6, 0);
// add labels for nodes and edges
g.addColumn(VisualItem.LABEL, String.class);
for (int i = 0; i < 9; i++) {
g.getNode(i).setString(VisualItem.LABEL, ""+i);
g.getEdge(i).setString(VisualItem.LABEL, ""+i);
}
// add visual data groups
VisualGraph vg = m_vis.addGraph(GRAPH, g);
m_vis.setInteractive(EDGES, null, false);
m_vis.setValue(NODES, null, VisualItem.SHAPE,
new Integer(Constants.SHAPE_ELLIPSE));
AggregateTable at = m_vis.addAggregates(AGGR);
at.addColumn(VisualItem.POLYGON, float[].class);
at.addColumn("id", int.class);
// add nodes to aggregates
// create an aggregate for each 3-clique of nodes
Iterator nodes = vg.nodes();
for ( int i=0; i<3; ++i ) {
AggregateItem aitem = (AggregateItem)at.addItem();
aitem.setInt("id", i);
for ( int j=0; j<3; ++j ) {
aitem.addItem((VisualItem)nodes.next());
}
}
}
示例4: initDataGroups
import prefuse.data.Graph; //导入方法依赖的package包/类
/**
* Inits the data groups.
*
* @param orderedTerms
* the ordered terms
* @param dm
* the dm
* @param separateConstants
* the separate constants
* @throws FeatureTermException
* the feature term exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
private void initDataGroups(final List<FeatureTerm> orderedTerms, final FTKBase dm, boolean separateConstants)
throws FeatureTermException, IOException {
Graph g = new Graph(true);
g.addColumn("id", Integer.class);
g.addColumn("name", String.class);
// Create nodes:
for (@SuppressWarnings("unused")
FeatureTerm t : orderedTerms) {
g.addNode();
}
setColors(true);
assignColors(orderedTerms);
if (locations == null) {
locations = new Point2D[orderedTerms.size()];
for (int i = 0; i < orderedTerms.size(); i++) {
locations[i] = new Point2D.Double(rand.nextDouble(), rand.nextDouble());
}
}
vg = m_vis.addGraph(GRAPH, g);
try {
distances(orderedTerms);
} catch (InterruptedException e) {
FTLGUI.writeConsole(e.toString());
e.printStackTrace();
}
applyForces(orderedTerms);
drawCaseBase(orderedTerms);
}
示例5: addColumnDefinition
import prefuse.data.Graph; //导入方法依赖的package包/类
/**
* Adds all needed columns to the passed graph.
*
* @param graph the graph
* @return the graph with the columns added
*/
public static Graph addColumnDefinition(Graph graph) {
// add id used for node and edges
graph.addColumn(ColumnNames.ID, Integer.class);
// add text and node size
graph.addColumn(ColumnNames.NODE_HEIGHT, Integer.class);
graph.addColumn(ColumnNames.NODE_WIDTH, Integer.class);
graph.addColumn(ColumnNames.TEXT_SIZE, Integer.class);
// add color columns for nodes and edges
graph.addColumn(ColumnNames.COLOR_RED, Integer.class);
graph.addColumn(ColumnNames.COLOR_GREEN, Integer.class);
graph.addColumn(ColumnNames.COLOR_BLUE, Integer.class);
graph.addColumn(ColumnNames.TEXT_COLOR_RED, Integer.class);
graph.addColumn(ColumnNames.TEXT_COLOR_GREEN, Integer.class);
graph.addColumn(ColumnNames.TEXT_COLOR_BLUE, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_COLOR_RED, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_COLOR_BLUE, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_COLOR_GREEN, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_RED, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_BLUE, Integer.class);
graph.addColumn(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_GREEN, Integer.class);
graph.addColumn(ColumnNames.IS_HIGHLIGHTED, Boolean.class);
graph.addColumn(ColumnNames.IS_CLICKED, Boolean.class);
// @see: Nodetype.nodetype ! ORDER IS IMPORTANT !
graph.addColumn(ColumnNames.NODE_FORM, String.class);
graph.addColumn(ColumnNames.NODE_VOWL_TYPE, String.class);
graph.addColumn(ColumnNames.EDGE_VOWL_TYPE, String.class);
graph.addColumn(ColumnNames.EDGE_LINE_TYPE, String.class);
// add columns for the name of the node / edge
graph.addColumn(ColumnNames.NAME, String.class);
graph.addColumn(ColumnNames.FULL_NAME, String.class);
graph.addColumn(ColumnNames.NAME_DATA, String.class);
// add column for edge arrow
graph.addColumn(ColumnNames.EDGE_ARROW_TYPE, String.class);
// add column for the length of an edge
graph.addColumn(ColumnNames.EDGE_LENGTH, Integer.class);
// add column for class count (classes only) and the angel of the ordered eges (edges only)
graph.addColumn(ColumnNames.CLASS_INSTANCE_COUNT, Integer.class);
graph.addColumn(ColumnNames.RENDER_UTILITY_E2E_ANGEL, Integer.class);
// add columns for RDF / OWL data
graph.addColumn(ColumnNames.RDFS_URI, String.class);
graph.addColumn(ColumnNames.RDFS_COMMENT, String.class);
graph.addColumn(ColumnNames.RDFS_DEFINED_BY, String.class);
graph.addColumn(ColumnNames.OWL_VERSION_INFO, String.class);
graph.addColumn(ColumnNames.RDFS_DOMAIN, String.class);
graph.addColumn(ColumnNames.RDFS_RANGE, String.class);
graph.addColumn(ColumnNames.RDFS_INVERSE_OF, String.class);
// add columns to store possible equivalent classes
graph.addColumn(ColumnNames.EQUIVALENT_CLASSES, ArrayList.class);
return graph;
}
示例6: getTestHw
import prefuse.data.Graph; //导入方法依赖的package包/类
public static Graph getTestHw() {
Graph g = new Graph();
g.addColumn("name", String.class);
g.addColumn("type", String.class);
g.addColumn("mark", Boolean.class);
// On Edge
g.addColumn("springCoefficient", float.class);
g.addColumn("springLength", float.class);
// On Node
g.addColumn("massValue", float.class);
g.addColumn("image", String.class);
// Create 1 router
Node router = g.addNode();
router.set("name", "Router");
router.set("type", "Router");
router.set("image", "images/router.jpg");
Node rif1 = g.addNode();
rif1.set("name", "Router-IF-1");
rif1.set("type", "NIC");
rif1.set("image", "images/nic.gif");
Node rif2 = g.addNode();
rif2.set("name", "Router-IF-2");
rif2.set("type", "NIC");
rif2.set("image", "images/nic.gif");
Node rif3 = g.addNode();
rif3.set("name", "Router-IF-3");
rif3.set("type", "NIC");
rif3.set("image", "images/nic.gif");
Node rif4 = g.addNode();
rif4.set("name", "Router-IF-4");
rif4.set("type", "NIC");
rif4.set("image", "images/nic.gif");
Node wifi = g.addNode();
wifi.set("name", "Router-WIFI");
wifi.set("type", "NIC");
wifi.set("image", "images/nic-wifi.png");
addEdge(g, rif1, router, "ComposedOf");
addEdge(g, rif2, router, "ComposedOf");
addEdge(g, rif3, router, "ComposedOf");
addEdge(g, rif4, router, "ComposedOf");
addEdge(g, wifi, router, "ComposedOf");
addServer(g, "Server-1", "UTP", rif1);
addServer(g, "Server-2", "UTP", rif2);
addServer(g, "Server-3", "UTP", rif3);
addServer(g, "Server-4", "UTP", rif4);
for (int i = 0; i < 10; i++) {
addServer(g, "Server-wifi-" + i, "WIFI", wifi);
}
return(g);
}
示例7: getPrefuseGraphFromGamaGraphForVisu
import prefuse.data.Graph; //导入方法依赖的package包/类
public static Graph getPrefuseGraphFromGamaGraphForVisu(final IScope scope, final GamaGraph<?, ?> graph) {
System.err.println("translation of the graph to a prefuse graph...");
final Graph g = new Graph();
g.addColumn(PREFUSE_ATTRIBUTE_GAMA_OBJECT, IShape.class);
// g.addColumn(VisualItem.VISIBLE, Boolean.class, Boolean.TRUE);
final Map<Object, Node> gamaVertex2prefuseNode = new HashMap<Object, Node>(graph._internalVertexMap().size());
// retrieve nodes
for (final Object content : graph._internalVertexMap().keySet()) {
// Object vertex = graph._internalVertexMap().get(content);
if (content instanceof IShape) {
final IShape shContent = (IShape) content;
// ILocation loc = shContent.getLocation();
final Node prefuseNode = g.addNode();
prefuseNode.set(PREFUSE_ATTRIBUTE_GAMA_OBJECT, shContent);
gamaVertex2prefuseNode.put(content, prefuseNode);
} else {
System.err.println("Warning, not using " + content);
}
}
// retrieve edges
for (final Object o : graph._internalEdgeSet()) {
final _Edge<?, ?> edge = (_Edge) o;
final Edge prefuseEdge = g.addEdge(gamaVertex2prefuseNode.get(edge.getSource()),
gamaVertex2prefuseNode.get(edge.getTarget()));
}
// basic verification
if (graph._internalVertexMap()
.size() != g.getNodeCount()) { throw GamaRuntimeException.error(
"error during the translation of a Gama graph to a prefuse graph: the number of nodes is not the same.",
scope); }
return g;
}