
visual.sort.TreeItemSorter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timebench Show documentation
Show all versions of timebench Show documentation
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