本文整理汇总了Java中prefuse.data.Tree类的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tree类属于prefuse.data包,在下文中一共展示了Tree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processHierarchy
import prefuse.data.Tree; //导入依赖的package包/类
/**
* Processes the specified hierarchy, building hierarchy tree and creating instance table
* used in visualizations.
*
* @param hierarchy
* the hierarchy to process
*/
public void processHierarchy( HVConfig config )
{
// TODO:
// Might want to use some kind of algorithm to figure out optimal tree layout area?
// 1024x1024 seems to work well enough for now.
Pair<Tree, TreeLayoutData> treeData = HierarchyProcessor.buildHierarchyTree(
mainHierarchy.getRoot(), 2048, 2048
);
hierarchyTree = treeData.getLeft();
hierarchyTreeLayout = treeData.getRight();
instanceTable = HierarchyProcessor.createInstanceTable(
config, this, hierarchyTree
);
}
示例2: process
import prefuse.data.Tree; //导入依赖的package包/类
public void process(OutputStream out) throws Exception {
Tree tree = new Tree();
tree.addColumn("name", String.class);
tree.addColumn(VisualItem.EXPANDED, Boolean.class);
Node root = tree.addNode();
root.set("name", "Root");
genTree(tree, root, 5, 2);
CommonTreeView view = new CommonTreeView(tree, "name", 6);
view.setSize(1440, 900);
Thread.sleep(800);
view.zoomToFit();
Thread.sleep(800);
view.saveImage(out, "JPG", 1);
}
示例3: GroupFileReader
import prefuse.data.Tree; //导入依赖的package包/类
public GroupFileReader(){
t = new Tree();
t.addColumn("group", String.class);
t.addColumn("subnets", String.class);
t.addColumn("x", float.class);
t.addColumn("y", float.class);
root = t.addRoot();
root.setString("group", "Network");
root.setString("subnets", null);
local = t.addChild(root);
local.setString("group", "Local Network");
foreign = t.addChild(root);
foreign.setString("group", "Foreign Network");
}
示例4: XMLTreeGen
import prefuse.data.Tree; //导入依赖的package包/类
public XMLTreeGen(){
t = new Tree();
t.addColumn("group", String.class);
t.addColumn("subnets", String.class);
// t.addColumn("x", float.class);
// t.addColumn("y", float.class);
root = t.addRoot();
root.setString("group", "Network");
root.setString("subnets", null);
local = t.addChild(root);
local.setString("group", "Local Network");
foreign = t.addChild(root);
foreign.setString("group", "Foreign Network");
}
示例5: getDiamondTree
import prefuse.data.Tree; //导入依赖的package包/类
/**
* Create a diamond tree, with a given branching factor at
* each level, and depth levels for the two main branches.
* @param b the number of children of each branch node
* @param d1 the length of the first (left) branch
* @param d2 the length of the second (right) branch
* @return the generated Tree
*/
public static Tree getDiamondTree(int b, int d1, int d2) {
Tree t = new Tree();
t.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = t.addRoot();
r.setString(LABEL, "0,0");
Node left = t.addChild(r);
left.setString(LABEL, "1,0");
Node right = t.addChild(r);
right.setString(LABEL, "1,1");
deepHelper(t, left, b, d1-2, true);
deepHelper(t, right, b, d1-2, false);
while ( left.getFirstChild() != null )
left = left.getFirstChild();
while ( right.getLastChild() != null )
right = right.getLastChild();
deepHelper(t, left, b, d2-1, false);
deepHelper(t, right, b, d2-1, true);
return t;
}
示例6: convertTree
import prefuse.data.Tree; //导入依赖的package包/类
private prefuse.data.Tree convertTree(Node root) {
prefuse.data.Tree pTree = new prefuse.data.Tree();
pTree.getNodeTable().addColumn("name", String.class);
pTree.getNodeTable().addColumn("path", String.class);
pTree.getNodeTable().addColumn("size", double.class);
node = pTree.addRoot();
node.set("name", root.getName());
node.set("path", root.getPath());
node.set("size", new Double(root.getSize()));
buildTree(root, pTree);
return pTree;
}
示例7: createInstanceTable
import prefuse.data.Tree; //导入依赖的package包/类
public static TableEx createInstanceTable( HVConfig config, LoadedHierarchy hierarchy, Tree hierarchyTree )
{
String[] dataNames = getFeatureNames( hierarchy );
TableEx table = createEmptyInstanceTable( hierarchy.options, dataNames );
processInstanceData( config, hierarchy, hierarchyTree, table );
return table;
}
示例8: processInstanceData
import prefuse.data.Tree; //导入依赖的package包/类
/**
* Processes raw hierarchy data and saves it in the specified table.
*
* @param config
* the application config
* @param hierarchy
* the hierarchy to process
* @param hierarchyTree
* the processed hierarchy tree
* @param table
* the table the processed data will be saved in.
*/
private static void processInstanceData(
HVConfig config,
LoadedHierarchy hierarchy,
Tree hierarchyTree, Table table )
{
// TODO: Implement some sort of culling so that we remove overlapping instances?
// Could use k-d trees maybe?
for ( Instance instance : hierarchy.getMainHierarchy().getRoot().getSubtreeInstances() ) {
int row = table.addRow();
double[] data = instance.getData();
for ( int i = 0; i < data.length; ++i ) {
table.set( row, i, data[i] );
}
prefuse.data.Node node = findGroup( hierarchyTree, instance.getNodeId() );
table.set( row, HVConstants.PREFUSE_INSTANCE_NODE_COLUMN_NAME, node );
if ( hierarchy.options.hasTrueClassAttribute ) {
table.set( row, HVConstants.PREFUSE_INSTANCE_TRUENODE_ID_COLUMN_NAME, instance.getTrueClass() );
}
if ( hierarchy.options.hasInstanceNameAttribute ) {
table.set( row, HVConstants.PREFUSE_INSTANCE_LABEL_COLUMN_NAME, instance.getInstanceName() );
}
}
}
示例9: findGroup
import prefuse.data.Tree; //导入依赖的package包/类
public static prefuse.data.Node findGroup( Tree hierarchyTree, String name )
{
// TODO:
// Can potentially speed this up by using a lookup cache in the form of a hash map.
// Not sure if worth it, though.
int nodeCount = hierarchyTree.getNodeCount();
for ( int i = 0; i < nodeCount; ++i ) {
prefuse.data.Node n = hierarchyTree.getNode( i );
if ( n.getString( HVConstants.PREFUSE_NODE_ID_COLUMN_NAME ).equals( name ) ) {
return n;
}
}
return null;
}
示例10: NodeSelectionControl
import prefuse.data.Tree; //导入依赖的package包/类
public NodeSelectionControl(
Supplier<Tree> treeSupplier,
Supplier<Integer> currentSelectionGetter,
Consumer<Integer> currentSelectionSetter )
{
this.treeSupplier = treeSupplier;
this.getter = currentSelectionGetter;
this.setter = currentSelectionSetter;
}
示例11: genTree
import prefuse.data.Tree; //导入依赖的package包/类
private void genTree(Tree t, Node parent, int level, int child) {
if (level == 0) {
return;
}
for (int i = 0; i < child; i++) {
Node n = t.addChild(parent);
n.set("name", "Node[" + level + "," + child +"]");
n.set(VisualItem.EXPANDED, true);
genTree(t, n, level-1, child);
}
}
示例12: CommonTreeView
import prefuse.data.Tree; //导入依赖的package包/类
public CommonTreeView(Tree t, String label) {
super(new Visualization());
m_label = label;
m_vis.add(tree, t);
init();
}
示例13: getReferenceTree
import prefuse.data.Tree; //导入依赖的package包/类
public Tree getReferenceTree(String alias) {
Tree t = new Tree();
setupModel(t);
CiBean bean = this.tModel.getBean(alias);
if (bean == null) {
System.out.println("Reference Tree Alias=" + alias + " is not found in " + tModel);
return(t);
}
Node root = t.addRoot();
root.set("alias", bean.getAlias());
root.set("name", bean.getAlias());
root.set("checked", true);
buildDependecyTree(t, root, "/" + alias,bean);
return(t);
}
示例14: addChild
import prefuse.data.Tree; //导入依赖的package包/类
private Node addChild(Tree t, Node parent, AttributeBean a, CiBean bean, boolean inBound) {
Node child = t.addChild(parent);
Edge e = child.getParentEdge();
e.set("type", a.getRefType());
e.set("inBound", inBound);
updateData(child, bean, a, inBound);
return(child);
}
示例15: TreeView
import prefuse.data.Tree; //导入依赖的package包/类
public TreeView(Tree t, String label) {
super(new Visualization());
m_label = label;
m_vis.add(tree, t);
init();
}