Exemple #1
0
  private void updateSubLocations(ZNode node, boolean immediate, Point2D loc) {
    final Point center = new Point((int) Math.round(loc.getX()), (int) Math.round(loc.getY()));
    // make bigger when more nodes
    final float factor =
        selectedNode == node ? (1.3f + logSize(node.getSubmodules().size()) / 2.2f) : 1.2f;
    int size = Math.round(sizeMap.get(node) * factor);
    final float xRatio = display.getWidth() / display.getHeight();
    Map<ZNode, Point2D> map =
        new PixelZNodePositioner(
                center,
                new Dimension((int) (size * xRatio), size),
                new DirectionZNodePositioner(direction, makeNodePositioner()))
            .getNewPositions(node);

    for (ZNode sub : node.getSubmodules()) {
      pointMap.put(sub, map.get(sub));
      if (immediate) sub.setLocation((java.awt.geom.Point2D.Float) map.get(sub));

      updateSubLocations(sub, immediate, map.get(sub));
    }
    if (node == selectedNode)
      for (ZNode dep : node.getDependencies()) {
        pointMap.put(dep, map.get(dep));
        if (immediate) dep.setLocation((java.awt.geom.Point2D.Float) map.get(dep));
      }
  }
Exemple #2
0
 public ZNode(float x, float y, String name) {
   setLocation(new Point2D.Float(x, y));
   this.setName(name);
 }
Exemple #3
0
 public ZNode() {
   setLocation(new Point2D.Float(0, 0));
 }