All Downloads are FREE. Search and download functionalities are using the official Maven repository.

visual.sort.TreeItemSorter Maven / Gradle / Ivy

Go to download

TimeBench, a flexible, easy-to-use, and reusable software library written in Java that provides foundational data structures and algorithms for time- oriented data in Visual Analytics.

The newest version!
package visual.sort;

import ieg.prefuse.data.ParentChildNode;
import prefuse.Visualization;
import prefuse.data.Node;
import prefuse.visual.AggregateItem;
import prefuse.visual.DecoratorItem;
import prefuse.visual.EdgeItem;
import prefuse.visual.VisualItem;
import prefuse.visual.sort.ItemSorter;

/**
 * 
 * 
 * 

* Added: / TL
* Modifications: *

* * @author Tim Lammarsch * */ public class TreeItemSorter extends ItemSorter { @Override public int score(VisualItem item) { int type = ITEM; if ( item instanceof EdgeItem ) { type = EDGE; } else if ( item instanceof AggregateItem ) { type = AGGREGATE; } else if ( item instanceof DecoratorItem ) { type = DECORATOR; } int score = (1<<(26+type)); if (item.getSourceTuple() instanceof ParentChildNode) { for(ParentChildNode node = (ParentChildNode)item.getSourceTuple(); node.getFirstParent() != null; node = node.getFirstParent()) { score++; } } return score; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy