Package org.nanograph.drawing.layout

Examples of org.nanograph.drawing.layout.TreeObject


      // First calculate the first node
      nodesMoved = false;
      final Iterator walker = rootNodes.iterator();
      while (walker.hasNext()) {
        final Object rootNode = walker.next();
        final TreeObject root = super.getTreeObject(rootNode);
        final double radius = getRadiusNeededForNode(root);
        System.out.println("" + radius);
        final Point2D locRoot = root.getLocation();
        handleChildren(root, locRoot, radius);
      }
    }
    nodesMoved = false;
  }
View Full Code Here


  private void handleChildren(TreeObject parent, Point2D desiredLocationParent, double radius) {
    TreeObject[] children = parent.getChildren();
    double omtrek = radius * 2 * Math.PI;
    double degrees = 0;
    for (int t = 0; t < children.length; t++) {
      final TreeObject current = children[t];
      double diagonaal = (getRadiusNeededForNode(current) * 2);
      double angle = (omtrek / (diagonaal * Math.PI));
      degrees = degrees + Math.toDegrees(angle);
      final Point2D desired = new Point2D.Double(desiredLocationParent.getX() + (radius * Math.sin(Math.toRadians(degrees))), desiredLocationParent.getY() + (radius * Math.cos(Math.toRadians(degrees))));
      move(children[t], desired);
View Full Code Here

      // First calculate the first node
      nodesMoved = false;
      final Iterator walker = rootNodes.iterator();
      while (walker.hasNext()) {
        final Object rootNode = walker.next();
        final TreeObject root = super.getTreeObject(rootNode);
        final double width = getWithNeededForNode(root);

        final Point2D locRoot = root.getLocation();
        if (width / 2 > locRoot.getX()) {
          final Point2D desired = new Point2D.Double(width / 2, locRoot.getY());
          move(root, desired);
          handleChildren(root, desired, width);
        } else {
View Full Code Here

    // Center line.
    double startXPos = parentCenter - (withParent / 2); // This is the left
    // point
    final double yPos = desiredLocationParent.getY() + parenSize.getHeight() + yOffSet;
    for (int i = 0; i < children.length; i++) {
      final TreeObject current = children[i];
      final double width = getWithNeededForNode(current);
      startXPos = startXPos + (width / 2);
      final Point2D desired = new Point2D.Double(startXPos, yPos);
      move(current, desired);
      startXPos = startXPos + (width / 2) + xSpace;
View Full Code Here

TOP

Related Classes of org.nanograph.drawing.layout.TreeObject

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.