本文整理汇总了Java中prefuse.visual.VisualGraph类的典型用法代码示例。如果您正苦于以下问题:Java VisualGraph类的具体用法?Java VisualGraph怎么用?Java VisualGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualGraph类属于prefuse.visual包,在下文中一共展示了VisualGraph类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initDataGroups
import prefuse.visual.VisualGraph; //导入依赖的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();
}
// 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);
}
开发者ID:codydunne,项目名称:netgrok,代码行数:22,代码来源:CodyTestWindow.java
示例2: run
import prefuse.visual.VisualGraph; //导入依赖的package包/类
@Override
public void run(double frac) {
// get a visual table for line segments
VisualTable lines = getTable();
// get all nodes at depth-1
VisualGraph graph = (VisualGraph) m_vis.getGroup(m_src);
@SuppressWarnings("rawtypes")
Iterator nodeIterator = graph.getNodeTable().tuples(
new ComparisonPredicate(ComparisonPredicate.EQ,
new ColumnExpression(ParentChildNode.DEPTH),
new NumericLiteral(depth - 1)));
// connect children of these nodes
while (nodeIterator.hasNext()) {
NodeItem node = (NodeItem) nodeIterator.next();
// TODO assumption that children are ordered or reversely ordered
super.connectPoints(lines, node.inNeighbors());
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:21,代码来源:CyclePlotLineAction.java
示例3: run
import prefuse.visual.VisualGraph; //导入依赖的package包/类
@Override
public void run(double frac) {
TupleSet ts = m_vis.getGroup(m_group);
if(!(ts instanceof VisualGraph))
throw new UnsupportedOperationException();
setMinMax();
switch ( getDataType(((VisualGraph)ts).getNodes()) ) {
case Constants.NUMERICAL:
numericalLayout((VisualGraph)ts);
break;
default:
ordinalLayout((VisualGraph)ts);
}
}
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:18,代码来源:TreeRangeAxisLayout.java
示例4: initDataGroups
import prefuse.visual.VisualGraph; //导入依赖的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 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());
}
}
}
开发者ID:luox12,项目名称:onecmdb,代码行数:38,代码来源:AggregateDemo.java
示例5: setGraph
import prefuse.visual.VisualGraph; //导入依赖的package包/类
public void setGraph(Graph g, String label) {
// update labeling
DefaultRendererFactory drf = (DefaultRendererFactory)
m_vis.getRendererFactory();
((LabelRenderer)drf.getDefaultRenderer()).setTextField(label);
// update graph
m_vis.removeGroup(graph);
VisualGraph vg = m_vis.addGraph(graph, g);
m_vis.setValue(edges, null, VisualItem.INTERACTIVE, Boolean.FALSE);
VisualItem f = (VisualItem)vg.getNode(0);
m_vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
f.setFixed(false);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:15,代码来源:GraphView.java
示例6: initDataGroups
import prefuse.visual.VisualGraph; //导入依赖的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 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());
}
}
}
开发者ID:codydunne,项目名称:netgrok,代码行数:38,代码来源:AggregateDemo.java
示例7: initDataGroups
import prefuse.visual.VisualGraph; //导入依赖的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());
}
}
}
开发者ID:codydunne,项目名称:netgrok,代码行数:41,代码来源:AggregateDecoratorDemo.java
示例8: addGraph
import prefuse.visual.VisualGraph; //导入依赖的package包/类
/**
* Adds a graph to this visualization, using the given data group
* name. A visual abstraction of the data will be created and registered
* with the visualization. An exception will be thrown if the group name
* is already in use.
* @param group the data group name for the visualized graph. The nodes
* and edges will be available in the "group.nodes" and "group.edges"
* subgroups.
* @param graph the graph to visualize
* @param filter a filter Predicate determining which data Tuples in the
* input graph are visualized
* @param nodeSchema the data schema to use for the visual node table
* @param edgeSchema the data schema to use for the visual edge table
*/
public synchronized VisualGraph addGraph(String group, Graph graph,
Predicate filter, Schema nodeSchema, Schema edgeSchema)
{
checkGroupExists(group); // check before adding sub-tables
String ngroup = PrefuseLib.getGroupName(group, Graph.NODES);
String egroup = PrefuseLib.getGroupName(group, Graph.EDGES);
VisualTable nt, et;
nt = addTable(ngroup, graph.getNodeTable(), filter, nodeSchema);
et = addTable(egroup, graph.getEdgeTable(), filter, edgeSchema);
VisualGraph vg = new VisualGraph(nt, et,
graph.isDirected(), graph.getNodeKeyField(),
graph.getEdgeSourceField(), graph.getEdgeTargetField());
vg.setVisualization(this);
vg.setGroup(group);
addDataGroup(group, vg, graph);
TupleManager ntm = new TupleManager(nt, vg, TableNodeItem.class);
TupleManager etm = new TupleManager(et, vg, TableEdgeItem.class);
nt.setTupleManager(ntm);
et.setTupleManager(etm);
vg.setTupleManagers(ntm, etm);
return vg;
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:42,代码来源:Visualization.java
示例9: run
import prefuse.visual.VisualGraph; //导入依赖的package包/类
@Override
public void run(double frac) {
Display display = m_vis.getDisplay(0);
Rectangle position = new Rectangle(vDepth*60+30,hDepth*20+10,display.getWidth()-vDepth*60-30,display.getHeight()-hDepth*20-10);
m_vis.removeGroup(group);
m_vis.removeGroup(labelGroup);
VisualGraph vg = m_vis.addGraph(group, dataProvider.getGranularityAggregationTree());
Schema labelNodeSchema = PrefuseLib.getVisualItemSchema();
labelNodeSchema.addColumn(VisualItem.LABEL, String.class);
Integer defColor = new Integer(ColorLib.gray(150));
labelNodeSchema.setInterpolatedDefault(VisualItem.TEXTCOLOR, defColor);
VisualTree vgl = m_vis.addTree(labelGroup, labelNodeSchema);
Node root = vgl.addRoot();
vgl.addChild(root);
vgl.addChild(root);
try {
ArrayList<Float> relativeSize = new ArrayList<Float>();
ArrayList<Long> minIdentifiers = new ArrayList<Long>();
ArrayList<Long> maxIdentifiers = new ArrayList<Long>();
buildSizeChart(dataProvider.getGranularityAggregationTree().roots().iterator().next(),
relativeSize,minIdentifiers,maxIdentifiers,0);
layoutGranularity(vg,vgl,vgl.getRoot().getChild(0),vgl.getRoot().getChild(1),
(NodeItem)m_vis.getVisualItem(group, dataProvider.getGranularityAggregationTree().roots().iterator().next()),
position,0,minIdentifiers,maxIdentifiers);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:35,代码来源:GROOVELayout.java
示例10: run
import prefuse.visual.VisualGraph; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes" })
@Override
public void run(double frac) {
if (timeScale == null) {
// setMinMax(); TODO get layout bounds
// get Inf / Sup of TemporalDataset (only temporal objects)
log.debug("cannot layout without timescale");
return;
}
TupleSet items = m_vis.getGroup(m_group);
if (items == null) {
log.debug("nothing to layout");
return;
}
// consider only nodes = temporal objects
if (items instanceof VisualGraph) {
items = ((VisualGraph) items).getNodes();
}
// TODO consider only: anchored (visible) objects --> index
Iterator tuples = items.tuples(m_filter);
while (tuples.hasNext()) {
VisualItem item = (VisualItem) tuples.next();
layoutItem(item);
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:30,代码来源:TimeAxisLayout.java
示例11: useWith
import prefuse.visual.VisualGraph; //导入依赖的package包/类
/**
* Warning: Invalidates existing tuples.
* @param vg
*/
public static void useWith(VisualGraph vg) {
TupleManager ntm = new TupleManager(vg.getNodeTable(), vg, VisualParentChildNode.class);
TupleManager etm = new TupleManager(vg.getEdgeTable(), vg, TableEdgeItem.class);
vg.setTupleManagers(ntm, etm);
vg.getNodeTable().setTupleManager(ntm);
vg.getEdgeTable().setTupleManager(etm);
}
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:12,代码来源:VisualParentChildNode.java
示例12: getVisaulGraph
import prefuse.visual.VisualGraph; //导入依赖的package包/类
public VisualGraph getVisaulGraph() {
return(vg);
}
开发者ID:luox12,项目名称:onecmdb,代码行数:4,代码来源:GraphView.java
示例13: addGraph
import prefuse.visual.VisualGraph; //导入依赖的package包/类
/**
* Adds a Graph, refreshes search items and removes aggregates.
*
* @param graph
*/
protected void addGraph(Graph graph){
if(graph == null) return;
// stop visualization
m_vis.cancel(Actions.DRAW.name()).setEnabled(false);
m_vis.cancel(Actions.AGGR.name()).setEnabled(false);
// wait till layout calculations finished.
while(m_aggregateLayout.runs);
// remove all rows
m_aTable.clear();
// remove old groups
m_vis.removeGroup(AGGR_DECORATORS);
m_vis.removeGroup(Visualization.SEARCH_ITEMS);
m_vis.removeGroup(GRAPH);
// add new graph
VisualGraph vg = m_vis.addGraph(GRAPH, graph);
// set focus group
VisualItem f = (VisualItem)vg.getNode(0);
m_vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
//f.setFixed(true);
m_vis.setValue(EDGES, null, VisualItem.INTERACTIVE, Boolean.FALSE);
// refresh search group
SearchTupleSet searchTup = new KeywordSearchTupleSet();
m_vis.addFocusGroup(Visualization.SEARCH_ITEMS, searchTup);
searchTup.addTupleSetListener(new TupleSetListener() {
@Override
public void tupleSetChanged(TupleSet t, Tuple[] add, Tuple[] rem) {
m_vis.run(Actions.DRAW.name() );
}
});
//
SearchQueryBinding sq = new SearchQueryBinding( vg.getNodeTable(), NODE_NAME,
(SearchTupleSet)m_vis.getGroup(Visualization.SEARCH_ITEMS));
// refresh search gui
search = sq.createSearchPanel();
search.setShowResultCount(true);
search.setBorder(BorderFactory.createEmptyBorder(5,5,4,0));
search.setFont(FontLib.getFont("Tahoma", Font.PLAIN, 11));
// refresh box
m_searchBox.removeAll();
m_searchBox.add(Box.createHorizontalStrut(10));
m_searchBox.add(m_searchLabel);
m_searchBox.add(Box.createHorizontalGlue());
m_searchBox.add(search);
m_searchBox.add(Box.createHorizontalStrut(3));
// run
m_vis.run(Actions.DRAW.name()).setEnabled(true);
m_vis.run(Actions.DRAW.name());
//
revalidate();
repaint();
}
开发者ID:renespeck,项目名称:Cugar,代码行数:59,代码来源:AggregatePanel.java
示例14: setGraph
import prefuse.visual.VisualGraph; //导入依赖的package包/类
public void setGraph(Graph g) {
VisualGraph vg = m_vis.addGraph(graph, g);
m_vis.setValue(edges, null, VisualItem.INTERACTIVE, Boolean.TRUE);
VisualItem f = (VisualItem) vg.getNode(0);
m_vis.getGroup(Visualization.FOCUS_ITEMS).setTuple(f);
}
开发者ID:ISA-tools,项目名称:Automacron,代码行数:7,代码来源:GraphView.java
示例15: run
import prefuse.visual.VisualGraph; //导入依赖的package包/类
@Override
public void run(double frac) {
TupleSet items = m_vis.getGroup(m_group);
if (items instanceof VisualGraph) {
items = ((VisualGraph) items).getNodes();
}
double ybase = m_vis.getDisplay(0).getBounds().getCenterY()-m_vis.getDisplay(0).getBounds().getY();
double minx = m_vis.getDisplay(0).getBounds().getMinX();
double maxx = m_vis.getDisplay(0).getBounds().getMaxX();
ArrayList<Double> lastOnLane = new ArrayList<Double>();
Iterator tuples = items.tuples();
while (tuples.hasNext()) {
VisualItem item = (VisualItem) tuples.next();
if (item.getX() >= minx && item.getDouble(VisualItem.X2) <= maxx) {
int takeLane = -1;
for(int i=0; i<lastOnLane.size(); i++) {
if(lastOnLane.get(i) < item.getX()) {
takeLane = i;
lastOnLane.set(i, item.getDouble(VisualItem.X2));
break;
}
}
if (takeLane == -1) {
if (lastOnLane.size() >= maxLanes) {
switchToReplacementGroup();
break;
}
lastOnLane.add(item.getDouble(VisualItem.X2));
takeLane = lastOnLane.size()-1;
}
if (takeLane % 2 == 0) {
item.setY(ybase + (takeLane+1) * 8);
} else {
item.setY(ybase - takeLane * 8);
}
item.setSize(1.2);
}
}
if (lastOnLane.size() < maxLanes)
switchToMainGroup();
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:45,代码来源:GreedyDistributionLayout.java
示例16: layoutGranularity
import prefuse.visual.VisualGraph; //导入依赖的package包/类
/**
* @param vgl
* @throws Exception
*
*/
private void layoutGranularity(VisualGraph vg,VisualTree vgl, Node hNode,Node vNode, NodeItem node,Rectangle position,int granularityLevel,ArrayList<Long> minIdentifiers,ArrayList<Long> maxIdentifiers) throws Exception {
if(granularityLevel > 0) {
position.x += settings[granularityLevel-1].getBorderWith()[0];
position.y += settings[granularityLevel-1].getBorderWith()[1];
position.width -= (settings[granularityLevel-1].getBorderWith()[0]+settings[granularityLevel].getBorderWith()[2]);
position.height -= (settings[granularityLevel-1].getBorderWith()[1]+settings[granularityLevel].getBorderWith()[3]);
}
node.setX(position.getCenterX());
node.setY(position.getCenterY());
node.setSizeX(position.getWidth());
node.setSizeY(position.getHeight());
node.setDOI(granularityLevel);
node.setStrokeColor(ColorLib.rgba(0, 0, 0, 0));
if(granularityLevel + 1 < settings.length) {
Iterator<NodeItem> iChilds = node.inNeighbors();
while(iChilds.hasNext()) {
NodeItem iChild = iChilds.next();
Granule granule = ((TemporalObject)iChild.getSourceTuple()).getTemporalElement().getGranule();
int numberOfSubElements = (int)(maxIdentifiers.get(granularityLevel+1)-minIdentifiers.get(granularityLevel+1)+1);
Rectangle subPosition = (Rectangle)position.clone();
Node hTargetNode = null;
Node vTargetNode = null;
Node targetNode = null;
if (settings[granularityLevel+1].getOrientation() == ORIENTATION_HORIZONTAL) {
subPosition.x += position.width/numberOfSubElements*(granule.getIdentifier()-minIdentifiers.get(granularityLevel+1));
subPosition.width = position.width/numberOfSubElements;
for(int i=0; i<hNode.getChildCount();i++) {
if (hNode.getChild(i).getString(VisualItem.LABEL) == granule.getLabel()) {
targetNode = hNode.getChild(i);
break;
}
}
if(targetNode == null) {
targetNode = vgl.addChild(hNode);
((VisualItem)targetNode).setX(subPosition.getCenterX());
((VisualItem)targetNode).setY((targetNode.getDepth()-1)*20);
targetNode.setString(VisualItem.LABEL, granule.getLabel());
((VisualItem)targetNode).setTextColor(ColorLib.gray(0));
}
hTargetNode = targetNode;
vTargetNode = vNode;
} else if (settings[granularityLevel+1].getOrientation() == ORIENTATION_VERTICAL) {
subPosition.y += position.height/numberOfSubElements*(granule.getIdentifier()-minIdentifiers.get(granularityLevel+1));
subPosition.height = position.height/numberOfSubElements;
for(int i=0; i<vNode.getChildCount();i++) {
if (vNode.getChild(i).getString(VisualItem.LABEL) == granule.getLabel()) {
targetNode = vNode.getChild(i);
break;
}
}
if(targetNode == null) {
targetNode = vgl.addChild(vNode);
((VisualItem)targetNode).setX((targetNode.getDepth()-1)*60);
((VisualItem)targetNode).setY(subPosition.getCenterY());
targetNode.setString(VisualItem.LABEL, granule.getLabel());
((VisualItem)targetNode).setTextColor(ColorLib.gray(0));
}
hTargetNode = hNode;
vTargetNode = targetNode;
}
layoutGranularity(vg,vgl,hTargetNode,vTargetNode,iChild, subPosition, granularityLevel+1,minIdentifiers,maxIdentifiers);
}
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:74,代码来源:GROOVELayout.java
示例17: ordinalLayout
import prefuse.visual.VisualGraph; //导入依赖的package包/类
protected void ordinalLayout(VisualGraph ts) {
throw new UnsupportedOperationException();
}
开发者ID:ieg-vienna,项目名称:ieg-prefuse,代码行数:4,代码来源:TreeRangeAxisLayout.java
注:本文中的prefuse.visual.VisualGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论