Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1.     //funkce na vypocet pozic
  2.     public static Point getNodeChildernPosition(DrawNode node, NodeType childType, Integer width, Integer displaceY, Integer level, Boolean boostRoot) {
  3.         switch (childType) {
  4.             case ntRoot:
  5.                 return new Point(node.getFinalDrawLocation().getX(), node.getFinalDrawLocation().getY() + displaceY);
  6.             case ntLeftSon:
  7.                 if (node.getNodeType() == NodeType.ntRoot && boostRoot) {
  8.                     return new Point(node.getFinalDrawLocation().getX() - (width / 4), node.getFinalDrawLocation().getY() + (displaceY + displaceY / 2));
  9.                 } else {
  10.                     return new Point(node.getFinalDrawLocation().getX() - (int) ((double) width / 5 / ((double) level * Math.max(1.0, (double) level - 2.5))), node.getFinalDrawLocation().getY() + displaceY);
  11.                 }
  12.             case ntRightSon:
  13.                 if (node.getNodeType() == NodeType.ntRoot && boostRoot) {
  14.                     return new Point(node.getFinalDrawLocation().getX() + (width / 4), node.getFinalDrawLocation().getY() + (displaceY + displaceY / 2));
  15.                 } else {
  16.                     return new Point(node.getFinalDrawLocation().getX() + (int) ((double) width / 5 / ((double) level * Math.max(1.0, (double) level - 2.5))), node.getFinalDrawLocation().getY() + displaceY);
  17.                 }
  18.             case ntNW: //1
  19.                 return new Point((int) ((double) node.getFinalDrawLocation().getX() - 3.0 * ((double) width / Math.pow((double) level, 2.0) / 8.0)), node.getFinalDrawLocation().getY() + displaceY);
  20.             case ntNE: //2
  21.                 return new Point((int) ((double) node.getFinalDrawLocation().getX() - (double) width / Math.pow((double) level, 2.0) / 8.0), node.getFinalDrawLocation().getY() + displaceY);
  22.             case ntSW: //3e
  23.                 return new Point((int) ((double) node.getFinalDrawLocation().getX() + (double) width / Math.pow((double) level, 2.0) / 8.0), node.getFinalDrawLocation().getY() + displaceY);
  24.             case ntSE: //4
  25.                 return new Point((int) ((double) node.getFinalDrawLocation().getX() + 3.0 * ((double) width / Math.pow((double) level, 2.0) / 8.0)), node.getFinalDrawLocation().getY() + displaceY);
  26.         }
  27.         return null;
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement