Package org.phylowidget.ui

Examples of org.phylowidget.ui.PhyloNode


     * Do the children first.
     */
    List children = tree.getChildrenOf(n);
    for (int i = 0; i < children.size(); i++)
    {
      PhyloNode child = (PhyloNode) children.get(i);
      branchPositions(child);
    }
    Collections.sort(children);
    /*
     * Now, let's put on our thinking caps and try to lay ourselves out
     * correctly.
     */
    PhyloNode loChild = (PhyloNode) Collections.min(children);
    PhyloNode hiChild = (PhyloNode) Collections.max(children);
    /*
     * Find the max depth of each child, and project where the "lower" child
     * would be in the y axis if it were at that higher depth.
     */
    float stepSize = 1f / (leaves.size());
    float loLeaves = tree.getNumEnclosedLeaves(loChild);
    float hiLeaves = tree.getNumEnclosedLeaves(hiChild);
    float mLeaves = Math.max(loLeaves, hiLeaves);
    // System.out.println("md:" + mLeaves);
    float loChildNewY = loChild.getTargetY() + (mLeaves - loLeaves)
        * stepSize / 2;
    float hiChildNewY = hiChild.getTargetY() - (mLeaves - hiLeaves)
        * stepSize / 2;
    float unscaledY = (loChildNewY + hiChildNewY) / 2;
    float unscaledX = nodeXPosition(n);
    n.setPosition(unscaledX, unscaledY);
    return 0;
View Full Code Here


     */
    ArrayList nodes = new ArrayList();
    t.getAll(t.getRoot(), null, nodes);
    for (int i = 0; i < nodes.size(); i++)
    {
      PhyloNode n = (PhyloNode) nodes.get(i);
      n.setState(PhyloNode.NONE);
    }
  }
View Full Code Here

     {
    allNodes.clear();
    tree.getAll(tree.getRoot(), null, allNodes);
    int i = random.nextInt(allNodes.size());
    Object vertex = allNodes.get(i);
    PhyloNode sis = (PhyloNode) tree.createAndAddVertex(taxonName);
    tree.addSisterNode(vertex, sis);

    tree.setBranchLength(vertex, randomBranch());
    tree.setBranchLength(sis, randomBranch());
    tree.setBranchLength(tree.getParentOf(sis), randomBranch());
View Full Code Here

TOP

Related Classes of org.phylowidget.ui.PhyloNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.