/** * Calculates the bounds of all nodes in a given layout. * * @return Point2D[] min bounds, max bounds */ private Point2D[] calcBounds() { Point2D[] result = new Point2D[2]; Point2D min = null; Point2D max = null; Iterator<ONDEXMetaConcept> it = layout.getGraph().getVertices().iterator(); while (it.hasNext()) { Point2D point = layout.transform(it.next()); if (min == null) { min = new Point2D.Double(0, 0); min.setLocation(point); } if (max == null) { max = new Point2D.Double(0, 0); max.setLocation(point); } min.setLocation(Math.min(min.getX(), point.getX()), Math.min(min.getY(), point.getY())); max.setLocation(Math.max(max.getX(), point.getX()), Math.max(max.getY(), point.getY())); } result[0] = min; result[1] = max; return result; }
/** * Calculates the bounds of all nodes in a given layout. * * @return Point2D[] min bounds, max bounds */ private Point2D[] calcBounds() { Point2D[] result = new Point2D[2]; Point2D min = null; Point2D max = null; Iterator<ONDEXMetaConcept> it = layout.getGraph().getVertices() .iterator(); while (it.hasNext()) { Point2D point = layout.transform(it.next()); if (min == null) { min = new Point2D.Double(0, 0); min.setLocation(point); } if (max == null) { max = new Point2D.Double(0, 0); max.setLocation(point); } min.setLocation(Math.min(min.getX(), point.getX()), Math.min(min.getY(), point.getY())); max.setLocation(Math.max(max.getX(), point.getX()), Math.max(max.getY(), point.getY())); } result[0] = min; result[1] = max; return result; }