Package org.phylowidget.render

Examples of org.phylowidget.render.NodeRange


    if (hidden)
      return;
    if (FocusManager.instance.getFocusedObject() != null)
      return;
   
    NodeRange r = curNode;
//    if (r == null)
//      r = PhyloWidget.ui.nearest.nearest;
    if (r != prevNearest)
    {
      prevNearest = r;
View Full Code Here


    UIUtils.screenToModel(rect);
    hits.clear();
    PhyloWidget.trees.nodesInRange(hits, rect);

    nearestDist = Float.MAX_VALUE;
    NodeRange temp = null;
    for (int i = 0; i < hits.size(); i++)
    {
      NodeRange r = (NodeRange) hits.get(i);
      PhyloNode n = r.node;
      switch (r.type)
      {
        case (NodeRange.NODE):
          float dist = (float) pt.distance(n.getX(), n.getY());
View Full Code Here

      p.noFill();
      p.strokeWeight(glowRadius / 10f);
      int color = RenderStyleSet.defaultStyle().hoverColor.getRGB();
      p.stroke(color);
      NodeRange r = getCurRange();
      float cX = getX(r);
      float cY = getY(r);
      p.ellipse(cX, cY, glowRadius, glowRadius);
    }
  }
View Full Code Here

    return curNodeRange;
  }

  public PhyloNode getCurrentNode()
  {
    NodeRange nr = getCurRange();
    return nr.node;
  }
View Full Code Here

  private NodeRange getNearestNode(float x, float y)
  {
    getWithinRange(x, y, 40);
    pt.setLocation(x, y);
    float nearestDist = Float.MAX_VALUE;
    NodeRange temp = null;
    for (int i = 0; i < nearNodes.size(); i++)
    {
      NodeRange r = (NodeRange) nearNodes.get(i);
      PhyloNode n = r.node;
      switch (r.type)
      {
        case (NodeRange.NODE):
          float dist = (float) pt.distance(getX(r), getY(r));
View Full Code Here

     * 1. Get all nodes within a reasonable range. 2. Score the closest
     * nodes, adding points for closeness but deducting points for being
     * off-axis.
     */
    Point base = new Point();
    NodeRange cur = getCurRange();

    /*
     * The LEFT or RIGHT directions should always go IN or OUT of the tree,
     * while the up and down will use the score-based search.
     */
    if (dir == LEFT || dir == RIGHT)
    {
      RootedTree t = cur.render.getTree();
      PhyloNode curNode = null;
      if (dir == LEFT)
      {
        if (t.getParentOf(cur.node) != null)
        {
          curNode = (PhyloNode) t.getParentOf(cur.node);
          setCurRange(rangeForNode(cur.render, curNode));
          return;
        }
      } else if (dir == RIGHT)
      {
        if (!t.isLeaf(cur.node))
        {
          List kids = t.getChildrenOf(cur.node);
          curNode = (PhyloNode) kids.get(kids.size() - 1);
          setCurRange(rangeForNode(cur.render, curNode));
          return;
        }
      }

    }

    switch (dir)
    {
      case (LEFT):
        base.setLocation(-1, .1);
        break;
      case (RIGHT):
        base.setLocation(1, -.1);
        break;
      case (UP):
        base.setLocation(0, -1);
        break;
      case (DOWN):
        base.setLocation(0, 1);
        break;
    }

    pt.setLocation(cur.node.getX(), cur.node.getY());
    getWithinRange(cur.node.getX(), cur.node.getY(), 200);
    Point pt2 = new Point();
    float maxScore = -Float.MAX_VALUE;
    NodeRange maxRange = null;
    for (int i = 0; i < nearNodes.size(); i++)
    {
      NodeRange r = (NodeRange) nearNodes.get(i);
      if (r.type == NodeRange.LABEL)
        continue;
      if (r.node == cur.node)
        continue;
      pt2.setLocation(r.node.getX(), r.node.getY());
View Full Code Here

  public void nodeEditName() {
    text.startEditing(curRange(), PhyloTextField.LABEL);
  }

  public void nodeReroot() {
    NodeRange r = curRange();
    r.render.getTree().reroot(curNode());
  }
View Full Code Here

    NodeRange r = curRange();
    r.render.getTree().reroot(curNode());
  }

  public void nodeSwitchChildren() {
    NodeRange r = curRange();
    r.render.getTree().flipChildren(curNode());
    r.render.layoutTrigger();
  }
View Full Code Here

    r.render.getTree().flipChildren(curNode());
    r.render.layoutTrigger();
  }

  public void nodeFlipSubtree() {
    NodeRange r = curRange();
    r.render.getTree().reverseSubtree(curNode());
    getCurTree().modPlus();
    r.render.layoutTrigger();
  }
View Full Code Here

    getCurTree().modPlus();
    r.render.layoutTrigger();
  }

  public void nodeAddSister() {
    NodeRange r = curRange();
    RootedTree tree = r.render.getTree();
    PhyloNode sis = (PhyloNode) tree.createAndAddVertex("");
    tree.addSisterNode(curNode(), sis);
  }
View Full Code Here

TOP

Related Classes of org.phylowidget.render.NodeRange

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.