static CirclesAndLines calFromCoordinates(Map<S, Pt> coordinates, SS withImage, Collection<Relation> relations) { Rect r = mergeRects(map(f ptToRect, values(coordinates))); BufferedImage img = newBufferedImage(20, 20, Color.white); new CirclesAndLines cal; Map<S, Circle> 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; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009521 |
| Snippet name: | calFromCoordinates |
| Eternal ID of this version: | #1009521/10 |
| Text MD5: | ad85c44165cb7a744c677590e77b1cb1 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-08-06 20:51:43 |
| Source code size: | 1124 bytes / 31 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 714 / 802 |
| Version history: | 9 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |