static CirclesAndLines calFromCoordinates(Map coordinates, SS withImage, Collection relations) { Rect r = mergeRects(map(f ptToRect, values(coordinates))); BufferedImage img = newBufferedImage(20, 20, Color.white); new CirclesAndLines cal; Map circles = caseInsensitiveMap(); for (S node : keys(coordinates)) { Pt p = coordinates.get(node); double x = ((p.x-r.x)/(double) r.w)*0.6+0.2; double y = ((p.y-r.y)/(double) r.h)*0.5+0.2; Circle c; S imgText = mapGet(withImage, node); if (nempty(imgText)) c = cal.circle_autoVis(node, imgText, x, y); else c = cal.circle(img, x, y, node); circles.put(node, c); } for (Relation rel : relations) { if (rel.is("An arrow from * to *")) { Circle a = circles.get(rel.a()), b = circles.get(rel.b()); if (a != null && b != null) cal.addArrow(a, b); } else if (rel.is("An arrow * from * to *")) { Circle a = circles.get(rel.b()), b = circles.get(rel.c()); if (a != null && b != null) cal.addArrow(a, b, rel.a()); } } ret cal; }