1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-26 11:52:36 +00:00

fix: partially improve smetana code

https://forum.plantuml.net/17600/note-and-position-not-rendering-correctly-on-cheerpj
This commit is contained in:
Arnaud Roques 2023-03-15 19:03:47 +01:00
parent 9adc8dd067
commit ba0fd1efb4
13 changed files with 858 additions and 194 deletions

View File

@ -83,6 +83,7 @@ import static smetana.core.Macro.GRAPH_LABEL;
import static smetana.core.Macro.GVBEGIN;
import static smetana.core.Macro.LABEL_AT_BOTTOM;
import static smetana.core.Macro.LABEL_AT_TOP;
import static smetana.core.Macro.LEFT_IX;
import static smetana.core.Macro.LOCAL;
import static smetana.core.Macro.LT_HTML;
import static smetana.core.Macro.LT_NONE;
@ -92,12 +93,15 @@ import static smetana.core.Macro.NOCLUST;
import static smetana.core.Macro.NODENAME_ESC;
import static smetana.core.Macro.PAD;
import static smetana.core.Macro.POINTS;
import static smetana.core.Macro.RANKDIR_LR;
import static smetana.core.Macro.RANKDIR_TB;
import static smetana.core.Macro.RIGHT_IX;
import static smetana.core.Macro.TOP_IX;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.Macro.agfindedgeattr;
import static smetana.core.Macro.agfindgraphattr;
import static smetana.core.Macro.agfindnodeattr;
import static smetana.core.Macro.streq;
import static smetana.core.debug.SmetanaDebug.ENTERING;
import static smetana.core.debug.SmetanaDebug.LEAVING;
@ -254,12 +258,12 @@ UNSUPPORTED("abkxekvux4nramryfw2e8vcru"); // putenv(buf);
*/
rankdir = RANKDIR_TB;
if ((p = agget(zz, g, new CString("rankdir")))!=null) {
UNSUPPORTED("sp7zcza7w0dn7t66aj8rf4wn"); // if ((*(p)==*("LR")&&!strcmp(p,"LR")))
UNSUPPORTED("bjd2vk1jssqehllmgnqv601qd"); // rankdir = 1;
UNSUPPORTED("ry8itlrmblmuegdwk1iu1t0x"); // else if ((*(p)==*("BT")&&!strcmp(p,"BT")))
UNSUPPORTED("5hno0xn18yt443qg815w3c2s2"); // rankdir = 2;
UNSUPPORTED("aal39mi047mhafrsrxoutcffk"); // else if ((*(p)==*("RL")&&!strcmp(p,"RL")))
UNSUPPORTED("7vlda224wrgcdhr0ts3mndh5q"); // rankdir = 3;
if (streq(p, "LR"))
rankdir = RANKDIR_LR;
//UNSUPPORTED("ry8itlrmblmuegdwk1iu1t0x"); // else if ((*(p)==*("BT")&&!strcmp(p,"BT")))
//UNSUPPORTED("5hno0xn18yt443qg815w3c2s2"); // rankdir = 2;
//UNSUPPORTED("aal39mi047mhafrsrxoutcffk"); // else if ((*(p)==*("RL")&&!strcmp(p,"RL")))
//UNSUPPORTED("7vlda224wrgcdhr0ts3mndh5q"); // rankdir = 3;
}
if (use_rankdir)
GD_rankdir2(g, (rankdir << 2) | rankdir);
@ -487,13 +491,12 @@ UNSUPPORTED("evu9w6pw3kkh7z8w7t4rx4qxc"); // pos_flag |= 4;
GD_border(sg)[pos_ix].___(dimen);
} else {
/* when rotated, the labels will be restored to TOP or BOTTOM */
UNSUPPORTED("cabz6xbjdvz5vmjulzrhlxh48"); // if ((((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->label_pos) & 1)
UNSUPPORTED("dx7v6663o9o0x1j5r8z4wumxb"); // pos_ix = 1;
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
UNSUPPORTED("97dtv6k7yw1qvfzgs65cj2v0l"); // pos_ix = 3;
UNSUPPORTED("21iuie8b11x65je8vampstgt6"); // (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->border)[pos_ix].x = dimen.y;
UNSUPPORTED("8cawl3kik853hkvgm39y34urs"); // (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->border)[pos_ix].y = dimen.x;
}
if ((GD_label_pos(sg) & LABEL_AT_TOP)!=0)
pos_ix = RIGHT_IX;
else
pos_ix = LEFT_IX;
GD_border(sg)[pos_ix].x = dimen.y;
GD_border(sg)[pos_ix].y = dimen.x; }
}
} finally {
LEAVING("5vks1zdadu5vjinaivs0j2bkb","do_graph_label");

View File

@ -57,6 +57,7 @@ import static gen.lib.cgraph.obj__c.agroot;
import static gen.lib.common.geom__c.ccwrotatepf;
import static gen.lib.common.splines__c.edgeMidpoint;
import static gen.lib.common.splines__c.getsplinepoints;
import static gen.lib.common.utils__c.gv_nodesize;
import static gen.lib.common.utils__c.late_bool;
import static gen.lib.common.utils__c.updateBB;
import static gen.lib.label.xlabels__c.placeLabels;
@ -84,12 +85,22 @@ import static smetana.core.Macro.GD_rankdir;
import static smetana.core.Macro.GRAPH_LABEL;
import static smetana.core.Macro.HEAD_LABEL;
import static smetana.core.Macro.IGNORED;
import static smetana.core.Macro.INCH2PS;
import static smetana.core.Macro.INT_MAX;
import static smetana.core.Macro.LABEL_AT_LEFT;
import static smetana.core.Macro.LABEL_AT_RIGHT;
import static smetana.core.Macro.LABEL_AT_TOP;
import static smetana.core.Macro.LEFT_IX;
import static smetana.core.Macro.ND_coord;
import static smetana.core.Macro.ND_height;
import static smetana.core.Macro.ND_width;
import static smetana.core.Macro.ND_xlabel;
import static smetana.core.Macro.NODE_XLABEL;
import static smetana.core.Macro.RANKDIR_BT;
import static smetana.core.Macro.RANKDIR_LR;
import static smetana.core.Macro.RANKDIR_RL;
import static smetana.core.Macro.RANKDIR_TB;
import static smetana.core.Macro.RIGHT_IX;
import static smetana.core.Macro.TAIL_LABEL;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.debug.SmetanaDebug.ENTERING;
@ -196,9 +207,9 @@ try {
int c;
final ST_boxf bb = new ST_boxf(), new_bb = new ST_boxf();
bb.___(GD_bb(g));
if (rankdir == 1 || rankdir == 2) {
UNSUPPORTED("d4wrtj0h7lkb0e0vernd9czq9"); // new_bb.LL = map_point(pointfof(bb.LL.x, bb.UR.y));
UNSUPPORTED("crysiae5zxc69cj3v2ygfs8xn"); // new_bb.UR = map_point(pointfof(bb.UR.x, bb.LL.y));
if (rankdir == RANKDIR_LR || rankdir == RANKDIR_BT) {
new_bb.LL.___(map_point(zz, pointfof(bb.LL.x, bb.UR.y)));
new_bb.UR.___(map_point(zz, pointfof(bb.UR.x, bb.LL.y)));
} else {
new_bb.LL.___(map_point(zz, pointfof(bb.LL.x, bb.LL.y)));
new_bb.UR.___(map_point(zz, pointfof(bb.UR.x, bb.UR.y)));
@ -231,7 +242,7 @@ try {
return;
for (v = agfstnode(zz, g); v!=null; v = agnxtnode(zz, g, v)) {
if (zz.Rankdir!=0)
UNSUPPORTED("e0j848r4j1j7sojfht5gwikvi"); // gv_nodesize(v, 0);
gv_nodesize(v, false);
ND_coord(v).___(map_point(zz, ND_coord(v)));
if (ND_xlabel(v)!=null)
UNSUPPORTED("3fy0l7w2v24hzrvlpstpknwl7"); // ND_xlabel(v)->pos = map_point(ND_xlabel(v)->pos);
@ -393,8 +404,8 @@ private static void addXLabel_(Globals zz, ST_textlabel_t lp, CArray<ST_object_t
}
if (zz.Flip) {
UNSUPPORTED("99tzt7erbvtfsbo0jbdz0lc8m"); // xlp->sz.x = lp->dimen.y;
UNSUPPORTED("6v5t3ysaisj27bwc0r9zg3rpd"); // xlp->sz.y = lp->dimen.x;
xlp.get__(0).sz.x = lp.dimen.y;
xlp.get__(0).sz.y = lp.dimen.x;
}
else {
xlp.get__(0).sz.___(lp.dimen);
@ -425,8 +436,8 @@ private static ST_boxf addLabelObj_(Globals zz, ST_textlabel_t lp, CArray<ST_obj
ENTERING("dwxd5kvlanbcxqfuncjg0ea54","addLabelObj");
try {
if (zz.Flip) {
UNSUPPORTED("6z2yrwq81gtsk3q9c5pofow1x"); // objp->sz.x = lp->dimen.y;
UNSUPPORTED("8xsm9kavrekjrsydqe1wh1pu"); // objp->sz.y = lp->dimen.x;
objp.get__(0).sz.x = lp.dimen.y;
objp.get__(0).sz.y = lp.dimen.x;
}
else {
objp.get__(0).sz.x = lp.dimen.x;
@ -459,12 +470,12 @@ public static ST_boxf addNodeObj_(Globals zz, ST_Agnode_s np, CArray<ST_object_t
ENTERING("b8tjygxnwny5qoiir1mha1d62","addNodeObj");
try {
if (zz.Flip) {
UNSUPPORTED("1ri5uimcd1z58iix8tp528l1m"); // objp->sz.x = ((ND_height(np))*(double)72);
UNSUPPORTED("6r5gwwhz3sjxrssh8yo3v5c3v"); // objp->sz.y = ((ND_width(np))*(double)72);
objp.get__(0).sz.x = INCH2PS(ND_height(np));
objp.get__(0).sz.y = INCH2PS(ND_width(np));
}
else {
objp.get__(0).sz.x = ((ND_width(np))*(double)72);
objp.get__(0).sz.y = ((ND_height(np))*(double)72);
objp.get__(0).sz.x = INCH2PS(ND_width(np));
objp.get__(0).sz.y = INCH2PS(ND_height(np));
}
objp.get__(0).pos.___(ND_coord(np));
objp.get__(0).pos.x -= (objp.get__(0).sz.x) / 2.0;
@ -748,7 +759,7 @@ try {
zz.Flip = GD_flip(g);
/* Handle cluster labels */
if (zz.Flip)
UNSUPPORTED("4hxky2sp978rmy6018sfmts6m"); // place_flip_graph_label(g);
place_flip_graph_label(g);
else
place_graph_label(g);
/* Everything has been placed except the root graph label, if any.
@ -793,16 +804,16 @@ UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
}
if (allowTranslation!=0) {
switch (zz.Rankdir) {
case 0:
case RANKDIR_TB:
zz.Offset.___(GD_bb(g).LL);
break;
case 1:
UNSUPPORTED("5t3j9lrc86kd5ouaqgzvz3qcm"); // Offset = pointfof(-GD_bb(g).UR.y, GD_bb(g).LL.x);
case RANKDIR_LR:
zz.Offset.___(pointfof(-GD_bb(g).UR.y, GD_bb(g).LL.x));
break;
case 2:
case RANKDIR_BT:
UNSUPPORTED("96ajwnh79ja9g57xmut6dmh9d"); // Offset = pointfof(GD_bb(g).LL.x, -GD_bb(g).UR.y);
break;
case 3:
case RANKDIR_RL:
UNSUPPORTED("3xtu7zkpqq7nsx9oe68oi6ebt"); // Offset = pointfof(GD_bb(g).LL.y, GD_bb(g).LL.x);
break;
}
@ -843,6 +854,48 @@ LEAVING("3qbbvlnq1b06ylgr0yj2slbhm","dotneato_postprocess");
/* place_flip_graph_label:
* Put cluster labels recursively in the flip case.
*/
//3 ehe7n8wkl4thn86tisjzdotpq
//static void place_flip_graph_label(graph_t * g)
@Unused
@Original(version="2.38.0", path="lib/common/postproc.c", name="place_flip_graph_label", key="ehe7n8wkl4thn86tisjzdotpq", definition="static void place_flip_graph_label(graph_t * g)")
public static void place_flip_graph_label(ST_Agraph_s g) {
ENTERING("3zsjtcmcfxhkmaagi0on4dy20","place_flip_graph_label");
try {
int c;
final ST_pointf p = new ST_pointf(), d = new ST_pointf();
if ((g != agroot(g)) && (GD_label(g)!=null) && GD_label(g).set==0) {
if ((GD_label_pos(g) & LABEL_AT_TOP)!=0) {
d.___(GD_border(g)[RIGHT_IX]);
p.x = GD_bb(g).UR.x - d.x / 2;
} else {
d.___(GD_border(g)[LEFT_IX]);
p.x = GD_bb(g).LL.x + d.x / 2;
}
if ((GD_label_pos(g) & LABEL_AT_RIGHT)!=0) {
p.y = GD_bb(g).LL.y + d.y / 2;
} else if ((GD_label_pos(g) & LABEL_AT_LEFT)!=0) {
p.y = GD_bb(g).UR.y - d.y / 2;
} else {
p.y = (GD_bb(g).LL.y + GD_bb(g).UR.y) / 2;
}
GD_label(g).pos.___(p);
GD_label(g).set = 1;
}
for (c = 1; c <= GD_n_cluster(g); c++)
place_flip_graph_label(GD_clust(g).get_(c));
} finally {
LEAVING("72zw1alhd5vd0g6mhum507rvx", "place_graph_label");
}
}

View File

@ -700,8 +700,8 @@ UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
} else {
/* get point and node size adjusted for rankdir=LR */
if (GD_flip(agraphof(n))) {
UNSUPPORTED("dapvd4c0ggliaqcj08jvao221"); // ysize = ND_lw(n) + ND_rw(n);
UNSUPPORTED("8t3g4d9acruono62leh5a8hxh"); // xsize = ND_ht(n);
zz.ysize = ND_lw(n) + ND_rw(n);
zz.xsize = ND_ht(n);
} else {
zz.xsize = ND_lw(n) + ND_rw(n);
zz.ysize = ND_ht(n);

View File

@ -208,7 +208,8 @@ try {
rv.ncols = j;
// Arnaud 15/09/2022: the j+1 is needed in some case to avoid ArrayIndexOutOfBoundsException
// Arnaud 02/03/2023: the j+3 is needed in some case to avoid ArrayIndexOutOfBoundsException
rv.data = new int[i][j+3]; // Or maybe new int[j][i] ?
// Arnaud 15/03/2023: the i+3 is needed in some case to avoid ArrayIndexOutOfBoundsException when LR direction
rv.data = new int[i+3][j+3]; // Or maybe new int[j][i] ?
return rv;
} finally {
LEAVING("756bre1tpxb1tq68p7xhkrxkc","new_matrix");

View File

@ -96,6 +96,7 @@ import static smetana.core.Macro.GD_ranksep;
import static smetana.core.Macro.GD_rn;
import static smetana.core.Macro.INT_MAX;
import static smetana.core.Macro.LEAFSET;
import static smetana.core.Macro.LEFT_IX;
import static smetana.core.Macro.M_aghead;
import static smetana.core.Macro.M_agtail;
import static smetana.core.Macro.ND_UF_size;
@ -120,6 +121,7 @@ import static smetana.core.Macro.ND_ranktype;
import static smetana.core.Macro.ND_rw;
import static smetana.core.Macro.ND_save_in;
import static smetana.core.Macro.ND_save_out;
import static smetana.core.Macro.RIGHT_IX;
import static smetana.core.Macro.ROUND;
import static smetana.core.Macro.TOP_IX;
import static smetana.core.Macro.UNSUPPORTED;
@ -163,6 +165,389 @@ import smetana.core.ZType;
public class position__c {
//3 ciez0pfggxdljedzsbklq49f0
// static inline point pointof(int x, int y)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="pointof", key="ciez0pfggxdljedzsbklq49f0", definition="static inline point pointof(int x, int y)")
public static Object pointof(Object... arg) {
UNSUPPORTED("8e4tj258yvfq5uhsdpk37n5eq"); // static inline point pointof(int x, int y)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
UNSUPPORTED("12jimkrzqxavaie0cpapbx18c"); // r.x = x;
UNSUPPORTED("7ivmviysahgsc5nn9gtp7q2if"); // r.y = y;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 7cufnfitrh935ew093mw0i4b7
// static inline box boxof(int llx, int lly, int urx, int ury)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="boxof", key="7cufnfitrh935ew093mw0i4b7", definition="static inline box boxof(int llx, int lly, int urx, int ury)")
public static Object boxof(Object... arg) {
UNSUPPORTED("3lzesfdd337h31jrlib1czocm"); // static inline box boxof(int llx, int lly, int urx, int ury)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
UNSUPPORTED("cylhjlutoc0sc0uy7g98m9fb8"); // b.LL.x = llx, b.LL.y = lly;
UNSUPPORTED("242of6revxzx8hpe7yerrchz6"); // b.UR.x = urx, b.UR.y = ury;
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 1n5xl70wxuabyf97mclvilsm6
// static inline point add_point(point p, point q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="add_point", key="1n5xl70wxuabyf97mclvilsm6", definition="static inline point add_point(point p, point q)")
public static Object add_point(Object... arg) {
UNSUPPORTED("6iamka1fx8fk1rohzzse8phte"); // static inline point add_point(point p, point q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
UNSUPPORTED("3n2sizjd0civbzm6iq7su1s2p"); // r.x = p.x + q.x;
UNSUPPORTED("65ygdo31w09i5i6bd2f7azcd3"); // r.y = p.y + q.y;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 ai2dprak5y6obdsflguh5qbd7
// static inline point sub_point(point p, point q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="sub_point", key="ai2dprak5y6obdsflguh5qbd7", definition="static inline point sub_point(point p, point q)")
public static Object sub_point(Object... arg) {
UNSUPPORTED("cd602849h0bce8lu9xegka0ia"); // static inline point sub_point(point p, point q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); // r.x = p.x - q.x;
UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); // r.y = p.y - q.y;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 16f6pyogcv3j7n2p0n8giqqgh
// static inline pointf sub_pointf(pointf p, pointf q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="sub_pointf", key="16f6pyogcv3j7n2p0n8giqqgh", definition="static inline pointf sub_pointf(pointf p, pointf q)")
public static Object sub_pointf(Object... arg) {
UNSUPPORTED("dmufj44lddsnj0wjyxsg2fcso"); // static inline pointf sub_pointf(pointf p, pointf q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
UNSUPPORTED("4q4q9dveah93si8ajfv59gz27"); // r.x = p.x - q.x;
UNSUPPORTED("9f90ik0o2yqhanzntpy3d2ydy"); // r.y = p.y - q.y;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 9k50jgrhc4f9824vf8ony74rw
// static inline point mid_point(point p, point q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="mid_point", key="9k50jgrhc4f9824vf8ony74rw", definition="static inline point mid_point(point p, point q)")
public static Object mid_point(Object... arg) {
UNSUPPORTED("evy44tdsmu3erff9dp2x835u2"); // static inline point mid_point(point p, point q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
UNSUPPORTED("1a6p6fm57o0wt5ze2btsx06c7"); // r.x = (p.x + q.x) / 2;
UNSUPPORTED("1kbj5tgdmfi6kf4jgg6skhr6e"); // r.y = (p.y + q.y) / 2;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 59c4f7im0ftyowhnzzq2v9o1x
// static inline pointf mid_pointf(pointf p, pointf q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="mid_pointf", key="59c4f7im0ftyowhnzzq2v9o1x", definition="static inline pointf mid_pointf(pointf p, pointf q)")
public static Object mid_pointf(Object... arg) {
UNSUPPORTED("381o63o9kb04d7gzg65v0r3q"); // static inline pointf mid_pointf(pointf p, pointf q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
UNSUPPORTED("c5vboetlr3mf43wns7iik6m1w"); // r.x = (p.x + q.x) / 2.;
UNSUPPORTED("bcdf562ldr3bjn78hcay5xd63"); // r.y = (p.y + q.y) / 2.;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 5r18p38gisvcx3zsvbb9saixx
// static inline pointf interpolate_pointf(double t, pointf p, pointf q)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="interpolate_pointf", key="5r18p38gisvcx3zsvbb9saixx", definition="static inline pointf interpolate_pointf(double t, pointf p, pointf q)")
public static Object interpolate_pointf(Object... arg) {
UNSUPPORTED("894yimn33kmtm454llwdaotu8"); // static inline pointf interpolate_pointf(double t, pointf p, pointf q)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("ef2acl8wa2ooqcb5vz3098maz"); // pointf r;
UNSUPPORTED("5tpwuyf5iidesy80v8o4nwkmk"); // r.x = p.x + t * (q.x - p.x);
UNSUPPORTED("ewnrc5uloj3w5jbmsjcn3wja0"); // r.y = p.y + t * (q.y - p.y);
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 bxzrv2ghq04qk5cbyy68s4mol
// static inline point exch_xy(point p)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="exch_xy", key="bxzrv2ghq04qk5cbyy68s4mol", definition="static inline point exch_xy(point p)")
public static Object exch_xy(Object... arg) {
UNSUPPORTED("2vxya0v2fzlv5e0vjaa8d414"); // static inline point exch_xy(point p)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c0j3k9xv06332q98k2pgpacto"); // point r;
UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); // r.x = p.y;
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 9lt3e03tac6h6sydljrcws8fd
// static inline pointf exch_xyf(pointf p)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="exch_xyf", key="9lt3e03tac6h6sydljrcws8fd", definition="static inline pointf exch_xyf(pointf p)")
public static Object exch_xyf(Object... arg) {
UNSUPPORTED("8qamrobrqi8jsvvfrxkimrsnw"); // static inline pointf exch_xyf(pointf p)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
UNSUPPORTED("60cojdwc2h7f0m51s9jdwvup7"); // r.x = p.y;
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 8l9qhieokthntzdorlu5zn29b
// static inline box box_bb(box b0, box b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="box_bb", key="8l9qhieokthntzdorlu5zn29b", definition="static inline box box_bb(box b0, box b1)")
public static Object box_bb(Object... arg) {
UNSUPPORTED("36et5gmnjrby6o7bq9sgh1hx6"); // static inline box box_bb(box b0, box b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); // b.LL.x = MIN(b0.LL.x, b1.LL.x);
UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); // b.LL.y = MIN(b0.LL.y, b1.LL.y);
UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); // b.UR.x = MAX(b0.UR.x, b1.UR.x);
UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); // b.UR.y = MAX(b0.UR.y, b1.UR.y);
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 clws9h3bbjm0lw3hexf8nl4c4
// static inline boxf boxf_bb(boxf b0, boxf b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="boxf_bb", key="clws9h3bbjm0lw3hexf8nl4c4", definition="static inline boxf boxf_bb(boxf b0, boxf b1)")
public static Object boxf_bb(Object... arg) {
UNSUPPORTED("dyrqu4ww9osr9c86gqgmifcp6"); // static inline boxf boxf_bb(boxf b0, boxf b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); // boxf b;
UNSUPPORTED("8mr2c9xitsqi8z1plbp7ox1hu"); // b.LL.x = MIN(b0.LL.x, b1.LL.x);
UNSUPPORTED("2egu55ef4u1i03nwz01k7kcrl"); // b.LL.y = MIN(b0.LL.y, b1.LL.y);
UNSUPPORTED("9n6ei3odbgefwfxvql9whcpe"); // b.UR.x = MAX(b0.UR.x, b1.UR.x);
UNSUPPORTED("19ocysbuh4pxyft2bqhyhigr1"); // b.UR.y = MAX(b0.UR.y, b1.UR.y);
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 bit6ycxo1iqd2al92y8gkzlvb
// static inline box box_intersect(box b0, box b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="box_intersect", key="bit6ycxo1iqd2al92y8gkzlvb", definition="static inline box box_intersect(box b0, box b1)")
public static Object box_intersect(Object... arg) {
UNSUPPORTED("34gv28cldst09bl71itjgviue"); // static inline box box_intersect(box b0, box b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("52u27kayecy1i1e8bbo8f7s9r"); // box b;
UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); // b.LL.x = MAX(b0.LL.x, b1.LL.x);
UNSUPPORTED("3uv943c2f82yuif249pf5azob"); // b.LL.y = MAX(b0.LL.y, b1.LL.y);
UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); // b.UR.x = MIN(b0.UR.x, b1.UR.x);
UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); // b.UR.y = MIN(b0.UR.y, b1.UR.y);
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 8gfybie7k6pgb3o1a6llgpwng
// static inline boxf boxf_intersect(boxf b0, boxf b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="boxf_intersect", key="8gfybie7k6pgb3o1a6llgpwng", definition="static inline boxf boxf_intersect(boxf b0, boxf b1)")
public static Object boxf_intersect(Object... arg) {
UNSUPPORTED("ape22b8z6jfg17gvo42hok9eb"); // static inline boxf boxf_intersect(boxf b0, boxf b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("c57pq0f87j6dnbcvygu7v6k84"); // boxf b;
UNSUPPORTED("9slu7bixuymxttjic76ha2nl2"); // b.LL.x = MAX(b0.LL.x, b1.LL.x);
UNSUPPORTED("3uv943c2f82yuif249pf5azob"); // b.LL.y = MAX(b0.LL.y, b1.LL.y);
UNSUPPORTED("74tf5h16bc9zabq3s3dyny543"); // b.UR.x = MIN(b0.UR.x, b1.UR.x);
UNSUPPORTED("d99gcv3i7xes7y7rqf8ii20ux"); // b.UR.y = MIN(b0.UR.y, b1.UR.y);
UNSUPPORTED("2vmm1j57brhn455f8f3iyw6mo"); // return b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 7z8j2quq65govaaejrz7b4cvb
// static inline int box_overlap(box b0, box b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="box_overlap", key="7z8j2quq65govaaejrz7b4cvb", definition="static inline int box_overlap(box b0, box b1)")
public static Object box_overlap(Object... arg) {
UNSUPPORTED("1e9k599x7ygct7r4cfdxlk9u9"); // static inline int box_overlap(box b0, box b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); // return OVERLAP(b0, b1);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 4z0suuut2acsay5m8mg9dqjdu
// static inline int boxf_overlap(boxf b0, boxf b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="boxf_overlap", key="4z0suuut2acsay5m8mg9dqjdu", definition="static inline int boxf_overlap(boxf b0, boxf b1)")
public static Object boxf_overlap(Object... arg) {
UNSUPPORTED("905nejsewihwhhc3bhnrz9nwo"); // static inline int boxf_overlap(boxf b0, boxf b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("7a9wwpu7dhdphd08y1ecw54w5"); // return OVERLAP(b0, b1);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 dd34swz5rmdgu3a2np2a4h1dy
// static inline int box_contains(box b0, box b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="box_contains", key="dd34swz5rmdgu3a2np2a4h1dy", definition="static inline int box_contains(box b0, box b1)")
public static Object box_contains(Object... arg) {
UNSUPPORTED("aputfc30fjkvy6jx4otljaczq"); // static inline int box_contains(box b0, box b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); // return CONTAINS(b0, b1);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 8laj1bspbu2i1cjd9upr7xt32
// static inline int boxf_contains(boxf b0, boxf b1)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="boxf_contains", key="8laj1bspbu2i1cjd9upr7xt32", definition="static inline int boxf_contains(boxf b0, boxf b1)")
public static Object boxf_contains(Object... arg) {
UNSUPPORTED("7ccnttkiwt834yfyw0evcm18v"); // static inline int boxf_contains(boxf b0, boxf b1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("87ap80vrh2a4gpprbxr33lrg3"); // return CONTAINS(b0, b1);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 4wf5swkz24xx51ja2dynbycu1
// static inline pointf perp (pointf p)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="perp", key="4wf5swkz24xx51ja2dynbycu1", definition="static inline pointf perp (pointf p)")
public static Object perp(Object... arg) {
UNSUPPORTED("567wpqlg9rv63ynyvxd9sgkww"); // static inline pointf perp (pointf p)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
UNSUPPORTED("2fyydy6t6yifjsczccsb9szeg"); // r.x = -p.y;
UNSUPPORTED("evp2x66oa4s1tlnc0ytxq2qbq"); // r.y = p.x;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 6dtlpzv4mvgzb9o0b252yweuv
// static inline pointf scale (double c, pointf p)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="scale", key="6dtlpzv4mvgzb9o0b252yweuv", definition="static inline pointf scale (double c, pointf p)")
public static Object scale(Object... arg) {
UNSUPPORTED("c1ngytew34bmkdb7vps5h3dh8"); // static inline pointf scale (double c, pointf p)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("cvexv13y9fq49v0j4d5t4cm9f"); // pointf r;
UNSUPPORTED("dznf7nac14snww4usquyd6r3r"); // r.x = c * p.x;
UNSUPPORTED("33kk73m8vjcux5tnjl8co2pe6"); // r.y = c * p.y;
UNSUPPORTED("a2hk6w52njqjx48nq3nnn2e5i"); // return r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
//3 6knxbdrmgk6294aw61s2lpvvf
// static double largeMinlen (double l)
@ -865,6 +1250,113 @@ LEAVING("1oobmglea9t819y95xeel37h8","set_xcoords");
//3 6mip7s1k9xt9tp6x6nnsbt34p
//static void adjustSimple(graph_t * g, int delta, int margin_total)
@Unused
@Original(version="2.38.0", path="lib/dotgen/position.c", name="adjustSimple", key="6mip7s1k9xt9tp6x6nnsbt34p", definition="static void adjustSimple(graph_t * g, int delta, int margin_total)")
public static void adjustSimple(ST_Agraph_s g, int delta, int margin_total) {
ENTERING("6b5zs45snahyh3bzod53vasjx", "adjustSimple");
try {
int r, bottom, deltop, delbottom;
ST_Agraph_s root = dot_root(g);
CArray<ST_rank_t> rank = GD_rank(root);
int maxr = GD_maxrank(g);
int minr = GD_minrank(g);
bottom = (delta+1) / 2;
delbottom = (int)(GD_ht1(g) + bottom - (rank.get__(maxr).ht1 - margin_total));
if (delbottom > 0) {
for (r = maxr; r >= minr; r--) {
if (rank.get__(r).n > 0)
ND_coord(rank.get__(r).v.get_(0)).y += delbottom;
}
deltop = (int)(GD_ht2(g) + (delta-bottom) + delbottom - (rank.get__(minr).ht2 - margin_total));
}
else
deltop = (int)(GD_ht2(g) + (delta-bottom) - (rank.get__(minr).ht2 - margin_total));
if (deltop > 0) {
for (r = minr-1; r >= GD_minrank(root); r--) {
if (rank.get__(r).n > 0)
ND_coord(rank.get__(r).v.get_(0)).y += deltop;
}
}
GD_ht2(g, GD_ht2(g) + (delta - bottom));
GD_ht1(g, GD_ht1(g) + bottom);
} finally {
LEAVING("47ywar141vmwjartmboxs38cz", "adjustRanks");
}
}
/* adjustRanks:
* Recursively adjust ranks to take into account
* wide cluster labels when rankdir=LR.
* We divide the extra space between the top and bottom.
* Adjust the ht1 and ht2 values in the process.
*/
//3 9sv968rni5moio662r9kjzai3
//static void adjustRanks(graph_t * g, int margin_total)
@Unused
@Original(version = "2.38.0", path = "lib/dotgen/position.c", name = "adjustRanks", key = "9sv968rni5moio662r9kjzai3", definition = "static void adjustRanks(graph_t * g, int margin_total)")
public static void adjustRanks(Globals zz, ST_Agraph_s g, int margin_total) {
ENTERING("47ywar141vmwjartmboxs38cz", "adjustRanks");
try {
double lht; /* label height */
double rht; /* height between top and bottom ranks */
int maxr, minr, margin;
int c;
double delta, ht1, ht2;
CArray<ST_rank_t> rank = GD_rank(dot_root(g));
if (g == dot_root(g))
margin = 0;
else
margin = late_int (g, zz.G_margin, CL_OFFSET, 0);
ht1 = GD_ht1(g);
ht2 = GD_ht2(g);
for (c = 1; c <= GD_n_cluster(g); c++) {
ST_Agraph_s subg = GD_clust(g).get_(c);
adjustRanks(zz, subg, margin+margin_total);
if (GD_maxrank(subg) == GD_maxrank(g))
ht1 = Math.max(ht1, GD_ht1(subg) + margin);
if (GD_minrank(subg) == GD_minrank(g))
ht2 = Math.max(ht2, GD_ht2(subg) + margin);
}
GD_ht1(g, ht1);
GD_ht2(g, ht2);
if ((g != dot_root(g)) && GD_label(g)!=null) {
lht = Math.max(GD_border(g)[LEFT_IX].y, GD_border(g)[RIGHT_IX].y);
maxr = GD_maxrank(g);
minr = GD_minrank(g);
rht = ND_coord(rank.get__(minr).v.get_(0)).y - ND_coord(rank.get__(maxr).v.get_(0)).y;
delta = lht - (rht + ht1 + ht2);
if (delta > 0) {
adjustSimple(g, (int) delta, margin_total);
}
}
/* update the global ranks */
if (g != dot_root(g)) {
rank.get__(GD_minrank(g)).ht2 = Math.max(rank.get__(GD_minrank(g)).ht2, GD_ht2(g));
rank.get__(GD_maxrank(g)).ht1 = Math.max(rank.get__(GD_maxrank(g)).ht1, GD_ht1(g));
}
} finally {
LEAVING("47ywar141vmwjartmboxs38cz", "adjustRanks");
}
}
@ -1006,19 +1498,19 @@ try {
* handling equal spacing as a special case.
*/
if (lbl!=0 && GD_flip(g)) {
UNSUPPORTED("bxjqk5nu40mwo1156dicr9tur"); // adjustRanks(g, 0);
UNSUPPORTED("6vy9qfed3u61pmvy12724s9l4"); // if (GD_exact_ranksep(g)) { /* recompute maxht */
UNSUPPORTED("74f5n6u4x39ngn0gsan7fgzyr"); // maxht = 0;
UNSUPPORTED("2pd9g1n9b0746fgt892degls3"); // r = GD_maxrank(g);
UNSUPPORTED("8dils3hlxottsbf2iuapvhqeq"); // d0 = (ND_coord(rank[r].v[0])).y;
UNSUPPORTED("cw5accmrcan3lqfc789udgcka"); // while (--r >= GD_minrank(g)) {
UNSUPPORTED("6bxo7bknt38qh9t31zr7p6kie"); // d1 = (ND_coord(rank[r].v[0])).y;
UNSUPPORTED("b1ta7vjm5i7swyklhfwy27w35"); // delta = d1 - d0;
UNSUPPORTED("65l8hg0imd48bfdu614k2kylt"); // maxht = MAX(maxht, delta);
UNSUPPORTED("5irf6cp6xdzi2ik033azsbauo"); // d0 = d1;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
}
adjustRanks(zz, g, 0);
if (GD_exact_ranksep(g)!=0) { /* recompute maxht */
maxht = 0;
r = GD_maxrank(g);
d0 = (ND_coord(rank.get__(r).v.get_(0))).y;
while (--r >= GD_minrank(g)) {
d1 = (ND_coord(rank.get__(r).v.get_(0))).y;
delta = d1 - d0;
maxht = Math.max(maxht, delta);
d0 = d1;
}
}
}
/* re-assign if ranks are equally spaced */
if (GD_exact_ranksep(g)!=0) {

View File

@ -90,6 +90,10 @@ public class MinMaxMutable {
this.minY = Math.min(y, minY);
}
public void addPoint(XPoint2D pt) {
addPoint(pt.getX(), pt.getY());
}
public static MinMaxMutable fromMax(double maxX, double maxY) {
if (Double.isNaN(maxX))
throw new IllegalArgumentException();

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.klimt.geom;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.utils.MathUtils;
public class RectangleArea {
@ -51,8 +52,9 @@ public class RectangleArea {
this.maxY = maxY;
}
public static RectangleArea build(XPoint2D min, XPoint2D max) {
return new RectangleArea(min.x, min.y, max.x, max.y);
public static RectangleArea build(XPoint2D pt1, XPoint2D pt2) {
return new RectangleArea(MathUtils.min(pt1.x, pt2.x), MathUtils.min(pt1.y, pt2.y), MathUtils.max(pt1.x, pt2.x),
MathUtils.max(pt1.y, pt2.y));
}
public RectangleArea move(double deltaX, double deltaY) {

View File

@ -48,6 +48,10 @@ public class XDimension2D {
final private double height;
public XDimension2D(double width, double height) {
if (width < 0)
throw new IllegalArgumentException();
if (height < 0)
throw new IllegalArgumentException();
if (Double.isNaN(width) || Double.isNaN(height))
throw new IllegalArgumentException();

View File

@ -0,0 +1,106 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.sdot;
import h.ST_Agnode_s;
import h.ST_Agnodeinfo_t;
import h.ST_Agraphinfo_t;
import h.ST_boxf;
import h.ST_textlabel_t;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
public class BoxInfo {
private final XPoint2D upperRight;
private final XPoint2D lowerLeft;
private BoxInfo(XPoint2D upperRight, XPoint2D lowerLeft) {
this.upperRight = upperRight;
this.lowerLeft = lowerLeft;
}
public static BoxInfo fromTextlabel(ST_textlabel_t label) {
final double x = label.pos.x;
final double y = label.pos.y;
final double width = label.dimen.x;
final double height = label.dimen.y;
final XPoint2D upperRight = new XPoint2D(x + width / 2, y - height / 2);
final XPoint2D lowerLeft = new XPoint2D(x - width / 2, y + height / 2);
return new BoxInfo(upperRight, lowerLeft);
}
public static BoxInfo fromNode(ST_Agnode_s node) {
final ST_Agnodeinfo_t data = (ST_Agnodeinfo_t) node.data;
final double width = data.width * 72;
final double height = data.height * 72;
final double x = data.coord.x;
final double y = data.coord.y;
final XPoint2D upperRight = new XPoint2D(x + width / 2, y - height / 2);
final XPoint2D lowerLeft = new XPoint2D(x - width / 2, y + height / 2);
return new BoxInfo(upperRight, lowerLeft);
}
public XDimension2D getDimension() {
final double width = upperRight.getX() - lowerLeft.getX();
final double height = lowerLeft.getY() - upperRight.getY();
return new XDimension2D(width, height);
}
public static BoxInfo fromGraphInfo(ST_Agraphinfo_t data) {
final ST_boxf bb = (ST_boxf) data.bb;
final double llx = bb.LL.x;
final double lly = bb.LL.y;
final double urx = bb.UR.x;
final double ury = bb.UR.y;
final XPoint2D upperRight = new XPoint2D(urx, ury);
final XPoint2D lowerLeft = new XPoint2D(llx, lly);
return new BoxInfo(upperRight, lowerLeft);
}
public final XPoint2D getUpperRight() {
return upperRight;
}
public final XPoint2D getLowerLeft() {
return lowerLeft;
}
}

View File

@ -55,12 +55,10 @@ import java.util.concurrent.locks.ReentrantLock;
import h.ST_Agedge_s;
import h.ST_Agnode_s;
import h.ST_Agnodeinfo_t;
import h.ST_Agraph_s;
import h.ST_Agraphinfo_t;
import h.ST_Agrec_s;
import h.ST_GVC_s;
import h.ST_boxf;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
@ -80,6 +78,7 @@ import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.geom.MinMaxMutable;
import net.sourceforge.plantuml.klimt.geom.Rankdir;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
@ -106,27 +105,25 @@ import smetana.core.Macro;
import smetana.core.debug.SmetanaDebug;
public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
// ::remove folder when __HAXE__
// ::remove folder when __HAXE__
private final ICucaDiagram diagram;
private final StringBounder stringBounder;
private final Map<Entity, ST_Agnode_s> nodes = new LinkedHashMap<Entity, ST_Agnode_s>();
private final Map<Entity, ST_Agnode_s> coreNodes = new LinkedHashMap<Entity, ST_Agnode_s>();
private final Map<Link, ST_Agedge_s> edges = new LinkedHashMap<Link, ST_Agedge_s>();
private final Map<Entity, ST_Agraph_s> clusters = new LinkedHashMap<Entity, ST_Agraph_s>();
private final DotStringFactory dotStringFactory;
private final Rankdir rankdir;
private MinMaxMutable getSmetanaMinMax() {
final MinMaxMutable result = MinMaxMutable.getEmpty(false);
for (ST_Agnode_s n : nodes.values()) {
final ST_Agnodeinfo_t data = (ST_Agnodeinfo_t) n.data;
final double width = data.width * 72;
final double height = data.height * 72;
final double x = data.coord.x;
final double y = data.coord.y;
result.addPoint(x - width / 2, y - height / 2);
result.addPoint(x + width / 2, y + height / 2);
final BoxInfo data = BoxInfo.fromNode(n);
result.addPoint(data.getUpperRight());
result.addPoint(data.getLowerLeft());
}
for (ST_Agraph_s gr : clusters.values()) {
final ST_Agrec_s tmp1 = gr.data;
@ -134,15 +131,10 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
System.err.println("ERROR IN CucaDiagramFileMakerSmetana");
continue;
}
final ST_Agraphinfo_t data = (ST_Agraphinfo_t) tmp1;
final ST_boxf bb = (ST_boxf) data.bb;
final double llx = bb.LL.x;
final double lly = bb.LL.y;
final double urx = bb.UR.x;
final double ury = bb.UR.y;
result.addPoint(llx, lly);
result.addPoint(urx, ury);
final ST_Agraphinfo_t info = (ST_Agraphinfo_t) tmp1;
final BoxInfo data = BoxInfo.fromGraphInfo(info);
result.addPoint(data.getUpperRight());
result.addPoint(data.getLowerLeft());
}
return result;
@ -181,7 +173,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
final ST_Agedge_s edge = ent.getValue();
new SmetanaPath(link, edge, ymirror, diagram, getLabel(link), getQuantifier(link, 1),
getQuantifier(link, 2)).drawU(ug);
getQuantifier(link, 2), dotStringFactory.getBibliotekon()).drawU(ug);
}
}
@ -190,13 +182,8 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
private XPoint2D getCorner(ST_Agnode_s n) {
final ST_Agnodeinfo_t data = (ST_Agnodeinfo_t) n.data;
final double width = data.width * 72;
final double height = data.height * 72;
final double x = data.coord.x;
final double y = data.coord.y;
return ymirror.getMirrored(new XPoint2D(x - width / 2, y + height / 2));
final BoxInfo data = BoxInfo.fromNode(n);
return ymirror.getMirrored(data.getLowerLeft());
}
public HColor getBackcolor() {
@ -209,6 +196,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
this.diagram = diagram;
this.stringBounder = stringBounder;
this.dotStringFactory = new DotStringFactory(stringBounder, diagram);
this.rankdir = diagram.getSkinParam().getRankdir();
printAllSubgroups(diagram.getRootGroup());
printEntities(getUnpackagedEntities());
@ -220,19 +208,17 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
try {
final ST_Agrec_s tmp1 = gr.data;
final ST_Agraphinfo_t data = (ST_Agraphinfo_t) tmp1;
final ST_boxf bb = (ST_boxf) data.bb;
final double llx = bb.LL.x;
final double ury = ymirror.getMirrored(bb.LL.y);
final double lly = ymirror.getMirrored(bb.UR.y);
final double urx = bb.UR.x;
final BoxInfo boxInfo = BoxInfo.fromGraphInfo(data);
final XPoint2D upperRight = ymirror.getMirrored(boxInfo.getUpperRight());
final XPoint2D lowerLeft = ymirror.getMirrored(boxInfo.getLowerLeft());
final Cluster cluster = dotStringFactory.getBibliotekon().getCluster(group);
cluster.setPosition(new XPoint2D(llx, lly), new XPoint2D(urx, ury));
cluster.setPosition(upperRight, lowerLeft);
final XDimension2D dimTitle = cluster.getTitleDimension(ug.getStringBounder());
if (dimTitle != null) {
final double x = (llx + urx) / 2 - dimTitle.getWidth() / 2;
cluster.setTitlePosition(new XPoint2D(x, lly));
final double x = (upperRight.getX() + lowerLeft.getX()) / 2 - dimTitle.getWidth() / 2;
cluster.setTitlePosition(new XPoint2D(x, Math.min(upperRight.getY(), lowerLeft.getY())));
}
JUtils.LOG2("cluster=" + cluster);
cluster.drawU(ug, diagram.getUmlDiagramType(), diagram.getSkinParam());
@ -280,28 +266,51 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
}
private void exportEntities(Globals zz, ST_Agraph_s g, Collection<Entity> entities) {
private void exportEntities(Globals zz, ST_Agraph_s cluster, Collection<Entity> entities) {
for (Entity ent : entities) {
if (ent.isRemoved())
continue;
exportEntity(zz, g, ent);
exportEntity(zz, cluster, ent);
}
}
private void exportEntity(Globals zz, ST_Agraph_s g, Entity leaf) {
private XDimension2D getDim(SvekNode node) {
final double width = node.getWidth() / 72;
final double height = node.getHeight() / 72;
return new XDimension2D(width, height);
}
private ST_Agnode_s getCoreFromGroup(Globals zz, Entity group) {
ST_Agnode_s result = coreNodes.get(group);
if (result != null)
return result;
final ST_Agraph_s cluster = clusters.get(group);
if (cluster == null)
throw new IllegalStateException();
result = agnode(zz, cluster, new CString("z" + group.getUid()), true);
agsafeset(zz, result, new CString("shape"), new CString("box"), new CString(""));
agsafeset(zz, result, new CString("width"), new CString("1"), new CString(""));
agsafeset(zz, result, new CString("height"), new CString("1"), new CString(""));
coreNodes.put(group, result);
return result;
}
private void exportEntity(Globals zz, ST_Agraph_s cluster, Entity leaf) {
final SvekNode node = dotStringFactory.getBibliotekon().getNode(leaf);
if (node == null) {
System.err.println("CANNOT FIND NODE");
return;
}
// System.err.println("exportEntity " + leaf);
final ST_Agnode_s agnode = agnode(zz, g, new CString(node.getUid()), true);
final ST_Agnode_s agnode = agnode(zz, cluster, new CString(node.getUid()), true);
agsafeset(zz, agnode, new CString("shape"), new CString("box"), new CString(""));
final String width = "" + (node.getWidth() / 72);
final String height = "" + (node.getHeight() / 72);
final XDimension2D dim = getDim(node);
final String width = "" + dim.getWidth();
final String height = "" + dim.getHeight();
agsafeset(zz, agnode, new CString("width"), new CString(width), new CString(""));
agsafeset(zz, agnode, new CString("height"), new CString(height), new CString(""));
// System.err.println("NODE " + leaf.getUid() + " " + width + " " + height);
nodes.put(leaf, agnode);
}
@ -324,19 +333,18 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
return result;
}
private void printCluster(Globals zz, ST_Agraph_s g, Cluster cluster) {
for (SvekNode node : cluster.getNodes()) {
final ST_Agnode_s agnode = agnode(zz, g, new CString(node.getUid()), true);
agsafeset(zz, agnode, new CString("shape"), new CString("box"), new CString(""));
final String width = "" + (node.getWidth() / 72);
final String height = "" + (node.getHeight() / 72);
agsafeset(zz, agnode, new CString("width"), new CString(width), new CString(""));
agsafeset(zz, agnode, new CString("height"), new CString(height), new CString(""));
final Entity leaf = dotStringFactory.getBibliotekon().getLeaf(node);
nodes.put(leaf, agnode);
}
}
// private void printCluster(Globals zz, ST_Agraph_s g, Cluster cluster) {
// for (SvekNode node : cluster.getNodes()) {
// final ST_Agnode_s agnode = agnode(zz, g, new CString(node.getUid()), true);
// agsafeset(zz, agnode, new CString("shape"), new CString("box"), new CString(""));
// final String width = "" + (node.getWidth() / 72);
// final String height = "" + (node.getHeight() / 72);
// agsafeset(zz, agnode, new CString("width"), new CString(width), new CString(""));
// agsafeset(zz, agnode, new CString("height"), new CString(height), new CString(""));
// final Entity leaf = dotStringFactory.getBibliotekon().getLeaf(node);
// nodes.put(leaf, agnode);
// }
// }
private static final Lock lock = new ReentrantLock();
@ -401,6 +409,8 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
final ST_GVC_s gvc = gvContext(zz);
SmetanaDebug.reset();
if (rankdir == Rankdir.LEFT_TO_RIGHT)
agsafeset(zz, g, new CString("rankdir"), new CString("LR"), new CString("LR"));
gvLayoutJobs(zz, gvc, g);
SmetanaDebug.printMe();
@ -433,14 +443,17 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
if (cluster.isLabel()) {
final double width = cluster.getTitleAndAttributeWidth();
final double height = cluster.getTitleAndAttributeHeight() - 5;
agsafeset(zz, cluster1, new CString("label"),
Macro.createHackInitDimensionFromLabel((int) width, (int) height), new CString(""));
agsafeset(zz, cluster1, new CString("label"), createLabelDim(width, height), new CString(""));
}
this.exportEntities(zz, cluster1, group.leafs());
this.clusters.put(group, cluster1);
this.exportGroups(zz, cluster1, group);
}
private CString createLabelDim(final double width, final double height) {
return Macro.createHackInitDimensionFromLabel((int) width, (int) height);
}
private Style getStyle() {
return StyleSignatureBasic
.of(SName.root, SName.element, diagram.getUmlDiagramType().getStyleName(), SName.arrow)
@ -496,55 +509,48 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
private ST_Agedge_s createEdge(Globals zz, final ST_Agraph_s g, Link link) {
final ST_Agnode_s n = getAgnodeFromLeaf(link.getEntity1());
final ST_Agnode_s m = getAgnodeFromLeaf(link.getEntity2());
if (n == null)
return null;
if (m == null)
return null;
final ST_Agnode_s node1;
final ST_Agnode_s node2;
final ST_Agedge_s e = agedge(zz, g, n, m, null, true);
// System.err.println("createEdge " + link);
if (link.getEntity1().isGroup())
node1 = getCoreFromGroup(zz, link.getEntity1());
else
node1 = getAgnodeFromLeaf(link.getEntity1());
if (link.getEntity2().isGroup())
node2 = getCoreFromGroup(zz, link.getEntity2());
else
node2 = getAgnodeFromLeaf(link.getEntity2());
if (node1 == null || node2 == null)
throw new IllegalStateException();
final ST_Agedge_s e = agedge(zz, g, node1, node2, null, true);
agsafeset(zz, e, new CString("arrowtail"), new CString("none"), new CString(""));
agsafeset(zz, e, new CString("arrowhead"), new CString("none"), new CString(""));
int length = link.getLength();
// System.err.println("length=" + length);
// if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() ||
// */link.isInvis() || length != 1) {
agsafeset(zz, e, new CString("minlen"), new CString("" + (length - 1)), new CString(""));
// }
// System.err.print("EDGE " + link.getEntity1().getUid() + "->" +
// link.getEntity2().getUid() + " minlen="
// + (length - 1) + " ");
final TextBlock label = getLabel(link);
if (TextBlockUtils.isEmpty(label, stringBounder) == false) {
final XDimension2D dimLabel = label.calculateDimension(stringBounder);
// System.err.println("dimLabel = " + dimLabel);
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
(int) dimLabel.getHeight());
final CString hackDim = createLabelDim(dimLabel.getWidth(), dimLabel.getHeight());
agsafeset(zz, e, new CString("label"), hackDim, new CString(""));
// System.err.print("label=" + hackDim.getContent());
}
final TextBlock q1 = getQuantifier(link, 1);
if (q1 != null) {
final XDimension2D dimLabel = q1.calculateDimension(stringBounder);
// System.err.println("dimLabel = " + dimLabel);
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
(int) dimLabel.getHeight());
final CString hackDim = createLabelDim(dimLabel.getWidth(), dimLabel.getHeight());
agsafeset(zz, e, new CString("taillabel"), hackDim, new CString(""));
}
final TextBlock q2 = getQuantifier(link, 2);
if (q2 != null) {
final XDimension2D dimLabel = q2.calculateDimension(stringBounder);
// System.err.println("dimLabel = " + dimLabel);
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
(int) dimLabel.getHeight());
final CString hackDim = createLabelDim(dimLabel.getWidth(), dimLabel.getHeight());
agsafeset(zz, e, new CString("headlabel"), hackDim, new CString(""));
}
// System.err.println();
return e;
}

View File

@ -48,19 +48,19 @@ import net.sourceforge.plantuml.klimt.UStroke;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.DotPath;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
import net.sourceforge.plantuml.klimt.shape.URectangle;
import net.sourceforge.plantuml.skin.LineParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.svek.Cluster;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactory;
import net.sourceforge.plantuml.url.Url;
@ -73,9 +73,11 @@ public class SmetanaPath implements UDrawable {
private final TextBlock label;
private final TextBlock headLabel;
private final TextBlock tailLabel;
private final Bibliotekon bibliotekon;
public SmetanaPath(Link link, ST_Agedge_s edge, YMirror ymirror, ICucaDiagram diagram, TextBlock label,
TextBlock tailLabel, TextBlock headLabel) {
TextBlock tailLabel, TextBlock headLabel, Bibliotekon bibliotekon) {
this.bibliotekon = bibliotekon;
this.link = link;
this.edge = edge;
this.ymirror = ymirror;
@ -99,7 +101,7 @@ public class SmetanaPath implements UDrawable {
} else if (this.link.getSpecificColor() != null)
color = this.link.getSpecificColor();
DotPath dotPath = getDotPath(edge);
DotPath dotPath = getDotPath();
if (ymirror != null && dotPath != null)
dotPath = ymirror.getMirrored(dotPath);
@ -146,8 +148,7 @@ public class SmetanaPath implements UDrawable {
if (extremityFactory2 == null)
return;
final ST_splines splines = getSplines(edge);
DotPath s = getDotPath(splines);
DotPath s = getDotPath();
XPoint2D p0 = s.getStartPoint();
double startAngle = s.getStartAngle();
if (ymirror != null) {
@ -171,8 +172,7 @@ public class SmetanaPath implements UDrawable {
if (extremityFactory1 == null)
return;
final ST_splines splines = getSplines(edge);
DotPath s = getDotPath(splines);
DotPath s = getDotPath();
XPoint2D p0 = s.getEndPoint();
double endAngle = s.getEndAngle();
if (ymirror != null) {
@ -190,23 +190,23 @@ public class SmetanaPath implements UDrawable {
}
}
private void printDebug(UGraphic ug) {
ug = ug.apply(HColors.BLUE).apply(HColors.BLUE.bg());
final ST_splines splines = getSplines(edge);
final ST_bezier beziers = splines.list.get__(0);
for (int i = 0; i < beziers.size; i++) {
XPoint2D pt = getPoint(splines, i);
if (ymirror != null)
pt = ymirror.getMirrored(pt);
ug.apply(UTranslate.point(pt).compose(new UTranslate(-1, -1))).draw(UEllipse.build(3, 3));
}
if (getLabelRectangleTranslate("label") != null && getLabelURectangle() != null) {
ug = ug.apply(HColors.BLUE).apply(HColors.none().bg());
ug.apply(getLabelRectangleTranslate("label")).draw(getLabelURectangle());
}
}
// private void printDebug(UGraphic ug) {
// ug = ug.apply(HColors.BLUE).apply(HColors.BLUE.bg());
// final ST_splines splines = getSplines(edge);
// final ST_bezier beziers = splines.list.get__(0);
// for (int i = 0; i < beziers.size; i++) {
// XPoint2D pt = getPoint(splines, i);
// if (ymirror != null)
// pt = ymirror.getMirrored(pt);
//
// ug.apply(UTranslate.point(pt).compose(new UTranslate(-1, -1))).draw(UEllipse.build(3, 3));
// }
// if (getLabelRectangleTranslate("label") != null && getLabelURectangle() != null) {
// ug = ug.apply(HColors.BLUE).apply(HColors.none().bg());
// ug.apply(getLabelRectangleTranslate("label")).draw(getLabelURectangle());
// }
//
// }
private URectangle getLabelURectangle() {
final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) edge.data.castTo(ST_Agedgeinfo_t.class);
@ -214,14 +214,8 @@ public class SmetanaPath implements UDrawable {
if (label == null)
return null;
final ST_pointf dimen = (ST_pointf) label.dimen;
final ST_pointf space = (ST_pointf) label.space;
final ST_pointf pos = (ST_pointf) label.pos;
final double x = pos.x;
final double y = pos.y;
final double width = dimen.x;
final double height = dimen.y;
return URectangle.build(width, height);
final BoxInfo boxInfo = BoxInfo.fromTextlabel(label);
return URectangle.build(boxInfo.getDimension());
}
private UTranslate getLabelRectangleTranslate(String fieldName) {
@ -238,51 +232,44 @@ public class SmetanaPath implements UDrawable {
if (label == null)
return null;
final ST_pointf dimen = (ST_pointf) label.dimen;
final ST_pointf space = (ST_pointf) label.space;
final ST_pointf pos = (ST_pointf) label.pos;
final double x = pos.x;
final double y = pos.y;
final double width = dimen.x;
final double height = dimen.y;
final BoxInfo boxInfo = BoxInfo.fromTextlabel(label);
if (ymirror == null)
return new UTranslate(x - width / 2, y - height / 2);
return new UTranslate(boxInfo.getLowerLeft().getX(), boxInfo.getUpperRight().getY());
return ymirror.getMirrored(new UTranslate(x - width / 2, y + height / 2));
return ymirror.getMirrored(UTranslate.point(boxInfo.getLowerLeft()));
}
public DotPath getDotPath(ST_Agedge_s e) {
final ST_splines splines = getSplines(e);
return getDotPath(splines);
}
private DotPath dotPath;
private ST_splines getSplines(ST_Agedge_s e) {
final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) e.data;
final ST_splines splines = (ST_splines) data.spl;
return splines;
}
private DotPath getDotPath() {
if (dotPath != null)
return dotPath;
private DotPath getDotPath(ST_splines splines) {
if (splines == null) {
System.err.println("ERROR, no splines for getDotPath");
return null;
}
DotPath result = new DotPath();
final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) edge.data;
final ST_splines splines = data.spl;
dotPath = new DotPath();
final ST_bezier beziers = (ST_bezier) splines.list.get__(0);
final XPoint2D pt1 = getPoint(splines, 0);
final XPoint2D pt2 = getPoint(splines, 1);
final XPoint2D pt3 = getPoint(splines, 2);
final XPoint2D pt4 = getPoint(splines, 3);
result = result.addCurve(pt1, pt2, pt3, pt4);
dotPath = dotPath.addCurve(pt1, pt2, pt3, pt4);
final int n = beziers.size;
for (int i = 4; i < n; i += 3) {
final XPoint2D ppt2 = getPoint(splines, i);
final XPoint2D ppt3 = getPoint(splines, i + 1);
final XPoint2D ppt4 = getPoint(splines, i + 2);
result = result.addCurve(ppt2, ppt3, ppt4);
dotPath = dotPath.addCurve(ppt2, ppt3, ppt4);
}
return result;
if (link.getEntity2().isGroup()) {
final Cluster cluster2 = bibliotekon.getCluster(link.getEntity2());
// System.err.println("WARNING: a group " + cluster2.getRectangleArea());
// dotPath = dotPath.simulateCompound(cluster2.getRectangleArea(), cluster2.getRectangleArea());
}
return dotPath;
}
private XPoint2D getPoint(ST_splines splines, int i) {

View File

@ -377,7 +377,13 @@ public class Histogram implements PDrawing {
}
public double getFullHeight(StringBounder stringBounder) {
return getHeightForConstraints(stringBounder) + stepHeight() * (allStates.size() - 1) + getBottomMargin();
double height = getHeightForConstraints(stringBounder);
if (allStates.size() > 0)
height += stepHeight() * (allStates.size() - 1);
height += getBottomMargin();
return height;
}
private double getBottomMargin() {

View File

@ -82,7 +82,7 @@ public class Version {
}
public static int beta() {
final int beta = 1;
final int beta = 2;
return beta;
}