1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-04 09:30:48 +00:00

version 8038

This commit is contained in:
Arnaud Roques 2016-04-04 21:05:10 +02:00
parent 8232bdbf06
commit de562c2660
107 changed files with 1975 additions and 1542 deletions

View File

@ -55,8 +55,8 @@ import h._dthold_s;
import h._dtlink_s;
import smetana.core.CFunction;
import smetana.core.CString;
import smetana.core.Memory;
import smetana.core.__ptr__;
import smetana.core.__struct__;
public class dttree__c {
//1 9k44uhd5foylaeoekf3llonjq
@ -138,7 +138,8 @@ ENTERING("abqfzg1d1vkzk51225tcdlik5","dttree");
try {
_dtlink_s root, t;
int cmp, lk, sz, ky;
_dtlink_s l, r, me=null, link = (_dtlink_s) Memory.malloc(_dtlink_s.class);
_dtlink_s l, r, me=null;
final __struct__<_dtlink_s> link = __struct__.from(_dtlink_s.class);
Object o, k, key = null;
int n, minp; //, turn[(sizeof(size_t)*8 - 2)];
Dtcompar_f cmpf;
@ -191,7 +192,7 @@ try {
}
}
/* note that link.right is LEFT tree and link.left is RIGHT tree */
l = r = link;
l = r = link.amp();
/* allow apps to delete an object "actually" in the dictionary */
try {
if(dt.getPtr("meth").getInt("type") == 0000010 && ((type&(0000002|0010000))!=0) ) {
@ -224,7 +225,7 @@ try {
// goto do_search;
}
else if(root!=null && (lk < 0 ? (root.castTo(_dthold_s.class).getPtr("obj")!=null): NEQ(root.addVirtualBytes(-lk), obj)))
{ key = (sz < 0 ? UNSUPPORTED("*((char**)((char*)(obj)+ky))") : ((__ptr__)obj).addVirtualBytes(ky));
{ key = (sz < 0 ? ((__ptr__)obj).addVirtualBytes(ky) : ((__ptr__)obj).addVirtualBytes(ky));
throw new do_search();
}
} catch (do_search do_search) {
@ -319,7 +320,7 @@ try {
else /* if(cmp > 0) */
{ if ((t = (_dtlink_s) root.getPtr("right"))!=null )
{
k = (lk < 0 ? UNSUPPORTED("((Dthold_t*)(t))->obj") : t.addVirtualBytes(-lk) );
k = (lk < 0 ? t.castTo(_dthold_s.class).getPtr("obj") : t.addVirtualBytes(-lk) );
k = sz < 0 ? ((__ptr__)k).addVirtualBytes(ky) : ((__ptr__)k).addVirtualBytes(ky);
if((cmp = (cmpf!=null ? (Integer)((CFunction)cmpf).exe(dt,key,k,disc)
: (sz <= 0 ? strcmp((CString)key,(CString)k) : UNSUPPORTED_INT("memcmp(key,k,sz))") ))) > 0)
@ -407,11 +408,10 @@ try {
// dt->data->size = -1;
// goto no_root;
}
else if((type&(0000001|0004000))!=0) {
throw new UnsupportedOperationException();
// { if(dt->meth->type&0000004)
// goto has_root;
// else
else if((type&(0000001|0004000))!=0)
{ if((dt.getPtr("meth").getInt("type")&0000004)!=0)
throw new has_root();
else throw new UnsupportedOperationException();
// { root->hl._left = ((Dtlink_t*)0);
// root->right = link.hl._left;
// link.hl._left = root;
@ -440,7 +440,20 @@ try {
r.setPtr("hl._left", null);
l.setPtr("right", null);
if((type&0000010)!=0)
throw new UnsupportedOperationException("goto dt_next");
{
//goto dt_next:
if((root = (_dtlink_s) link.getPtr("hl._left"))!=null )
{ while((t = (_dtlink_s) root.getPtr("hl._left"))!=null ) {
root.setPtr("hl._left", t.getPtr("right"));
t.setPtr("right", root);
root = t;
}
link.setPtr("hl._left", root.getPtr("right"));
throw new has_root();
}
else throw new no_root();
}
else if((type&0000020)!=0)
throw new UnsupportedOperationException("goto dt_prev");
else if((type&(0000004|0001000))!=0)

View File

@ -43,12 +43,16 @@ import static gen.lib.cdt.dtrestore__c.dtrestore;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.function;
import static smetana.core.JUtils.strcmp;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.N;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.Macro.UNSUPPORTED_INT;
import h.Dtcompar_f;
import h._dt_s;
import smetana.core.CFunction;
import smetana.core.CString;
import smetana.core.__ptr__;
public class dtview__c {
@ -124,19 +128,19 @@ public static __ptr__ dtvsearch(_dt_s dt, __ptr__ obj, int type) {
ENTERING("6spidg45w8teb64726drdswaa","dtvsearch");
try {
_dt_s d, p;
__ptr__ o, n, ok, nk;
__ptr__ o=null, n, ok, nk;
int cmp, lk, sz, ky;
Dtcompar_f cmpf;
/* these operations only happen at the top level */
if ((type&(0000001|0000002|0000100|0000040))!=0)
return (__ptr__) dt.getPtr("meth").call("searchf", dt, obj, type);
if(((type&(0001000|0000004))!=0) || /* order sets first/last done below */
(((type&(0000200|0000400))!=0) && N(dt.getPtr("meth").getInt("type")&(0000010|0000004)) ) ) {
UNSUPPORTED("eh58afn12udc5q8yzr25advls"); // { for(d = dt; d; d = d->view)
UNSUPPORTED("99dyygo1p8ivdwvxg0kyro2wb"); // if((o = (*(d->meth->searchf))(d,obj,type)) )
UNSUPPORTED("1dhrv6aj5eq8ntuvb7qbs8aot"); // break;
UNSUPPORTED("66mzv36wy2mflr2u2a5pwa2vg"); // dt->walk = d;
UNSUPPORTED("c4mj2aqm6yf1jzso7g9z92g39"); // return o;
(((type&(0000200|0000400))!=0) && N(dt.getPtr("meth").getInt("type")&(0000010|0000004)) ) )
{ for(d = dt; d!=null; d = (_dt_s) d.getPtr("view"))
if((o = (__ptr__) d.getPtr("meth").call("searchf", d,obj,type))!=null )
break;
dt.setPtr("walk", d);
return o;
}
if((dt.getPtr("meth").getInt("type") & (0000010|0000004) )!=0)
{ if(N(type & (0000200|0000400|0000010|0000020)) )
@ -145,19 +149,22 @@ UNSUPPORTED("c4mj2aqm6yf1jzso7g9z92g39"); // return o;
for(d = dt; d!=null; d = (_dt_s) d.getPtr("view"))
{ if(N(o = (__ptr__) d.getPtr("meth").call("searchf", d, obj, type) ))
continue;
UNSUPPORTED("4f62457uttr71ofvfr1j1o5w1"); // (ky = d->disc->key, sz = d->disc->size, lk = d->disc->link, cmpf = d->disc->comparf);
UNSUPPORTED("3toy9k4m6evk7wvheiwlwrqac"); // ok = (void*)(sz < 0 ? *((char**)((char*)(o)+ky)) : ((char*)(o)+ky));
UNSUPPORTED("4ccvzqq1qhq1n54s3zk1n1g6m"); // if(n) /* get the right one among all dictionaries */
UNSUPPORTED("3901wgr15qsodkeaua3t1cowa"); // { cmp = (cmpf ? (*cmpf)(d,ok,nk,d->disc) : (sz <= 0 ? strcmp(ok,nk) : memcmp(ok,nk,sz)) );
UNSUPPORTED("dbakrc2nyretewvmfasl8hcya"); // if(((type & (0000010|0000200)) && cmp < 0) ||
UNSUPPORTED("dtwrbl1qp7i61npnve1m7w05f"); // ((type & (0000020|0000400)) && cmp > 0) )
ky = d.getPtr("disc").getInt("key");
sz = d.getPtr("disc").getInt("size");
lk = d.getPtr("disc").getInt("link");
cmpf = (Dtcompar_f) d.getPtr("disc").getPtr("comparf");
ok = (__ptr__) (sz < 0 ? ((__ptr__)o).addVirtualBytes(ky) : ((__ptr__)o).addVirtualBytes(ky));
if(n!=null) /* get the right one among all dictionaries */
{ cmp = (cmpf!=null ? (Integer)((CFunction)cmpf).exe(d,ok,nk,d.getPtr("disc")) : (sz <= 0 ? strcmp((CString)ok,(CString)nk) : UNSUPPORTED_INT("memcmp(ok,nk,sz)")) );
if(((type & (0000010|0000200))!=0 && cmp < 0) ||
((type & (0000020|0000400))!=0 && cmp > 0) )
UNSUPPORTED("5o3u9aaanyd9yh74sjfkkofmo"); // goto a_dj;
UNSUPPORTED("3to5h0rvqxdeqs38mhv47mm3o"); // }
UNSUPPORTED("8i5fu2uj3vy2l5q8mvuvj9ko8"); // else /* looks good for now */
UNSUPPORTED("9xbf1cn825arg4uuemeup3va4"); // { a_dj: p = d;
UNSUPPORTED("9oscy9gf8ohksry0rta6xvh5a"); // n = o;
UNSUPPORTED("9lzq8mn8zytb3ohf1f25weiml"); // nk = ok;
UNSUPPORTED("3to5h0rvqxdeqs38mhv47mm3o"); // }
}
else /* looks good for now */
{ a_dj: p = d;
n = o;
nk = ok;
}
}
dt.setPtr("walk", p);
return n;

View File

@ -39,7 +39,22 @@
*
*/
package gen.lib.cgraph;
import static gen.lib.cgraph.subg__c.agfstsubg;
import static gen.lib.cgraph.subg__c.agnxtsubg;
import static smetana.core.JUtils.function;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.AGINEDGE;
import static smetana.core.Macro.AGNODE;
import static smetana.core.Macro.AGOUTEDGE;
import static smetana.core.Macro.AGRAPH;
import static smetana.core.Macro.AGTYPE;
import static smetana.core.Macro.N;
import static smetana.core.Macro.UNSUPPORTED;
import h.Agobj_s;
import h.Agraph_s;
import smetana.core.CFunction;
import smetana.core.__ptr__;
public class apply__c {
//1 9k44uhd5foylaeoekf3llonjq
@ -210,14 +225,13 @@ throw new UnsupportedOperationException();
//3 95y4aknoddh42lieikrb72vxw
// static Agobj_t *subgraph_search(Agraph_t * sub, Agobj_t * g)
public static Object subgraph_search(Object... arg) {
UNSUPPORTED("677qey6vnubfomkqie4a9ik4n"); // static Agobj_t *subgraph_search(Agraph_t * sub, Agobj_t * g)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("2q3myz3ctrvxg2tezy4xtlm09"); // (void) g;
UNSUPPORTED("4ky7l2y5ts9tb7afavs7n5k9q"); // return (Agobj_t *) sub;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static Agobj_s subgraph_search(Agraph_s sub, Agobj_s g) {
ENTERING("95y4aknoddh42lieikrb72vxw","subgraph_search");
try {
return (Agobj_s) sub.castTo(Agobj_s.class);
} finally {
LEAVING("95y4aknoddh42lieikrb72vxw","subgraph_search");
}
}
@ -225,23 +239,22 @@ throw new UnsupportedOperationException();
//3 8s9l15wqucf1glmbeb6fmya8e
// static void rec_apply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg, agobjsearchfn_t objsearch, int preorder)
public static Object rec_apply(Object... arg) {
UNSUPPORTED("6z5t1j8cwcxwmp9sz4e1t3wiy"); // static void rec_apply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg,
UNSUPPORTED("c06siaf5y6pxt2eu9c81arqlo"); // agobjsearchfn_t objsearch, int preorder)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("79n2pjp1uguypbr6roza1ub1g"); // Agraph_t *sub;
UNSUPPORTED("74ksz0vip222qhabd8je4tglq"); // Agobj_t *subobj;
UNSUPPORTED("53h14y4e0c041auiny3xh8dz2"); // if (preorder)
UNSUPPORTED("dc3321q1hebfhs985iyuxhxyz"); // fn(g, obj, arg);
UNSUPPORTED("2jkaunh3bokdbr7jo1b1emaba"); // for (sub = agfstsubg(g); sub; sub = agnxtsubg(sub)) {
UNSUPPORTED("3knmujvbyabrc7idjorv5snck"); // if ((subobj = objsearch(sub, obj)))
UNSUPPORTED("998d3a8qmt0mxahzfwm6mup3y"); // rec_apply(sub, subobj, fn, arg, objsearch, preorder);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("a5s7e7k3ssj17sh0y83glwrzn"); // if (NOT(preorder))
UNSUPPORTED("dc3321q1hebfhs985iyuxhxyz"); // fn(g, obj, arg);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void rec_apply(Agraph_s g, Agobj_s obj, CFunction fn, __ptr__ arg, CFunction objsearch, boolean preorder) {
ENTERING("8s9l15wqucf1glmbeb6fmya8e","rec_apply");
try {
Agraph_s sub;
Agobj_s subobj;
if (preorder)
fn.exe(g, obj, arg);
for (sub = agfstsubg(g); sub!=null; sub = agnxtsubg(sub)) {
if ((subobj = (Agobj_s) objsearch.exe(sub, obj))!=null)
rec_apply(sub, subobj, fn, arg, objsearch, preorder);
}
if (N(preorder))
fn.exe(g, obj, arg);
} finally {
LEAVING("8s9l15wqucf1glmbeb6fmya8e","rec_apply");
}
}
@ -249,36 +262,38 @@ throw new UnsupportedOperationException();
//3 9hqql178zpl8iudlf6sgnv7aj
// int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg, int preorder)
public static Object agapply(Object... arg) {
UNSUPPORTED("e476td28zc0kt691usvzlzhgr"); // int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg,
UNSUPPORTED("8ue4wcckdwchuzs2ruoxxtjfs"); // int preorder)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("74ksz0vip222qhabd8je4tglq"); // Agobj_t *subobj;
UNSUPPORTED("6mu533v201u4fakomplchi1d7"); // agobjsearchfn_t objsearch;
UNSUPPORTED("3kwdmn4ezymvab9oercol2gfj"); // switch (AGTYPE(obj)) {
UNSUPPORTED("eyna33dobiebmtd0nihpgura4"); // case AGRAPH:
UNSUPPORTED("4t8gfa99dayxje8eoyg7cahbn"); // objsearch = subgraph_search;
UNSUPPORTED("6aw91xzjmqvmtdvt1di23af8y"); // break;
UNSUPPORTED("6x7ztvlgv763oeop84udp1egg"); // case AGNODE:
public static int agapply(Agraph_s g, Agobj_s obj, CFunction fn, __ptr__ arg, boolean preorder) {
ENTERING("9hqql178zpl8iudlf6sgnv7aj","agapply");
try {
Agobj_s subobj;
CFunction objsearch=null;
switch (AGTYPE(obj)) {
case AGRAPH:
objsearch = function(apply__c.class, "subgraph_search");
break;
case AGNODE:
UNSUPPORTED("arkoj4niyfqe213zut6szzeji"); // objsearch = subnode_search;
UNSUPPORTED("6aw91xzjmqvmtdvt1di23af8y"); // break;
UNSUPPORTED("a6ls4lkgjoheqwo2e7yqt9zz8"); // case AGOUTEDGE:
UNSUPPORTED("c9o8hr6x8n5dty1y3eej1fept"); // case AGINEDGE:
break;
case AGOUTEDGE:
case AGINEDGE:
UNSUPPORTED("3h8kzrrsobdp839772gupdrbf"); // objsearch = subedge_search;
UNSUPPORTED("6aw91xzjmqvmtdvt1di23af8y"); // break;
UNSUPPORTED("8l3rwj6ctswoa4gvh2j4poq70"); // default:
break;
default:
UNSUPPORTED("2pc67byzirrkhe1cmdoguh6i1"); // agerr(AGERR, "agapply: unknown object type %d\n", AGTYPE(obj));
UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1;
UNSUPPORTED("6aw91xzjmqvmtdvt1di23af8y"); // break;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("9sf5nvln1ruzl4z0vipihtgcf"); // if ((subobj = objsearch(g, obj))) {
UNSUPPORTED("aqxyz0schnatyimnwxwy0e1io"); // rec_apply(g, subobj, fn, arg, objsearch, preorder);
UNSUPPORTED("c9ckhc8veujmwcw0ar3u3zld4"); // return 0;
UNSUPPORTED("2lkbqgh2h6urnppaik3zo7ywi"); // } else
break;
}
if ((subobj = (Agobj_s) objsearch.exe(g, obj))!=null) {
rec_apply(g, subobj, fn, arg, objsearch, preorder);
return 0;
} else
UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
} finally {
LEAVING("9hqql178zpl8iudlf6sgnv7aj","agapply");
}
}

View File

@ -80,7 +80,6 @@ import h.Agrec_s;
import h.Agsym_s;
import h._dt_s;
import h._dtdisc_s;
import h.agobjfn_t;
import smetana.core.CString;
import smetana.core.Memory;
import smetana.core.Z;
@ -613,7 +612,7 @@ try {
rdict.castTo(_dt_s.class).call("searchf",rdict,rsym,0000001);
switch (kind) {
case AGRAPH:
agapply(root, root.castTo(Agobj_s.class), (agobjfn_t) function(attr__c.class, "addattr"),
agapply(root, (Agobj_s) root.castTo(Agobj_s.class), function(attr__c.class, "addattr"),
rsym, (N(0)));
break;
case AGNODE:
@ -908,13 +907,13 @@ try {
if (hdr.getStruct("tag").getInt("objtype") == AGRAPH) {
/* also update dict default */
_dt_s dict;
dict = (_dt_s) agdatadict(g, false).getPtr("dict").getPtr("g");
dict = (_dt_s) agdatadict(g, false).getPtr("dict.g");
if ((lsym = aglocaldictsym(dict, sym.getCString("name")))!=null) {
agstrfree(g, lsym.getCString("defval"));
lsym.setPtr("defval", agstrdup(g, value));
} else {
UNSUPPORTED("lsym = agnewsym(g, sym->name, value, sym->id, ((((Agobj_t*)(hdr))->tag).objtype));");
UNSUPPORTED("(*(((Dt_t*)(dict))->searchf))((dict),(void*)(lsym),0000001);");
lsym = agnewsym(g, sym.getCString("name"), value, sym.getInt("id"), AGTYPE(hdr));
dict.call("searchf", dict, lsym, 0000001);
}
}
agmethod_upd(g, obj, sym);

View File

@ -72,6 +72,7 @@ import h.Agnode_s;
import h.Agraph_s;
import h.Agsubnode_s;
import h._dt_s;
import h._dtdisc_s;
import h._dtlink_s;
import smetana.core.ACCESS;
import smetana.core.CString;
@ -574,18 +575,18 @@ LEAVING("2bz40qf0qo7pd6er1ut25gthp","agdegree");
//3 dhbtfzzp8n5yygqmhmluo9bxl
// int agraphidcmpf(Dict_t * d, void *arg0, void *arg1, Dtdisc_t * disc)
public static Object agraphidcmpf(Object... arg) {
UNSUPPORTED("1it8rnlidopuz32pqdsmdhc6q"); // int agraphidcmpf(Dict_t * d, void *arg0, void *arg1, Dtdisc_t * disc)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("ccl2joincnprtk47hwmpz1o7n"); // long v;
UNSUPPORTED("73bfha5x7xhgp9p6wxa9jap6j"); // Agraph_t *sg0, *sg1;
UNSUPPORTED("e8rx1ahgpoym3u3v0jgarn58y"); // sg0 = (Agraph_t *) arg0;
UNSUPPORTED("bc6x70wml3jh4l4ana92njtid"); // sg1 = (Agraph_t *) arg1;
UNSUPPORTED("306jxfq0wwqtke0uv1s7nmjd9"); // v = (AGID(sg0) - AGID(sg1));
UNSUPPORTED("2tgj1svqq4v5mqo7525nw7icj"); // return ((v==0)?0:(v<0?-1:1));
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static int agraphidcmpf(_dt_s d, __ptr__ arg0, __ptr__ arg1, _dtdisc_s disc) {
ENTERING("dhbtfzzp8n5yygqmhmluo9bxl","agraphidcmpf");
try {
int v;
Agraph_s sg0, sg1;
sg0 = (Agraph_s) arg0;
sg1 = (Agraph_s) arg1;
v = (AGID(sg0) - AGID(sg1));
return ((v==0)?0:(v<0?-1:1));
} finally {
LEAVING("dhbtfzzp8n5yygqmhmluo9bxl","agraphidcmpf");
}
}

View File

@ -52,6 +52,7 @@ import static gen.lib.cgraph.obj__c.agroot;
import static gen.lib.cgraph.rec__c.agbindrec;
import static gen.lib.cgraph.subg__c.agparent;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.sizeof;
import static smetana.core.JUtilsDebug.ENTERING;
@ -263,13 +264,24 @@ LEAVING("55wopi2gd93zpmycxoywlxm0y","agfstnode");
//3 bek79ccvjys1j9q404i3y6oh8
// Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n)
public static int NB = 0;
public static Agnode_s agnxtnode(Agraph_s g, Agnode_s n) {
ENTERING("bek79ccvjys1j9q404i3y6oh8","agnxtnode");
try {
//ZOOTO
if (NB==0) {
//StructureDefinition.from(IMapEntry_t.class);
}
NB++;
LOG2("NB="+NB);
Agsubnode_s sn;
sn = agsubrep(g, n);
LOG2("sn1="+sn);
if (sn!=null) sn = (Agsubnode_s) g.getPtr("n_seq").castTo(_dt_s.class).call("searchf", g.getPtr("n_seq"),sn,0000010);
return (Agnode_s) (sn!=null ? sn.getPtr("node") : null);
LOG2("sn2="+sn);
final __ptr__ result = sn!=null ? sn.getPtr("node") : null;
LOG2("result="+result);
return (Agnode_s) result;
} finally {
LEAVING("bek79ccvjys1j9q404i3y6oh8","agnxtnode");
}

View File

@ -44,6 +44,7 @@ import static gen.lib.cgraph.graph__c.agisdirected;
import static gen.lib.cgraph.obj__c.agraphof;
import static gen.lib.common.splines__c.bezier_clip;
import static gen.lib.common.utils__c.late_double;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.function;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
@ -826,7 +827,7 @@ try {
CString next;
int i, f;
flag[0] = 0;
System.err.println("Skipping arrow_match_name");
LOG2("Skipping arrow_match_name");
} finally {
LEAVING("2pveqb5qcgfxcqp410ub942eg","arrow_match_name");
}

View File

@ -5076,7 +5076,7 @@ throw new UnsupportedOperationException();
public static void gv_fixLocale(int set) {
ENTERING("31vgctm6ydke1b6e0s06x85og","gv_fixLocale");
try {
System.out.println("SKIPPING gv_fixLocale");
// System.out.println("SKIPPING gv_fixLocale");
} finally {
LEAVING("31vgctm6ydke1b6e0s06x85og","gv_fixLocale");
}

View File

@ -41,14 +41,20 @@
package gen.lib.common;
import static gen.lib.cgraph.attr__c.agattr;
import static gen.lib.cgraph.attr__c.agget;
import static gen.lib.cgraph.obj__c.agroot;
import static gen.lib.cgraph.refstr__c.aghtmlstr;
import static gen.lib.common.emit__c.init_xdot;
import static gen.lib.common.labels__c.make_label;
import static gen.lib.common.labels__c.strdup_and_subst_obj;
import static gen.lib.common.memory__c.zmalloc;
import static gen.lib.common.utils__c.late_double;
import static gen.lib.common.utils__c.late_int;
import static gen.lib.common.utils__c.late_nnstring;
import static gen.lib.common.utils__c.late_string;
import static gen.lib.common.utils__c.mapbool;
import static gen.lib.common.utils__c.maptoken;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.atof;
import static smetana.core.JUtils.atoi;
import static smetana.core.JUtils.enumAsInt;
@ -60,10 +66,15 @@ import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.AGEDGE;
import static smetana.core.Macro.AGNODE;
import static smetana.core.Macro.AGRAPH;
import static smetana.core.Macro.GD_border;
import static smetana.core.Macro.GD_charset;
import static smetana.core.Macro.GD_drawing;
import static smetana.core.Macro.GD_exact_ranksep;
import static smetana.core.Macro.GD_flip;
import static smetana.core.Macro.GD_fontnames;
import static smetana.core.Macro.GD_has_labels;
import static smetana.core.Macro.GD_label;
import static smetana.core.Macro.GD_label_pos;
import static smetana.core.Macro.GD_nodesep;
import static smetana.core.Macro.GD_rankdir2;
import static smetana.core.Macro.GD_ranksep;
@ -1545,58 +1556,59 @@ try {
int pos_ix;
/* it would be nice to allow multiple graph labels in the future */
if ((str = agget(sg, new CString("label")))!=null && (str.charAt(0) != '\0')) {
UNSUPPORTED("870awelvu7e70c2b6yzrscdmj"); // char pos_flag;
UNSUPPORTED("5akoaiiuv98eqw2njspssx259"); // pointf dimen;
UNSUPPORTED("j6j6btotp10oau0fwjieumbq"); // (((Agraphinfo_t*)(((Agobj_t*)(sg->root))->data))->has_labels) |= (1 << 3);
UNSUPPORTED("718mqxi481h1fey0widydj84u"); // (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->label) = make_label((void*)sg, str, (aghtmlstr(str) ? (1 << 1) : (0 << 1)),
UNSUPPORTED("5eppzbm3ot2n9s827fwgarhnj"); // late_double(sg, (agattr(sg,0,"fontsize",NULL)),
UNSUPPORTED("5wcv6vb07yxavnoqf1x6ukmjo"); // 14.0, 1.0),
UNSUPPORTED("a78pgsl49k0lgc1pf416osz67"); // late_nnstring(sg, (agattr(sg,0,"fontname",NULL)),
UNSUPPORTED("en7hy7l4lwo04yl6d7mpzcsaj"); // "Times-Roman"),
UNSUPPORTED("7d6h8i2zz7oivfsekvhlhnvo9"); // late_nnstring(sg, (agattr(sg,0,"fontcolor",NULL)),
UNSUPPORTED("wtkg0k7czfm64rcp7mfg3nv5"); // "black"));
UNSUPPORTED("6kd93dutj8fw7han1m9pecd3"); // /* set label position */
UNSUPPORTED("f23fin5ejwocjpmwtld0c9j62"); // pos = agget(sg, "labelloc");
UNSUPPORTED("c93de0m6dhkiaf8l0coz0c6ln"); // if (sg != agroot(sg)) {
UNSUPPORTED("amk3d0y3br7s3hcrmw90dg7mc"); // if (pos && (pos[0] == 'b'))
UNSUPPORTED("6m5sy5ew8izdy8i10zb5o2dvu"); // pos_flag = 0;
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
UNSUPPORTED("bxai2kktsidvda3696ctyk63c"); // pos_flag = 1;
UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); // } else {
char pos_flag=0;
final __struct__<pointf> dimen = __struct__.from(pointf.class);
GD_has_labels(sg.getPtr("root"), GD_has_labels(sg.getPtr("root")) | (1 << 3));
GD_label(sg, make_label(sg, str, (aghtmlstr(str)!=0 ? (1 << 1) : (0 << 1)),
late_double(sg, (agattr(sg,AGRAPH,new CString("fontsize"),null)),
14.0, 1.0),
late_nnstring(sg, (agattr(sg,AGRAPH,new CString("fontname"),null)),
new CString("Times-Roman")),
late_nnstring(sg, (agattr(sg,AGRAPH,new CString("fontcolor"),null)),
new CString("black"))));
/* set label position */
pos = agget(sg, new CString("labelloc"));
if (NEQ(sg, agroot(sg))) {
if (pos!=null && (pos.charAt(0) == 'b'))
pos_flag = 0;
else
pos_flag = 1;
} else {
UNSUPPORTED("601b6yrqr391vnfpa74d7fec7"); // if (pos && (pos[0] == 't'))
UNSUPPORTED("bxai2kktsidvda3696ctyk63c"); // pos_flag = 1;
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
UNSUPPORTED("6m5sy5ew8izdy8i10zb5o2dvu"); // pos_flag = 0;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("5fnsitpv3llu01j66gcdbgvvq"); // just = agget(sg, "labeljust");
UNSUPPORTED("ahtohblws3c14vgpfzs41ht0e"); // if (just) {
}
just = agget(sg, new CString("labeljust"));
if (just!=null) {
UNSUPPORTED("3gxohpfqzahytaf7f9apn58az"); // if (just[0] == 'l')
UNSUPPORTED("ch7sydr4cg29o8ky9fbk5vnlg"); // pos_flag |= 2;
UNSUPPORTED("336to8kpmovx00pexhhenz74b"); // else if (just[0] == 'r')
UNSUPPORTED("evu9w6pw3kkh7z8w7t4rx4qxc"); // pos_flag |= 4;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("b2fkpvbcook0ajijb9zef4wxi"); // (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->label_pos) = pos_flag;
UNSUPPORTED("430l4z4ptplzks1utmcytwgo6"); // if (sg == agroot(sg))
UNSUPPORTED("6cprbghvenu9ldc0ez1ifc63q"); // return;
UNSUPPORTED("ddtgsgye853y5wi52ulakg84v"); // /* Set border information for cluster labels to allow space
UNSUPPORTED("62wb43w2xc6ex6hootjubbx22"); // */
UNSUPPORTED("7x1rb14xb550h7valqrcswhg8"); // dimen = (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->label)->dimen;
UNSUPPORTED("22jhn709g4c5wh0gb6v40rh19"); // {((dimen).x += 4*4); ((dimen).y += 2*4);};
UNSUPPORTED("bw5ihew2828hgpvqdgdenaq5h"); // if (!((((Agraphinfo_t*)(((Agobj_t*)(agroot(sg)))->data))->rankdir & 0x3) & 1)) {
UNSUPPORTED("cabz6xbjdvz5vmjulzrhlxh48"); // if ((((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->label_pos) & 1)
UNSUPPORTED("8wqj2vt1bsb6cuz0adrc3wcru"); // pos_ix = 2;
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
UNSUPPORTED("1xf4bbxn0ev8w6eiuliutjlyn"); // pos_ix = 0;
UNSUPPORTED("9v5mj5pdhqolg491aisuxoopo"); // (((Agraphinfo_t*)(((Agobj_t*)(sg))->data))->border)[pos_ix] = dimen;
UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); // } else {
UNSUPPORTED("1uc4opf2arepq1a2qd6nw5hj"); // /* when rotated, the labels will be restored to TOP or BOTTOM */
}
GD_label_pos(sg, pos_flag);
if (EQ(sg, agroot(sg)))
return;
/* Set border information for cluster labels to allow space
*/
dimen.____(GD_label(sg).getStruct("dimen"));
dimen.setDouble("x", dimen.getDouble("x") + 4*4);
dimen.setDouble("y", dimen.getDouble("y") + 2*4);
if (N(GD_flip(agroot(sg)))) {
if ((GD_label_pos(sg) & 1)!=0)
pos_ix = 2;
else
pos_ix = 0;
GD_border(sg).plus(pos_ix).setStruct(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;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
}
}
} finally {
LEAVING("5vks1zdadu5vjinaivs0j2bkb","do_graph_label");

View File

@ -58,6 +58,7 @@ import static smetana.core.Macro.AGRAPH;
import static smetana.core.Macro.ED_head_port;
import static smetana.core.Macro.ED_label;
import static smetana.core.Macro.ED_tail_port;
import static smetana.core.Macro.GD_label;
import static smetana.core.Macro.MAX;
import static smetana.core.Macro.N;
import static smetana.core.Macro.UNSUPPORTED;
@ -738,9 +739,7 @@ try {
if (line!=null && line.charAt(0)!='\0') {
Z._().tf.setPtr("name", lp.getPtr("fontname"));
Z._().tf.setDouble("size", lp.getDouble("fontsize"));
// WE CHEAT
System.err.println("WE CHEAT");
size.setDouble("x", 0.0);
size.setDouble("y", (int)(lp.getDouble("fontsize") * 1.20));
hackInitDimensionFromLabel(size, line.getContent());
@ -757,8 +756,6 @@ try {
lp.getStruct("dimen").setDouble("x", MAX(lp.getStruct("dimen").getDouble("x"), size.getDouble("x")));
/* accumulate height */
lp.getStruct("dimen").setDouble("y", lp.getStruct("dimen").getDouble("y") + size.getDouble("y"));
System.err.println("storeline "+lp.getStruct("dimen").getDouble("x")+" "+lp.getStruct("dimen").getDouble("y"));
} finally {
LEAVING("4wkeqik2dt7ecr64ej6ltbnvb","storeline");
}
@ -852,9 +849,9 @@ try {
CString s = null;
switch (agobjkind(obj)) {
case AGRAPH:
UNSUPPORTED("bwd3pkmgxgamoepwkryrpg8p7"); // sg = (graph_t*)obj;
UNSUPPORTED("8byoc47jwp4w8nf5iybv3m1l7"); // g = sg->root;
UNSUPPORTED("6aw91xzjmqvmtdvt1di23af8y"); // break;
sg = (Agraph_s)obj;
g = (Agraph_s) sg.getPtr("root");
break;
case AGNODE:
n = (Agnode_s)obj.castTo(Agnode_s.class);
g = agroot(agraphof(n));
@ -1045,13 +1042,13 @@ try {
/* prepare substitution strings */
switch (agobjkind(obj)) {
case AGRAPH:
UNSUPPORTED("252e5onb5khztxbbkgkxu143p"); // g_str = agnameof((graph_t *)obj);
UNSUPPORTED("adpn2we6kz16aaww9d5tnk9rn"); // g_len = strlen(g_str);
UNSUPPORTED("18f5p2uhidluaf11rbt5hbl1t"); // tl = (((Agraphinfo_t*)(((Agobj_t*)((graph_t *)obj))->data))->label);
UNSUPPORTED("3o7pm1he74eo27l1vxwasnht9"); // if (tl) {
UNSUPPORTED("88b430s6vk0irhr2k7x9crz9l"); // l_str = tl->text;
UNSUPPORTED("5hjl5oveu3muui5b0fffh0dz2"); // if (str) l_len = strlen(l_str);
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
g_str = agnameof((Agraph_s)obj);
g_len = strlen(g_str);
tl = GD_label((Agraph_s)obj);
if (tl!=null) {
l_str = tl.getCString("text");
if (str!=null) l_len = strlen(l_str);
}
break;
case AGNODE:
g_str = agnameof(agraphof(obj.castTo(Agnode_s.class)));

View File

@ -40,7 +40,10 @@
*/
package gen.lib.common;
import static gen.lib.cgraph.edge__c.agfstout;
import static gen.lib.cgraph.edge__c.aghead;
import static gen.lib.cgraph.edge__c.agnxtout;
import static gen.lib.cgraph.edge__c.agtail;
import static gen.lib.cgraph.id__c.agnameof;
import static gen.lib.cgraph.node__c.agfstnode;
import static gen.lib.cgraph.node__c.agnxtnode;
import static gen.lib.cgraph.obj__c.agroot;
@ -48,22 +51,26 @@ import static gen.lib.common.geom__c.ccwrotatepf;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.ED_edge_type;
import static smetana.core.Macro.ED_head_label;
import static smetana.core.Macro.ED_label;
import static smetana.core.Macro.ED_spl;
import static smetana.core.Macro.ED_tail_label;
import static smetana.core.Macro.ED_xlabel;
import static smetana.core.Macro.GD_bb;
import static smetana.core.Macro.GD_border;
import static smetana.core.Macro.GD_clust;
import static smetana.core.Macro.GD_flags;
import static smetana.core.Macro.GD_flip;
import static smetana.core.Macro.GD_has_labels;
import static smetana.core.Macro.GD_label;
import static smetana.core.Macro.GD_label_pos;
import static smetana.core.Macro.GD_n_cluster;
import static smetana.core.Macro.GD_rankdir;
import static smetana.core.Macro.N;
import static smetana.core.Macro.ND_coord;
import static smetana.core.Macro.ND_xlabel;
import static smetana.core.Macro.NOT;
import static smetana.core.Macro.UNSUPPORTED;
import h.Agedge_s;
import h.Agnode_s;
@ -760,10 +767,10 @@ try {
int j, k;
final __struct__<bezier> bz = __struct__.from(bezier.class);
if (ED_spl(e) == null) {
UNSUPPORTED("pk4pq268vlnm46hq9osu453d"); // if ((Concentrate == 0) && (ED_edge_type(e) != 6))
UNSUPPORTED("9z8dzb6h2lyt2qzqjofeqql09"); // agerr(AGERR, "lost %s %s edge\n", agnameof(agtail(e)),
UNSUPPORTED("74pedndsd738qx562cc6mhr7i"); // agnameof(aghead(e)));
UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return;
if ((Z._().Concentrate == false) && (ED_edge_type(e) != 6))
System.err.println("lost %s %s edge\n"+ agnameof(agtail(e))+
agnameof(aghead(e)));
return;
}
for (j = 0; j < ED_spl(e).getInt("size"); j++) {
bz.____(ED_spl(e).getArrayOfPtr("list").plus(j).getStruct());
@ -810,7 +817,7 @@ UNSUPPORTED("crysiae5zxc69cj3v2ygfs8xn"); // new_bb.UR = map_point(pointfof(bb.
}
GD_bb(g).____(new_bb);
if (GD_label(g)!=null) {
UNSUPPORTED("bkn67oo24unyb5eif9prtw0et"); // GD_label(g)->pos = map_point(GD_label(g)->pos);
GD_label(g).setStruct("pos", map_point(GD_label(g).getStruct("pos")));
}
for (c = 1; c <= GD_n_cluster(g); c++)
translate_bb((Agraph_s) GD_clust(g).plus(c).getPtr(), rankdir);
@ -1472,23 +1479,23 @@ ENTERING("72zw1alhd5vd0g6mhum507rvx","place_graph_label");
try {
int c;
final __struct__<pointf> p = __struct__.from(pointf.class), d = __struct__.from(pointf.class);
if (NEQ(g, agroot(g)) && (GD_label(g)!=null) && N(GD_label(g).getPtr("set"))) {
UNSUPPORTED("bb9kbz7bijh4xjt97fdn2q90k"); // if (GD_label_pos(g) & 1) {
UNSUPPORTED("5lv96pqhcx8svzq467h22fwih"); // d = GD_border(g)[2];
UNSUPPORTED("a7anlx7s8s2pqd73q59ep0kpf"); // p.y = GD_bb(g).UR.y - d.y / 2;
UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); // } else {
if (NEQ(g, agroot(g)) && (GD_label(g)!=null) && N(GD_label(g).getInt("set"))) {
if ((GD_label_pos(g) & 1)!=0) {
d.____(GD_border(g).plus(2).getStruct());
p.setDouble("y", GD_bb(g).getStruct("UR").getDouble("y") - d.getDouble("y") / 2);
} else {
UNSUPPORTED("1w38no4welthbwa0i10hei16b"); // d = GD_border(g)[0];
UNSUPPORTED("2xa4n9ca16xpf1kahaycmkl4r"); // p.y = GD_bb(g).LL.y + d.y / 2;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("2qpji9cqj2p2czgcug3wvnqpl"); // if (GD_label_pos(g) & 4) {
}
if ((GD_label_pos(g) & 4)!=0) {
UNSUPPORTED("cgv3bcg9c274cdwxi1y0sja3p"); // p.x = GD_bb(g).UR.x - d.x / 2;
UNSUPPORTED("blrmgi2c43f98h1nso1k757hi"); // } else if (GD_label_pos(g) & 2) {
} else if ((GD_label_pos(g) & 2)!=0) {
UNSUPPORTED("7ictv9eqmjvxjii5lqlyw8nu"); // p.x = GD_bb(g).LL.x + d.x / 2;
UNSUPPORTED("7yhr8hn3r6wohafwxrt85b2j2"); // } else {
UNSUPPORTED("2j8xggcs05suub0imusgk58jw"); // p.x = (GD_bb(g).LL.x + GD_bb(g).UR.x) / 2;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("ptjqgn3loi94u957cup0fi1"); // GD_label(g)->pos = p;
UNSUPPORTED("5ezl5j9dxa3ewoj8hxw72wn4n"); // GD_label(g)->set = NOT(0);
} else {
p.setDouble("x", (GD_bb(g).getStruct("LL").getDouble("x") + GD_bb(g).getStruct("UR").getDouble("x")) / 2);
}
GD_label(g).setStruct("pos", p);
GD_label(g).setBoolean("set", NOT(false));
}
for (c = 1; c <= GD_n_cluster(g); c++)
place_graph_label((Agraph_s) GD_clust(g).plus(c).getPtr());

View File

@ -44,6 +44,7 @@ import static gen.lib.cgraph.edge__c.agtail;
import static gen.lib.common.memory__c.gmalloc;
import static gen.lib.pathplan.route__c.Proutespline;
import static gen.lib.pathplan.shortest__c.Pshortestpath;
import static gen.lib.pathplan.util__c.make_polyline;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.cos;
import static smetana.core.JUtils.sin;
@ -51,6 +52,7 @@ import static smetana.core.JUtils.sizeof;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.ABS;
import static smetana.core.Macro.ALLOC;
import static smetana.core.Macro.ALLOC_allocated2;
import static smetana.core.Macro.ED_edge_type;
import static smetana.core.Macro.ED_to_orig;
@ -748,47 +750,51 @@ throw new UnsupportedOperationException();
//3 7ebl6qohcfpf1b9ucih5r9qgp
// pointf* simpleSplineRoute (pointf tp, pointf hp, Ppoly_t poly, int* n_spl_pts, int polyline)
public static Object simpleSplineRoute(Object... arg) {
UNSUPPORTED("dw50tbcju2pltf9klafsfu2ol"); // pointf*
UNSUPPORTED("8glby259zzj3pcjwq0e3ey2hp"); // simpleSplineRoute (pointf tp, pointf hp, Ppoly_t poly, int* n_spl_pts,
UNSUPPORTED("8okmoiy1qnk3tqim4jb4gysd"); // int polyline)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("12kmvce2zkcfb5zik5lybfk1o"); // Ppolyline_t pl, spl;
UNSUPPORTED("ey5ft8ei9wbug1jc46b2cunuc"); // Ppoint_t eps[2];
UNSUPPORTED("3780rts7vlxbwew3hhn1ausf3"); // Pvector_t evs[2];
UNSUPPORTED("b17di9c7wgtqm51bvsyxz6e2f"); // int i;
UNSUPPORTED("87yquckimmtioyxb1qhdu7mmn"); // eps[0].x = tp.x;
UNSUPPORTED("4x0wsiah0saun42bus5jp9hrs"); // eps[0].y = tp.y;
UNSUPPORTED("7jy2eh0mqqu11j7jp0z5txo9k"); // eps[1].x = hp.x;
UNSUPPORTED("em8atozq6lpsrgm3dhwdxlb88"); // eps[1].y = hp.y;
UNSUPPORTED("bqd6i6ndz7gibdj2zsv6p91jr"); // if (Pshortestpath(&poly, eps, &pl) < 0)
UNSUPPORTED("3kb0mwa3jlee9ipjt7wodtqqb"); // return NULL;
UNSUPPORTED("7rwyycny9egg6hgqujfknvjit"); // if (polyline)
UNSUPPORTED("48veztc3k9dfw8tqolu7jsktk"); // make_polyline (pl, &spl);
UNSUPPORTED("1nyzbeonram6636b1w955bypn"); // else {
UNSUPPORTED("4131vuecd0pkzysyfck4byowy"); // if (poly.pn > edgen) {
UNSUPPORTED("4nwy17i4wgv0k2r8e4iyqx5nt"); // edges = ALLOC(poly.pn, edges, Pedge_t);
UNSUPPORTED("9o0bssjvl9rex5yy4o6aa68e7"); // edgen = poly.pn;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("ey7mjj2ddhtxk8owpk7dbv8c5"); // for (i = 0; i < poly.pn; i++) {
UNSUPPORTED("a26ii6hn3o4876nry0e0gru7s"); // edges[i].a = poly.ps[i];
UNSUPPORTED("4o6o63g1uaa4v0n31dh2kdm7f"); // edges[i].b = poly.ps[(i + 1) % poly.pn];
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("bb3dm92ef52alwyqvp97w3j3"); // evs[0].x = evs[0].y = 0;
UNSUPPORTED("8jxhcl6g4h9hhjfm0v92tyxqz"); // evs[1].x = evs[1].y = 0;
UNSUPPORTED("6n6rf1y3nb5sed9kijtpbte5x"); // if (Proutespline(edges, poly.pn, pl, evs, &spl) < 0)
UNSUPPORTED("7cmakagq6c83w07cd6ydvtcah"); // return NULL;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("537c7u330bt6xoa0vk6xpgrfy"); // if (mkspacep(spl.pn))
UNSUPPORTED("11hwqop4xebvtcskop4uhpp01"); // return NULL;
UNSUPPORTED("43gb7crgcz0k69122jukf2fjd"); // for (i = 0; i < spl.pn; i++) {
UNSUPPORTED("55bk7ojpylcy9xok3uhlthd8g"); // ps[i] = spl.ps[i];
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("5pl954ur7rc4gnm7mmfahhlur"); // *n_spl_pts = spl.pn;
UNSUPPORTED("b0dfwpxhogdrp9mwkzc8oa9vt"); // return ps;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static pointf simpleSplineRoute(final __struct__<pointf> tp, final __struct__<pointf> hp, final __struct__<Ppoly_t> poly, int[] n_spl_pts, boolean polyline) {
// WARNING!! STRUCT
return simpleSplineRoute_w_(tp.copy(), hp.copy(), poly.copy(), n_spl_pts, polyline);
}
private static pointf simpleSplineRoute_w_(final __struct__<pointf> tp, final __struct__<pointf> hp, final __struct__<Ppoly_t> poly, int[] n_spl_pts, boolean polyline) {
ENTERING("7ebl6qohcfpf1b9ucih5r9qgp","simpleSplineRoute");
try {
final __struct__<Ppoly_t> pl = __struct__.from(Ppoly_t.class), spl = __struct__.from(Ppoly_t.class);
final __array_of_struct__ eps = __array_of_struct__.malloc(pointf.class, 2);
final __array_of_struct__ evs = __array_of_struct__.malloc(pointf.class, 2);
int i;
eps.plus(0).setDouble("x", tp.getDouble("x"));
eps.plus(0).setDouble("y", tp.getDouble("y"));
eps.plus(1).setDouble("x", hp.getDouble("x"));
eps.plus(1).setDouble("y", hp.getDouble("y"));
if (Pshortestpath(poly.amp(), eps, pl.amp()) < 0)
return null;
if (polyline)
make_polyline (pl, spl.amp());
else {
if (poly.getInt("pn") > Z._().edgen) {
Z._().edges = ALLOC(poly.getInt("pn"), Z._().edges, Pedge_t.class);
Z._().edgen = poly.getInt("pn");
}
for (i = 0; i < poly.getInt("pn"); i++) {
Z._().edges.plus(i).setStruct("a", poly.getArrayOfStruct("ps").plus(i).getStruct());
Z._().edges.plus(i).setStruct("b", poly.getArrayOfStruct("ps").plus((i + 1) % poly.getInt("pn")).getStruct());
}
evs.plus(0).setDouble("x", 0);
evs.plus(0).setDouble("y", 0);
evs.plus(1).setDouble("x", 0);
evs.plus(1).setDouble("y", 0);
if (Proutespline(Z._().edges, poly.getInt("pn"), pl, evs.asPtr(), spl.amp()) < 0)
return null;
}
if (mkspacep(spl.getInt("pn")))
return null;
for (i = 0; i < spl.getInt("pn"); i++) {
Z._().ps.plus(i).setStruct(spl.getArrayOfPtr("ps").plus(i).getStruct());
}
n_spl_pts[0] = spl.getInt("pn");
return (pointf) Z._().ps;
} finally {
LEAVING("7ebl6qohcfpf1b9ucih5r9qgp","simpleSplineRoute");
}
}
@ -958,10 +964,10 @@ UNSUPPORTED("2bfai79qe7cec0rljrn56jg2f"); // polypoints[pi].x = boxes[bi].LL.x
UNSUPPORTED("99xeozpks5v0iza4sv2occuuq"); // polypoints[pi++].y = boxes[bi].LL.y;
}
else {
UNSUPPORTED("9sy5lvqkjszaj7mkb3qk3izfi"); // if (!(prev == -1 && next == -1)) {
if (N(prev == -1 && next == -1)) {
UNSUPPORTED("cgpvvfb9phbipyhij0cjh1nmi"); // agerr(AGERR, "in routesplines, illegal values of prev %d and next %d, line %d\n", prev, next, 444);
UNSUPPORTED("9idk92zg2ysz316lfwzvvvde6"); // return NULL;
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
}
}
}
for (bi = boxn - 1; bi >= 0; bi--) {
@ -1067,7 +1073,7 @@ UNSUPPORTED("elkeyywrfd4hq75w7toc94rzs"); // agerr(AGERR, "in routesplines,
UNSUPPORTED("7t3fvwp9cv90qu5bdjdglcgtk"); // return NULL;
}
}
if (mkspacep(spl.getInt("pn"))!=0)
if (mkspacep(spl.getInt("pn")))
UNSUPPORTED("7x5kpcbvg4va887hky7ufm45y"); // return NULL; /* Bailout if no memory left */
for (bi = 0; bi < boxn; bi++) {
boxes.plus(bi).getStruct("LL").setDouble("x", INT_MAX);
@ -1103,11 +1109,11 @@ UNSUPPORTED("7x5kpcbvg4va887hky7ufm45y"); // return NULL; /* Bailout if no mem
* to bound the boxes. This will probably mean a bad edge, but we avoid an infinite
* loop and we can see the bad edge, and even use the showboxes scaffolding.
*/
UNSUPPORTED("dq4scgmq09tpzdpj3ypsvucuk"); // Ppolyline_t polyspl;
UNSUPPORTED("7vpdw0fivvxuto2e92dmczab4"); // agerr(AGWARN, "Unable to reclaim box space in spline routing for edge \"%s\" -> \"%s\". Something is probably seriously wrong.\n", agnameof(agtail(realedge)), agnameof(aghead(realedge)));
UNSUPPORTED("9ap97qkchbjhqg0jc1eqy4hh0"); // make_polyline (pl, &polyspl);
UNSUPPORTED("bfoej0f2mcz7xexavgjym2kgg"); // limitBoxes (boxes, boxn, polyspl.ps, polyspl.pn, 10);
UNSUPPORTED("a8f7pwzw79z7tbespuoicwlxz"); // free (polyspl.ps);
final __struct__<Ppoly_t> polyspl = __struct__.from(Ppoly_t.class);
System.err.println("Unable to reclaim box space in spline routing for edge \"%s\" -> \"%s\". Something is probably seriously wrong.\n");
make_polyline (pl, polyspl.amp());
limitBoxes (boxes, boxn, polyspl.getPtr("ps"), polyspl.getInt("pn"), 10);
Memory.free (polyspl.getPtr("ps"));
}
npoints[0] = spl.getInt("pn");
return Z._().ps;
@ -1222,16 +1228,21 @@ UNSUPPORTED("btmwubugs9vkexo4yb7a5nqel"); // return 1;
printpath(thepath);
}*/
if (errs > 0) {
UNSUPPORTED("b2a4aff4319p975kb35502rt"); // int xy;
UNSUPPORTED("dhses9ec3tbm5732jj9lvt5qd"); // if (l == 1)
UNSUPPORTED("5xoc443felt982y66svs8jxze"); // xy = ba.getStruct("UR").getDouble("x"), ba.getStruct("UR").getDouble("x") = bb.getStruct("LL").getDouble("x"), bb.getStruct("LL").getDouble("x") = xy, l = 0;
UNSUPPORTED("er58lkogm8rxcgq9a6gxab46d"); // else if (r == 1)
int xy;
if (l == 1)
{
xy = (int) ba.getStruct("UR").getDouble("x");
ba.getStruct("UR").setDouble("x", bb.getStruct("LL").getDouble("x"));
bb.getStruct("LL").setDouble("x", xy);
l = 0;
}
else if (r == 1)
UNSUPPORTED("3naapn9c6ymy8kj291147k4z4"); // xy = ba.getStruct("LL").getDouble("x"), ba.getStruct("LL").getDouble("x") = bb.getStruct("UR").getDouble("x"), bb.getStruct("UR").getDouble("x") = xy, r = 0;
UNSUPPORTED("dmpcyp4r6kngm0nsey7m5dg61"); // else if (d == 1)
else if (d == 1)
UNSUPPORTED("eg1w87s0blk4i583rqumhmv6n"); // xy = ba.getStruct("UR").getDouble("y"), ba.getStruct("UR").getDouble("y") = bb.getStruct("LL").getDouble("y"), bb.getStruct("LL").getDouble("y") = xy, d = 0;
UNSUPPORTED("ejh4yg6840ry052u0ahxlj27q"); // else if (u == 1)
else if (u == 1)
UNSUPPORTED("5kcd52bwvbxxs0md0enfs100u"); // xy = ba.getStruct("LL").getDouble("y"), ba.getStruct("LL").getDouble("y") = bb.getStruct("UR").getDouble("y"), bb.getStruct("UR").getDouble("y") = xy, u = 0;
UNSUPPORTED("dyx52xnuxbagn7ul05pr5t2d6"); // for (i = 0; i < errs - 1; i++) {
for (i = 0; i < errs - 1; i++) {
UNSUPPORTED("as3p2ldwbg3rbgy64oxx5phar"); // if (l == 1)
UNSUPPORTED("efz1z5cfywki1k6q6avldku9z"); // xy = (ba.getStruct("UR").getDouble("x") + bb.getStruct("LL").getDouble("x")) / 2.0 + 0.5, ba.getStruct("UR").getDouble("x") =
UNSUPPORTED("6dfh7cf1xptapqd1mcqtxjrxa"); // bb.getStruct("LL").getDouble("x") = xy, l = 0;
@ -1244,7 +1255,7 @@ UNSUPPORTED("bccpbv2n38c5utkfh7msoc2y"); // bb.getStruct("LL").getDouble("y")
UNSUPPORTED("7302rnmwdji9n7txquk8k36to"); // else if (u == 1)
UNSUPPORTED("9oqpoodvpheztihe63p40guof"); // xy = (ba.getStruct("LL").getDouble("y") + bb.getStruct("UR").getDouble("y")) / 2.0 + 0.5, ba.getStruct("LL").getDouble("y") =
UNSUPPORTED("2cnb1bdjh6y26f98vonla73qa"); // bb.getStruct("UR").getDouble("y") = xy, u = 0;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
}
}
/* check for overlapping boxes */
xoverlap = overlap(ba.getStruct("LL").getDouble("x"), ba.getStruct("UR").getDouble("x"), bb.getStruct("LL").getDouble("x"), bb.getStruct("UR").getDouble("x"));
@ -1326,7 +1337,7 @@ LEAVING("dxqjhiid5f58b9gjxp0v3j97b","checkpath");
//3 de6jvvw786rx88318tuuqywgq
// static int mkspacep(int size)
public static int mkspacep(int size) {
public static boolean mkspacep(int size) {
ENTERING("de6jvvw786rx88318tuuqywgq","mkspacep");
try {
if (size > Z._().maxpn) {
@ -1338,7 +1349,7 @@ UNSUPPORTED("btmwubugs9vkexo4yb7a5nqel"); // return 1;
}
Z._().maxpn = newmax;
}
return 0;
return false;
} finally {
LEAVING("de6jvvw786rx88318tuuqywgq","mkspacep");
}

View File

@ -942,10 +942,10 @@ try {
for (orig = fe; ED_edge_type(orig) != 0; orig = ED_to_orig(orig));
/* may be a reversed flat edge */
if (N(info.getBoolean("ignoreSwap")) && (ND_rank(tn) == ND_rank(hn)) && (ND_order(tn) > ND_order(hn))) {
UNSUPPORTED("65xicmirciyw0gw730ccs8jmj"); // node_t *tmp;
UNSUPPORTED("c3kh6s8fmv0y5nmh7a8ra0vjl"); // tmp = hn;
UNSUPPORTED("48krk9qra5nhqezsw5jka9dl4"); // hn = tn;
UNSUPPORTED("4jl5028eiwqrnkrhwhsxk8hk7"); // tn = tmp;
Agnode_s tmp;
tmp = hn;
hn = tn;
tn = tmp;
}
if (EQ(tn, agtail(orig))) {
clipTail = ED_tail_port(orig).getInt("clip");

View File

@ -50,6 +50,7 @@ import static gen.lib.common.memory__c.zmalloc;
import static gen.lib.common.shapes__c.bind_shape;
import static gen.lib.common.shapes__c.shapeOf;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.atoi;
import static smetana.core.JUtils.enumAsInt;
@ -972,7 +973,7 @@ UNSUPPORTED("35c97tyk6tzw1g527j6rp6xoo"); // u = UF_find(u);
ND_UF_parent(v, v);
ND_UF_size(v, 1);
} else
UNSUPPORTED("ej1tfzdtk6s4n8diwx5i3e4ri"); // v = UF_find(v);
v = UF_find(v);
if (ND_id(u) > ND_id(v)) {
UNSUPPORTED("2igr3ntnkm6svji4pbnjlp54e"); // ND_UF_parent(u) = v;
UNSUPPORTED("3lht90i6tvxbr10meir8nvcic"); // ND_UF_size(v) += ND_UF_size(u);
@ -2350,7 +2351,7 @@ throw new UnsupportedOperationException();
public static CString htmlEntityUTF8(CString s, Agraph_s g) {
ENTERING("9yungx7uxqkmzfh2ub6gs9l48","htmlEntityUTF8");
try {
System.err.println("htmlEntityUTF8 "+s);
LOG2("htmlEntityUTF8 "+s);
if (s!=null) return s.duplicate();
UNSUPPORTED("1xtgr84lklglr4gz1i1m3t30"); // char* htmlEntityUTF8 (char* s, graph_t* g)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {

View File

@ -59,6 +59,10 @@ import static gen.lib.dotgen.fastgr__c.delete_fast_edge;
import static gen.lib.dotgen.fastgr__c.delete_fast_node;
import static gen.lib.dotgen.fastgr__c.fast_node;
import static gen.lib.dotgen.fastgr__c.find_fast_edge;
import static gen.lib.dotgen.fastgr__c.find_flat_edge;
import static gen.lib.dotgen.fastgr__c.flat_edge;
import static gen.lib.dotgen.fastgr__c.merge_oneway;
import static gen.lib.dotgen.fastgr__c.other_edge;
import static gen.lib.dotgen.fastgr__c.virtual_edge;
import static gen.lib.dotgen.fastgr__c.virtual_node;
import static gen.lib.dotgen.mincross__c.allocate_ranks;
@ -67,6 +71,7 @@ import static gen.lib.dotgen.mincross__c.enqueue_neighbors;
import static gen.lib.dotgen.mincross__c.install_in_rank;
import static gen.lib.dotgen.position__c.ports_eq;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.sizeof_starstar_empty;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
@ -90,11 +95,13 @@ import static smetana.core.Macro.GD_rankleader;
import static smetana.core.Macro.ND_UF_size;
import static smetana.core.Macro.ND_clust;
import static smetana.core.Macro.ND_in;
import static smetana.core.Macro.ND_lw;
import static smetana.core.Macro.ND_node_type;
import static smetana.core.Macro.ND_order;
import static smetana.core.Macro.ND_out;
import static smetana.core.Macro.ND_rank;
import static smetana.core.Macro.ND_ranktype;
import static smetana.core.Macro.ND_rw;
import static smetana.core.Macro.NOT;
import static smetana.core.Macro.UNSUPPORTED;
import h.Agedge_s;
@ -775,13 +782,13 @@ try {
__ptr__ vlist;
vlist = GD_rank(root).plus(r).getPtr().getArrayOfPtr("v").asPtr();
if (d <= 0) {
UNSUPPORTED("4j1uy4i8jmj8ky4pnhqdp3hu"); // for (i = pos - d + 1; i < GD_rank(root)[r].n; i++) {
UNSUPPORTED("c2bblbvuyzu278hg73e0v9ias"); // v = vlist[i];
UNSUPPORTED("8z4668r4wjhdszu5exo9uv4bx"); // ND_order(v) = i + d - 1;
UNSUPPORTED("68gyj82gqshz5j6cagzfm6qow"); // vlist[ND_order(v)] = v;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("1w3sxuwhqr49qyynhkxqh9m68"); // for (i = GD_rank(root)[r].n + d - 1; i < GD_rank(root)[r].n; i++)
UNSUPPORTED("9vbx5od7t2kzw09v2mfyihu61"); // vlist[i] = NULL;
for (i = pos - d + 1; i < GD_rank(root).plus(r).getInt("n"); i++) {
v = (Agnode_s) vlist.plus(i).getPtr();
ND_order(v, i + d - 1);
vlist.plus(ND_order(v)).setPtr(v);
}
for (i = GD_rank(root).plus(r).getInt("n") + d - 1; i < GD_rank(root).plus(r).getInt("n"); i++)
vlist.plus(i).setPtr(null);
} else {
/*assert(ND_rank(root)[r].n + d - 1 <= ND_rank(root)[r].an);*/
for (i = GD_rank(root).plus(r).getPtr().getInt("n") - 1; i > pos; i--) {
@ -803,24 +810,25 @@ LEAVING("5ib4nnt2ah5fdd22zs0xds29r","make_slots");
//3 d4mwxesl56uh9dyttg9cjlq70
// static node_t* clone_vn(graph_t * g, node_t * vn)
public static Object clone_vn(Object... arg) {
UNSUPPORTED("5h97lag1uc713a403n4ytn4l8"); // static node_t*
UNSUPPORTED("6cdhbndwzvzzk6jejejcbboyd"); // clone_vn(graph_t * g, node_t * vn)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("4302bhte4qzbdabx61n5e2rim"); // node_t *rv;
UNSUPPORTED("p6jnh7nvcpnl3zbz636pskbs"); // int r;
UNSUPPORTED("195ae59wpeaox749qavq94ywq"); // r = ND_rank(vn);
UNSUPPORTED("dp36udfcdslnyedn4oalhjjkj"); // make_slots(g, r, ND_order(vn), 2);
UNSUPPORTED("cvrll8cgny6kz7junxwy435ke"); // rv = virtual_node(g);
UNSUPPORTED("eznvurrhiy08b2bgzahws7gkq"); // ND_lw(rv) = ND_lw(vn);
UNSUPPORTED("3e7v6qne6z4l9raqrcxsbnc58"); // ND_rw(rv) = ND_rw(vn);
UNSUPPORTED("6r1snmbt81xbtbcu38aevfayd"); // ND_rank(rv) = ND_rank(vn);
UNSUPPORTED("1xjquwevhtwmdpcxjjr2e7719"); // ND_order(rv) = ND_order(vn) + 1;
public static Agnode_s clone_vn(Agraph_s g, Agnode_s vn) {
ENTERING("d4mwxesl56uh9dyttg9cjlq70","clone_vn");
try {
Agnode_s rv;
int r;
r = ND_rank(vn);
make_slots(g, r, ND_order(vn), 2);
rv = virtual_node(g);
ND_lw(rv, ND_lw(vn));
ND_rw(rv, ND_rw(vn));
ND_rank(rv, ND_rank(vn));
UNSUPPORTED("adc0qfdhup29vh8qu1cwl5jgj"); // GD_rank(g)[r].v[ND_order(rv)] = rv;
UNSUPPORTED("v7vqc9l7ge2bfdwnw11z7rzi"); // return rv;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
} finally {
LEAVING("d4mwxesl56uh9dyttg9cjlq70","clone_vn");
}
}
@ -838,38 +846,38 @@ try {
if (EQ(agtail(ve), from) && EQ(aghead(ve), to))
return;
if (ED_count(ve) > 1) {
UNSUPPORTED("amzisjlzyd7kcnykhwm3emzsw"); // ED_to_virt(orig) = NULL;
UNSUPPORTED("3usjzgkkiqzrkacya4l5x1wwv"); // if (ND_rank(to) - ND_rank(from) == 1) {
UNSUPPORTED("7rikcljs70u4mv2pl0nxrkozq"); // if ((e = find_fast_edge(from, to)) && (ports_eq(orig, e))) {
UNSUPPORTED("15imfa3fwa9eecqbv04gdlz9g"); // merge_oneway(orig, e);
UNSUPPORTED("3wix4edrrj20l71i08ckve4ao"); // if ((ND_node_type(from) == 0)
UNSUPPORTED("blnvalvptm73qbqedzi8o5qx2"); // && (ND_node_type(to) == 0))
UNSUPPORTED("1qiw6v20ddsxgj17i5pnlvjyn"); // other_edge(orig);
UNSUPPORTED("6bj8inpmr5ulm16jmfxsstjtn"); // return;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("1x35hzfwt92fmliibo5v89m7c"); // u = from;
UNSUPPORTED("e0x5b4qz9ijzzy3o87otbxuq9"); // for (r = ND_rank(from); r < ND_rank(to); r++) {
UNSUPPORTED("4u4cndjol9mjoizaxexkijz6b"); // if (r < ND_rank(to) - 1)
UNSUPPORTED("7nfktz3r8rlmo2rcg7y075ufe"); // v = clone_vn(dot_root(from), aghead(ve));
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
UNSUPPORTED("cirictno38xls9e6dhksdpmp2"); // v = to;
UNSUPPORTED("6ghi2o0a6dgb9jlk96ydus4c"); // e = virtual_edge(u, v, orig);
UNSUPPORTED("6q6y62qde57z3lsb2801pkn7b"); // ED_edge_type(e) = type;
UNSUPPORTED("7lybui6nu0sgimvycjyy3685h"); // u = v;
UNSUPPORTED("6jjh353s9hrfwqh6yru1b875w"); // ED_count(ve)--;
UNSUPPORTED("5evemf4tm2qpxh7ii2pzs3ba8"); // ve = ND_out(aghead(ve)).list[0];
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
ED_to_virt(orig, null);
if (ND_rank(to) - ND_rank(from) == 1) {
if ((e = find_fast_edge(from, to))!=null && (ports_eq(orig, e))) {
merge_oneway(orig, e);
if ((ND_node_type(from) == 0)
&& (ND_node_type(to) == 0))
other_edge(orig);
return;
}
}
u = from;
for (r = ND_rank(from); r < ND_rank(to); r++) {
if (r < ND_rank(to) - 1)
v = clone_vn(dot_root(from), aghead(ve));
else
v = to;
e = virtual_edge(u, v, orig);
ED_edge_type(e, type);
u = v;
ED_count(ve, ED_count(ve) - 1);
ve = (Agedge_s) ND_out(aghead(ve)).getArrayOfPtr("list").plus(0).getPtr();
}
} else {
if (ND_rank(to) - ND_rank(from) == 1) {
if ((ve = find_fast_edge(from, to))!=null && (ports_eq(orig, ve))) {
/*ED_to_orig(ve) = orig; */
UNSUPPORTED("5p2khszrc6g7ru07ssw0mqrdj"); // ED_to_virt(orig) = ve;
UNSUPPORTED("2s25e03vchcien0roipesjdmf"); // ED_edge_type(ve) = type;
UNSUPPORTED("23p8k5rg6ca82g2enw2wyuxkq"); // ED_count(ve)++;
UNSUPPORTED("3wix4edrrj20l71i08ckve4ao"); // if ((ND_node_type(from) == 0)
UNSUPPORTED("blnvalvptm73qbqedzi8o5qx2"); // && (ND_node_type(to) == 0))
UNSUPPORTED("1qiw6v20ddsxgj17i5pnlvjyn"); // other_edge(orig);
ED_to_virt(orig, ve);
ED_edge_type(ve, type);
ED_count(ve, ED_count(ve)+1);
if ((ND_node_type(from) == 0)
&& (ND_node_type(to) == 0))
other_edge(orig);
} else {
ED_to_virt(orig, null);
ve = virtual_edge(from, to, orig);
@ -877,21 +885,22 @@ UNSUPPORTED("1qiw6v20ddsxgj17i5pnlvjyn"); // other_edge(orig);
}
}
if (ND_rank(to) - ND_rank(from) > 1) {
UNSUPPORTED("atpqi8htn5pfsp83jsjnpya6u"); // e = ve;
UNSUPPORTED("48q2i88h3eiwyvatk52go1qk3"); // if (agtail(ve) != from) {
UNSUPPORTED("b87s1z4ymup7pt4ttlit23147"); // ED_to_virt(orig) = NULL;
UNSUPPORTED("artn59emuxdx7iczkltmrkps0"); // e = ED_to_virt(orig) = virtual_edge(from, aghead(ve), orig);
UNSUPPORTED("a57axdi6yo27zbr1wjhy83ulz"); // delete_fast_edge(ve);
UNSUPPORTED("afk9bpom7x393euamnvwwkx6b"); // } else
UNSUPPORTED("8q8ufoa5cnfya3803on8l3iqi"); // e = ve;
UNSUPPORTED("841onu13nrkagywfwcs5ym6wy"); // while (ND_rank(aghead(e)) != ND_rank(to))
UNSUPPORTED("7zjq6cetd2j3icvu5rdxk4f0d"); // e = ND_out(aghead(e)).list[0];
UNSUPPORTED("4b6isfwr3ag7crntdsdg7uewy"); // if (aghead(e) != to) {
UNSUPPORTED("22buahogyeh9ri5tkqe69qsur"); // ve = e;
UNSUPPORTED("cdtd6iwjostde5uuwlole4e9m"); // e = virtual_edge(agtail(e), to, orig);
UNSUPPORTED("25nmda3y8wn495w90p98e8f3k"); // ED_edge_type(e) = type;
UNSUPPORTED("a57axdi6yo27zbr1wjhy83ulz"); // delete_fast_edge(ve);
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
e = ve;
if (NEQ(agtail(ve), from)) {
ED_to_virt(orig, null);
e = virtual_edge(from, aghead(ve), orig);
ED_to_virt(orig, e);
delete_fast_edge(ve);
} else
e = ve;
while (ND_rank(aghead(e)) != ND_rank(to))
e = (Agedge_s) ND_out(aghead(e)).getArrayOfPtr("list").plus(0).getPtr();
if (NEQ(aghead(e), to)) {
ve = e;
e = virtual_edge(agtail(e), to, orig);
ED_edge_type(e, type);
delete_fast_edge(ve);
}
}
}
} finally {
@ -956,15 +965,15 @@ UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue;
}
/* flat edges */
if (ND_rank(agtail(e)) == ND_rank(aghead(e))) {
UNSUPPORTED("7btwg6u7g9qqpsrjkx8kgqaxb"); // edge_t* fe;
UNSUPPORTED("19u95m77ae7zrrhs7zgxr1hg2"); // if ((fe = find_flat_edge(agtail(e), aghead(e))) == NULL) {
UNSUPPORTED("bpkb1088t7rphe02enn72qn3r"); // flat_edge(g, e);
UNSUPPORTED("2u7me39ekhszjmm5usw9gbdqu"); // prev = e;
UNSUPPORTED("b3t4l2xftweujklnzi93btx10"); // } else if (e != fe) {
Agedge_s fe;
if ((fe = find_flat_edge(agtail(e), aghead(e))) == null) {
flat_edge(g, e);
prev = e;
} else if (NEQ(e, fe)) {
UNSUPPORTED("ckfinb4h4twp1ry02y9peyhz"); // safe_other_edge(e);
UNSUPPORTED("dg3e0udctqa7xtfynplc7wdpj"); // if (!ED_to_virt(e)) merge_oneway(e, fe);
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue;
}
continue;
}
/* forward edges */
if (ND_rank(aghead(e)) > ND_rank(agtail(e))) {
@ -979,8 +988,8 @@ I think that make_interclust_chain should create call other_edge(e) anyway
if (agcontains(subg,agtail(e))
&& agfindedge(g,aghead(e),agtail(e))) other_edge(e);
*/
UNSUPPORTED("f3vsjiyhij046afu7hd6mozsu"); // make_interclust_chain(g, aghead(e), agtail(e), e);
UNSUPPORTED("dpsnmca44s1cfw35axk4m0slg"); // prev = e;
make_interclust_chain(g, aghead(e), agtail(e), e);
prev = e;
}
}
}
@ -1002,7 +1011,7 @@ try {
Agraph_s root;
root = dot_root(subg);
if (GD_minrank(subg) > 0)
UNSUPPORTED("6joeb28tqhza9srpo118g386i"); // GD_rank(root)[GD_minrank(subg) - 1].valid = 0;
GD_rank(root).plus(GD_minrank(subg) - 1).getPtr().setInt("valid", 0);
for (r = GD_minrank(subg); r <= GD_maxrank(subg); r++) {
d = GD_rank(subg).plus(r).getPtr().getInt("n");
ipos = pos = ND_order(GD_rankleader(subg).plus(r).getPtr());

View File

@ -53,6 +53,7 @@ import static gen.lib.common.routespl__c.routepolylines;
import static gen.lib.common.routespl__c.routesplines;
import static gen.lib.common.routespl__c.routesplinesinit;
import static gen.lib.common.routespl__c.routesplinesterm;
import static gen.lib.common.routespl__c.simpleSplineRoute;
import static gen.lib.common.splines__c.add_box;
import static gen.lib.common.splines__c.beginpath;
import static gen.lib.common.splines__c.clip_and_install;
@ -62,6 +63,7 @@ import static gen.lib.common.splines__c.makeSelfEdge;
import static gen.lib.common.utils__c.updateBB;
import static gen.lib.dotgen.cluster__c.mark_lowclusters;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.function;
import static smetana.core.JUtils.qsort;
@ -121,6 +123,7 @@ import h.Agedgeinfo_t;
import h.Agedgepair_s;
import h.Agnode_s;
import h.Agraph_s;
import h.Ppoly_t;
import h.attr_state_t;
import h.bezier;
import h.boxf;
@ -1063,10 +1066,10 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish;
* the label.
*/
if (ND_alg(n)!=null) {
UNSUPPORTED("5ccfgna84rl1jtgmuk8nbffqy"); // edge_t* fe = (edge_t*)ND_alg(n);
UNSUPPORTED("491vob6ykt7vk18zsgjm6l2zr"); // assert (ED_label(fe));
UNSUPPORTED("dmdpxf403p3cj5res72ow5qir"); // ED_label(fe)->pos = ND_coord(n);
UNSUPPORTED("equ6t5h0u8rkyhzp6p1aq8pvo"); // ED_label(fe)->set = NOT(0);
Agedge_s fe = (Agedge_s) ND_alg(n);
assert (ED_label(fe)!=null);
ED_label(fe).setStruct("pos", ND_coord(n));
ED_label(fe).setBoolean("set", NOT(false));
}
if ((ND_node_type(n) != 0) &&
((Boolean)Z._().sinfo.call("splineMerge", n) == false))
@ -1113,7 +1116,7 @@ UNSUPPORTED("equ6t5h0u8rkyhzp6p1aq8pvo"); // ED_label(fe)->set = NOT(0);
* alternatively, the edges would be routed identically if
* routed separately.
*/
System.err.println("_dot_splines::n_edges="+n_edges);
LOG2("_dot_splines::n_edges="+n_edges);
qsort(edges,
n_edges,
sizeof(edges.plus(0)),
@ -1141,8 +1144,8 @@ UNSUPPORTED("equ6t5h0u8rkyhzp6p1aq8pvo"); // ED_label(fe)->set = NOT(0);
ea = le0;
}
if ((ED_tree_index(ea) & 32)!=0) {
MAKEFWDEDGE(fwdedgea.getPtr("out"), ea);
ea = (Agedge_s) fwdedgea.getPtr("out");
MAKEFWDEDGE(fwdedgea.getStruct("out").amp(), ea);
ea = (Agedge_s) fwdedgea.getStruct("out").amp();
}
for (cnt = 1; i < n_edges; cnt++, i++) {
if (NEQ(le0, (le1 = getmainedge((e1 = (Agedge_s) edges.plus(i).getPtr())))))
@ -1158,8 +1161,8 @@ UNSUPPORTED("equ6t5h0u8rkyhzp6p1aq8pvo"); // ED_label(fe)->set = NOT(0);
eb = le1;
}
if ((ED_tree_index(eb) & 32)!=0) {
MAKEFWDEDGE(fwdedgeb.getPtr("out"), eb);
eb = (Agedge_s) fwdedgeb.getPtr("out");
MAKEFWDEDGE(fwdedgeb.getStruct("out").amp(), eb);
eb = (Agedge_s) fwdedgeb.getStruct("out").amp();
}
if (portcmp(ED_tail_port(ea), ED_tail_port(eb))!=0)
break;
@ -1664,34 +1667,34 @@ throw new UnsupportedOperationException();
//3 bmsa24i3avg14po4sp17yh89k
// static int edgelblcmpfn(edge_t** ptr0, edge_t** ptr1)
public static Object edgelblcmpfn(Object... arg) {
UNSUPPORTED("bpprhriznwcnjct5zqcou7m8f"); // static int edgelblcmpfn(edge_t** ptr0, edge_t** ptr1)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("bekm3nvdmmksf6fuk4ebx0eoo"); // edge_t *e0, *e1;
UNSUPPORTED("nf0dvqa1ifsp39t4smsyh4tb"); // pointf sz0, sz1;
UNSUPPORTED("2sguzqa05jlpshkbbs5vnvax2"); // e0 = (edge_t *) * ptr0;
UNSUPPORTED("3gec6wc34v653peyslti6c8dd"); // e1 = (edge_t *) * ptr1;
UNSUPPORTED("dp4m705lssyfr2abrrbddsyxg"); // if (ED_label(e0)) {
UNSUPPORTED("3ueklbixgh4gnq0br4l6tqvuz"); // if (ED_label(e1)) {
UNSUPPORTED("8q5z43uppd0rn6u72vdthk9b6"); // sz0 = ED_label(e0)->dimen;
UNSUPPORTED("2zevvu5qm54br9ge1zazfrf3m"); // sz1 = ED_label(e1)->dimen;
UNSUPPORTED("duxgwsffqp9a1h9sl2v2e9tf"); // if (sz0.x > sz1.x) return -1;
UNSUPPORTED("79e38copy8l25ha5nqukpa2wh"); // else if (sz0.x < sz1.x) return 1;
UNSUPPORTED("b9mymch7djnuzma81zl6df8bi"); // else if (sz0.y > sz1.y) return -1;
UNSUPPORTED("dj1uw3uyvsvll58hl4f1iwlwo"); // else if (sz0.y < sz1.y) return 1;
UNSUPPORTED("bsht41oaaw9oy0qm7l8osl1qf"); // else return 0;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
UNSUPPORTED("aivfd7ajlfz8o8oi68d4u5s5z"); // return -1;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("dz6ulpemg4obex4mjop6uv6qv"); // else if (ED_label(e1)) {
UNSUPPORTED("g33erfkpmmc8e97m2lozer00"); // return 1;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("div10atae09n36x269sl208r1"); // else
UNSUPPORTED("73tez52hdy56988t41gumuucn"); // return 0;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static int edgelblcmpfn(__ptr__ ptr0, __ptr__ ptr1) {
ENTERING("bmsa24i3avg14po4sp17yh89k","edgelblcmpfn");
try {
Agedge_s e0, e1;
final __struct__<pointf> sz0 = __struct__.from(pointf.class), sz1 = __struct__.from(pointf.class);
e0 = (Agedge_s) ptr0.getPtr();
e1 = (Agedge_s) ptr1.getPtr();
if (ED_label(e0)!=null) {
if (ED_label(e1)!=null) {
sz0.____(ED_label(e0).getStruct("dimen"));
sz1.____(ED_label(e1).getStruct("dimen"));
if (sz0.getDouble("x") > sz1.getDouble("x")) return -1;
else if (sz0.getDouble("x") < sz1.getDouble("x")) return 1;
else if (sz0.getDouble("y") > sz1.getDouble("y")) return -1;
else if (sz0.getDouble("y") < sz1.getDouble("y")) return 1;
else return 0;
}
else
return -1;
}
else if (ED_label(e1)!=null) {
return 1;
}
else
return 0;
} finally {
LEAVING("bmsa24i3avg14po4sp17yh89k","edgelblcmpfn");
}
}
@ -1699,69 +1702,72 @@ throw new UnsupportedOperationException();
//3 3xmylrnypvoqrj2yrxnomsj5k
// static void makeSimpleFlatLabels (node_t* tn, node_t* hn, edge_t** edges, int ind, int cnt, int et, int n_lbls)
public static Object makeSimpleFlatLabels(Object... arg) {
UNSUPPORTED("e2z2o5ybnr5tgpkt8ty7hwan1"); // static void
UNSUPPORTED("5jwc2jj83hhuvvy54nj85bc5q"); // makeSimpleFlatLabels (node_t* tn, node_t* hn, edge_t** edges, int ind, int cnt, int et, int n_lbls)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("2rkzhui0essisp5zlw44vx4j9"); // pointf *ps;
UNSUPPORTED("4a012clawvd7u5m72juylqzoa"); // Ppoly_t poly;
UNSUPPORTED("7hps2kejtrotcphg5gymma43b"); // int pn;
UNSUPPORTED("1sbv7puw2gxpf4wfn0j0sbryp"); // edge_t* e = edges[ind];
UNSUPPORTED("4zygpgquezw8ojsvhkuyy17k6"); // pointf points[10], tp, hp;
UNSUPPORTED("ycdjk17r9giyszvvm822d3qk"); // int i, pointn;
UNSUPPORTED("61hxiwtagp0kr4fipxlary12x"); // double leftend, rightend, ctrx, ctry, miny, maxy;
UNSUPPORTED("axryk67tfn7l8kkdgjnignhb2"); // double uminx, umaxx;
UNSUPPORTED("zenflmbhpxrs9seicrvwm8me"); // double lminx, lmaxx;
UNSUPPORTED("3sz8clnbtawese86cvtqwp3yp"); // edge_t** earray = (edge_t**)zmalloc((cnt)*sizeof(edge_t*));
UNSUPPORTED("1psokm6w9e7qw7fm2g1cayuk7"); // for (i = 0; i < cnt; i++) {
UNSUPPORTED("72a9x0kq3vswy9auaqfhnhovs"); // earray[i] = edges[ind + i];
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("446xq92bxbl2k8uqbilr3dha5"); // qsort (earray, cnt, sizeof(edge_t*), (qsort_cmpf) edgelblcmpfn);
UNSUPPORTED("4cby0ahh52quqwtfa5byip17k"); // tp = add_pointf(ND_coord(tn), ED_tail_port(e).p);
UNSUPPORTED("dryhza442km38sgkf3zxgqg96"); // hp = add_pointf(ND_coord(hn), ED_head_port(e).p);
UNSUPPORTED("8wjvt161y70v6nzt6chzisx0k"); // leftend = tp.x+ND_rw(tn);
UNSUPPORTED("4y7lyqfx32r6buucjpv2o28r6"); // rightend = hp.x-ND_lw(hn);
UNSUPPORTED("24nafj48v2f8krhb9tztdzk6n"); // ctrx = (leftend + rightend)/2.0;
UNSUPPORTED("488b6ubtfdyw1d0dbr7ju3ta3"); // /* do first edge */
UNSUPPORTED("9mlu15a0n900unzckhdkcq7m3"); // e = earray[0];
UNSUPPORTED("dko3xt785e372nj0fiocjfas"); // pointn = 0;
UNSUPPORTED("789k679usnyd8ga01hn299kab"); // points[pointn++] = tp;
UNSUPPORTED("789k679usnyd8ga01hn299kab"); // points[pointn++] = tp;
UNSUPPORTED("1v6vhh8cuuw278evsh9eonpq5"); // points[pointn++] = hp;
UNSUPPORTED("1v6vhh8cuuw278evsh9eonpq5"); // points[pointn++] = hp;
UNSUPPORTED("a2yw6ctif8hfe1zjqgnedvi0w"); // clip_and_install(e, aghead(e), points, pointn, &sinfo);
UNSUPPORTED("ptxzkden87b4l3jmangjtd34"); // ED_label(e)->pos.x = ctrx;
UNSUPPORTED("ctsf6gkklmzetcjhoizss103g"); // ED_label(e)->pos.y = tp.y + (ED_label(e)->dimen.y+6)/2.0;
UNSUPPORTED("enozfl7j6h8w022mcfi26x49l"); // ED_label(e)->set = NOT(0);
UNSUPPORTED("5tr6bkikvx0bv8ilez5gx8whs"); // miny = tp.y + 6/2.0;
UNSUPPORTED("7g3abc38abj5ovajl0vq9pzdy"); // maxy = miny + ED_label(e)->dimen.y;
UNSUPPORTED("4txpdvtiszmnbg7zek5egn5iq"); // uminx = ctrx - (ED_label(e)->dimen.x)/2.0;
UNSUPPORTED("c306pmudfe4dvmxdverkxhth5"); // umaxx = ctrx + (ED_label(e)->dimen.x)/2.0;
UNSUPPORTED("8nvbvvxrd8ta7hd4mss0l0kv1"); // for (i = 1; i < n_lbls; i++) {
UNSUPPORTED("cw5dagg5vx1ofozw5eia1t5vp"); // e = earray[i];
UNSUPPORTED("858cc456srdz74zcgayc7wwqr"); // if (i%2) { /* down */
UNSUPPORTED("4616my8bgm0q51dh88n2eyyan"); // if (i == 1) {
UNSUPPORTED("1lyk0hllf1cqiff560wris2ut"); // lminx = ctrx - (ED_label(e)->dimen.x)/2.0;
UNSUPPORTED("3w84dy8sp10g31q5c8uamgnro"); // lmaxx = ctrx + (ED_label(e)->dimen.x)/2.0;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("3khnuzhf3rjap4nlpz5zyuxxm"); // miny -= 6 + ED_label(e)->dimen.y;
UNSUPPORTED("7owdudualx55z2cnm9x3iio0w"); // points[0] = tp;
UNSUPPORTED("489ignd9e294avfsdd33p2ac4"); // points[1].x = tp.x;
UNSUPPORTED("a0ni9e32dwm5x5t9to71rt8e"); // points[1].y = miny - 6;
UNSUPPORTED("dz07qahag3syaocfg19tf0jok"); // points[2].x = hp.x;
UNSUPPORTED("axwwzd6gyd9yhw2ah8qwozfq4"); // points[2].y = points[1].y;
UNSUPPORTED("5x3shyk89lgm7x0nzj52wpi7o"); // points[3] = hp;
UNSUPPORTED("376abusgqcc1ghbcwcvz0u2tk"); // points[4].x = lmaxx;
UNSUPPORTED("2lzgl5468xguophz9d5wyer2x"); // points[4].y = hp.y;
UNSUPPORTED("3wspwfskkryjd70e4xp2kz1za"); // points[5].x = lmaxx;
UNSUPPORTED("evtuf01rkx2s6priil4255z2u"); // points[5].y = miny;
UNSUPPORTED("c1otfmzqugef25m21ie74g0ws"); // points[6].x = lminx;
UNSUPPORTED("1jtf9tastkvvyvtbzhccf2vh3"); // points[6].y = miny;
UNSUPPORTED("gqe7vy3bgizpk28ysodrmlyi"); // points[7].x = lminx;
UNSUPPORTED("30m9wc0rfxgimqgf7iau9222z"); // points[7].y = tp.y;
UNSUPPORTED("8p2fow3rbb01xupa4ir8d1g04"); // ctry = miny + (ED_label(e)->dimen.y)/2.0;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("3ewaxl0m5p32xzpb787j9ypli"); // else { /* up */
public static void makeSimpleFlatLabels(Agnode_s tn, Agnode_s hn, __ptr__ edges, int ind, int cnt, int et, int n_lbls) {
ENTERING("3xmylrnypvoqrj2yrxnomsj5k","makeSimpleFlatLabels");
try {
pointf ps;
final __struct__<Ppoly_t> poly = __struct__.from(Ppoly_t.class);
int pn[] = new int[1];
Agedge_s e = (Agedge_s) edges.plus(ind).getPtr();
final __array_of_struct__ points = __array_of_struct__.malloc(pointf.class, 10);
final __struct__<pointf> tp = __struct__.from(pointf.class), hp = __struct__.from(pointf.class);
int i, pointn;
double leftend, rightend, ctrx=0, ctry=0, miny, maxy;
double uminx=0, umaxx=0;
double lminx=0, lmaxx=0;
__ptr__ earray = zmalloc(sizeof_starstar_empty(Agedge_s.class, cnt));
for (i = 0; i < cnt; i++) {
earray.plus(i).setPtr(edges.plus(ind + i).getPtr());
}
qsort(earray,
cnt,
sizeof(earray.plus(0)),
function(dotsplines__c.class, "edgelblcmpfn"));
tp.____(add_pointf(ND_coord(tn), ED_tail_port(e).getStruct("p")));
hp.____(add_pointf(ND_coord(hn), ED_head_port(e).getStruct("p")));
leftend = tp.getDouble("x")+ND_rw(tn);
rightend = hp.getDouble("x")-ND_lw(hn);
ctrx = (leftend + rightend)/2.0;
/* do first edge */
e = (Agedge_s) earray.plus(0).getPtr();
pointn = 0;
points.plus(pointn++).setStruct(tp);
points.plus(pointn++).setStruct(tp);
points.plus(pointn++).setStruct(hp);
points.plus(pointn++).setStruct(hp);
clip_and_install(e, aghead(e), points.asPtr(), pointn, Z._().sinfo.amp());
ED_label(e).getStruct("pos").setDouble("x", ctrx);
ED_label(e).getStruct("pos").setDouble("y", tp.getDouble("y") + (ED_label(e).getStruct("dimen").getDouble("y")+6)/2.0);
ED_label(e).setBoolean("set", NOT(false));
miny = tp.getDouble("y") + 6/2.0;
maxy = miny + ED_label(e).getStruct("dimen").getDouble("y");
uminx = ctrx - (ED_label(e).getStruct("dimen").getDouble("x"))/2.0;
umaxx = ctrx + (ED_label(e).getStruct("dimen").getDouble("x"))/2.0;
for (i = 1; i < n_lbls; i++) {
e = (Agedge_s) earray.plus(i).getPtr();
if (i%2!=0) { /* down */
if (i == 1) {
lminx = ctrx - (ED_label(e).getStruct("dimen").getDouble("x"))/2.0;
lmaxx = ctrx + (ED_label(e).getStruct("dimen").getDouble("x"))/2.0;
}
miny -= 6 + ED_label(e).getStruct("dimen").getDouble("y");
points.plus(0).setStruct(tp);
points.plus(1).setDouble("x", tp.getDouble("x"));
points.plus(1).setDouble("y", miny - 6);
points.plus(2).setDouble("x", hp.getDouble("x"));
points.plus(2).setDouble("y", points.plus(1).getDouble("y"));
points.plus(3).setStruct(hp);
points.plus(4).setDouble("x", lmaxx);
points.plus(4).setDouble("y", hp.getDouble("y"));
points.plus(5).setDouble("x", lmaxx);
points.plus(5).setDouble("y", miny);
points.plus(6).setDouble("x", lminx);
points.plus(6).setDouble("y", miny);
points.plus(7).setDouble("x", lminx);
points.plus(7).setDouble("y", tp.getDouble("y"));
ctry = miny + (ED_label(e).getStruct("dimen").getDouble("y"))/2.0;
}
else { /* up */
UNSUPPORTED("7owdudualx55z2cnm9x3iio0w"); // points[0] = tp;
UNSUPPORTED("43w0zont6q3y1axlcy96rzm5x"); // points[1].x = uminx;
UNSUPPORTED("285u4l65puy5nr3pgq6acl4i2"); // points[1].y = tp.y;
@ -1779,41 +1785,41 @@ UNSUPPORTED("5s3o04yf5lzca6ruuygfxngj2"); // points[7].x = tp.x;
UNSUPPORTED("56zheeat0b8mo4uvlcbvgbu80"); // points[7].y = maxy + 6;
UNSUPPORTED("ehcig8trxc4ble6pcochubv7z"); // ctry = maxy + (ED_label(e)->dimen.y)/2.0 + 6;
UNSUPPORTED("e2zgxycgqefryde9nbv6cqz1u"); // maxy += ED_label(e)->dimen.y + 6;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("75a6iji0yg310vnetnuc5wq43"); // poly.pn = 8;
UNSUPPORTED("10g53vr9z7a487ec3fy1v1xd4"); // poly.ps = (Ppoint_t*)points;
UNSUPPORTED("4mm65gft9w77qj5fvhj4lsned"); // ps = simpleSplineRoute (tp, hp, poly, &pn, et == (3 << 1));
UNSUPPORTED("bsufj6s3achf08p108njdfyqc"); // if (pn == 0) return;
UNSUPPORTED("bfauvj1et1039p5lylbq9cwna"); // ED_label(e)->pos.x = ctrx;
UNSUPPORTED("29n6ff0nu4ib96r7udksrciot"); // ED_label(e)->pos.y = ctry;
UNSUPPORTED("b5zgnbnwstrrsh34jagfe347w"); // ED_label(e)->set = NOT(0);
UNSUPPORTED("62oxk9cc5wf0f8gqbothfte1f"); // clip_and_install(e, aghead(e), ps, pn, &sinfo);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("b3mrg93ei25xuwviibo7plfa1"); // /* edges with no labels */
UNSUPPORTED("d605k8ktvdxpsc8sz0yk98q5p"); // for (; i < cnt; i++) {
UNSUPPORTED("cw5dagg5vx1ofozw5eia1t5vp"); // e = earray[i];
UNSUPPORTED("858cc456srdz74zcgayc7wwqr"); // if (i%2) { /* down */
UNSUPPORTED("4616my8bgm0q51dh88n2eyyan"); // if (i == 1) {
UNSUPPORTED("5iy0rf8mtea300mpi3kaz19l0"); // lminx = (2*leftend + rightend)/3.0;
UNSUPPORTED("865d0dvhxlekx4nmlb8vjkfux"); // lmaxx = (leftend + 2*rightend)/3.0;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("cpdf600275c4xj6fwi597er2x"); // miny -= 6;
UNSUPPORTED("7owdudualx55z2cnm9x3iio0w"); // points[0] = tp;
UNSUPPORTED("489ignd9e294avfsdd33p2ac4"); // points[1].x = tp.x;
UNSUPPORTED("a0ni9e32dwm5x5t9to71rt8e"); // points[1].y = miny - 6;
UNSUPPORTED("dz07qahag3syaocfg19tf0jok"); // points[2].x = hp.x;
UNSUPPORTED("axwwzd6gyd9yhw2ah8qwozfq4"); // points[2].y = points[1].y;
UNSUPPORTED("5x3shyk89lgm7x0nzj52wpi7o"); // points[3] = hp;
UNSUPPORTED("376abusgqcc1ghbcwcvz0u2tk"); // points[4].x = lmaxx;
UNSUPPORTED("2lzgl5468xguophz9d5wyer2x"); // points[4].y = hp.y;
UNSUPPORTED("3wspwfskkryjd70e4xp2kz1za"); // points[5].x = lmaxx;
UNSUPPORTED("evtuf01rkx2s6priil4255z2u"); // points[5].y = miny;
UNSUPPORTED("c1otfmzqugef25m21ie74g0ws"); // points[6].x = lminx;
UNSUPPORTED("1jtf9tastkvvyvtbzhccf2vh3"); // points[6].y = miny;
UNSUPPORTED("gqe7vy3bgizpk28ysodrmlyi"); // points[7].x = lminx;
UNSUPPORTED("30m9wc0rfxgimqgf7iau9222z"); // points[7].y = tp.y;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("3ewaxl0m5p32xzpb787j9ypli"); // else { /* up */
}
poly.setInt("pn", 8);
poly.setPtr("ps", points.asPtr());
ps = simpleSplineRoute (tp, hp, poly, pn, et == (3 << 1));
if (pn[0] == 0) return;
ED_label(e).getStruct("pos").setDouble("x", ctrx);
ED_label(e).getStruct("pos").setDouble("y", ctry);
ED_label(e).setBoolean("set", NOT(false));
clip_and_install(e, aghead(e), ps, pn[0], Z._().sinfo.amp());
}
/* edges with no labels */
for (; i < cnt; i++) {
e = (Agedge_s) earray.plus(i).getPtr();
if (i%2!=0) { /* down */
if (i == 1) {
lminx = (2*leftend + rightend)/3.0;
lmaxx = (leftend + 2*rightend)/3.0;
}
miny -= 6;
points.plus(0).setStruct(tp);
points.plus(1).setDouble("x", tp.getDouble("x"));
points.plus(1).setDouble("y", miny - 6);
points.plus(2).setDouble("x", hp.getDouble("x"));
points.plus(2).setDouble("y", points.plus(1).getDouble("y"));
points.plus(3).setStruct(hp);
points.plus(4).setDouble("x", lmaxx);
points.plus(4).setDouble("y", hp.getDouble("y"));
points.plus(5).setDouble("x", lmaxx);
points.plus(5).setDouble("y", miny);
points.plus(6).setDouble("x", lminx);
points.plus(6).setDouble("y", miny);
points.plus(7).setDouble("x", lminx);
points.plus(7).setDouble("y", tp.getDouble("y"));
}
else { /* up */
UNSUPPORTED("7owdudualx55z2cnm9x3iio0w"); // points[0] = tp;
UNSUPPORTED("43w0zont6q3y1axlcy96rzm5x"); // points[1].x = uminx;
UNSUPPORTED("285u4l65puy5nr3pgq6acl4i2"); // points[1].y = tp.y;
@ -1830,17 +1836,17 @@ UNSUPPORTED("aqxt1dvgfq5zcptjwgx1b3mmq"); // points[6].y = maxy + 6;
UNSUPPORTED("5s3o04yf5lzca6ruuygfxngj2"); // points[7].x = tp.x;
UNSUPPORTED("56zheeat0b8mo4uvlcbvgbu80"); // points[7].y = maxy + 6;
UNSUPPORTED("7un2qk34mmmhqi296vl50bacs"); // maxy += + 6;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("75a6iji0yg310vnetnuc5wq43"); // poly.pn = 8;
UNSUPPORTED("10g53vr9z7a487ec3fy1v1xd4"); // poly.ps = (Ppoint_t*)points;
UNSUPPORTED("4mm65gft9w77qj5fvhj4lsned"); // ps = simpleSplineRoute (tp, hp, poly, &pn, et == (3 << 1));
UNSUPPORTED("bsufj6s3achf08p108njdfyqc"); // if (pn == 0) return;
UNSUPPORTED("62oxk9cc5wf0f8gqbothfte1f"); // clip_and_install(e, aghead(e), ps, pn, &sinfo);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("7wtbfdvnkrman3die9f019rui"); // free (earray);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
poly.setInt("pn", 8);
poly.setPtr("ps", points.asPtr());
ps = simpleSplineRoute (tp, hp, poly, pn, et == (3 << 1));
if (pn[0] == 0) return;
clip_and_install(e, aghead(e), ps, pn[0], Z._().sinfo.amp());
}
Memory.free (earray);
} finally {
LEAVING("3xmylrnypvoqrj2yrxnomsj5k","makeSimpleFlatLabels");
}
}
@ -2043,17 +2049,14 @@ try {
final __struct__<boxf> b = __struct__.from(boxf.class);
b.____(maximal_bbox(g, sp, n, null, e));
endp.setStruct("nb", b);
UNSUPPORTED("ea7i6u22d7eb1vhtlx2sbc66c"); // endp->sidemask = (1<<2);
UNSUPPORTED("c3u0b2z8mb4le2v1g6q8amjt"); // if (isBegin) beginpath(P, e, 2, endp, 0);
UNSUPPORTED("1e0zyjb03r85tgqddfnlk9e9"); // else endpath(P, e, 2, endp, 0);
UNSUPPORTED("7pwqqvagpkzye4cdmjlbrmt7a"); // b.UR.y = endp->boxes[endp->boxn - 1].UR.y;
UNSUPPORTED("1mefjjoto40rfwb1qhzvobhje"); // b.LL.y = endp->boxes[endp->boxn - 1].LL.y;
UNSUPPORTED("37959fgd5enhc5bdt7bt8cfbf"); // b = makeregularend(b, (1<<2), ND_coord(n).y + GD_rank(g)[ND_rank(n)].ht2);
UNSUPPORTED("6xj9sv3inmj1rwtz76qp6p30n"); // if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
endp.setInt("sidemask", 1<<2);
if (isBegin) beginpath(P, e, 2, endp, false);
else endpath(P, e, 2, endp, false);
b.getStruct("UR").setDouble("y", endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y"));
b.getStruct("LL").setDouble("y", endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("y"));
b.____(makeregularend(b, (1<<2), ND_coord(n).getDouble("y") + GD_rank(g).plus(ND_rank(n)).getDouble("ht2")));
if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y"))
UNSUPPORTED("cmjm4y40vf7wklmgz0ae4k36v"); // endp->boxes[endp->boxn++] = b;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
} finally {
LEAVING("fybar4mljnmkh3kure5k1eod","makeFlatEnd");
}
@ -2089,24 +2092,24 @@ throw new UnsupportedOperationException();
//3 w8ptjibydq995d2lexg85mku
// static void make_flat_labeled_edge(graph_t* g, spline_info_t* sp, path* P, edge_t* e, int et)
public static Object make_flat_labeled_edge(Object... arg) {
UNSUPPORTED("e2z2o5ybnr5tgpkt8ty7hwan1"); // static void
UNSUPPORTED("3ohhkrhwodpp2ice0mr96r0fk"); // make_flat_labeled_edge(graph_t* g, spline_info_t* sp, path* P, edge_t* e, int et)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("7i4zx1l44hsrj3ovenkyqmu9l"); // node_t *tn, *hn, *ln;
UNSUPPORTED("2rkzhui0essisp5zlw44vx4j9"); // pointf *ps;
UNSUPPORTED("32b8td88encjfj6yd1sp8bef"); // pathend_t tend, hend;
UNSUPPORTED("dcqg0glhpp5xiycq8ysah4mz4"); // boxf lb;
UNSUPPORTED("f30wry3u5mbfqq0e11encti67"); // int boxn, i, pn, ydelta;
UNSUPPORTED("6ag74vz3kjmohe4bp89fktey4"); // edge_t *f;
UNSUPPORTED("85ikcvhqpykw400r3iz3uhwn4"); // pointf points[7];
UNSUPPORTED("d0x4emyekwlcpua99voy3764p"); // tn = agtail(e);
UNSUPPORTED("axoua6xpo7xc40u2oj0a8dmr9"); // hn = aghead(e);
UNSUPPORTED("5fyuor3b7632bmym4rznt1qdz"); // for (f = ED_to_virt(e); ED_to_virt(f); f = ED_to_virt(f));
UNSUPPORTED("7v06c3pg8xkihe0etzl1w0dsk"); // ln = agtail(f);
UNSUPPORTED("3b7a4w24iwq44xlp0mq79vbmh"); // ED_label(e)->pos = ND_coord(ln);
UNSUPPORTED("enozfl7j6h8w022mcfi26x49l"); // ED_label(e)->set = NOT(0);
UNSUPPORTED("alxh3ri3i1owpusgyeog8hdsm"); // if (et == (1 << 1)) {
public static void make_flat_labeled_edge(Agraph_s g, spline_info_t sp, path P, Agedge_s e, int et) {
ENTERING("w8ptjibydq995d2lexg85mku","make_flat_labeled_edge");
try {
Agnode_s tn, hn, ln;
pointf ps = null;
final __struct__<pathend_t> tend = __struct__.from(pathend_t.class), hend = __struct__.from(pathend_t.class);
final __struct__<boxf> lb = __struct__.from(boxf.class);
int boxn, i, ydelta;
int pn[] = new int[1];
Agedge_s f;
final __array_of_struct__ points = __array_of_struct__.malloc(pointf.class, 7);
tn = agtail(e);
hn = aghead(e);
for (f = ED_to_virt(e); ED_to_virt(f)!=null; f = ED_to_virt(f));
ln = agtail(f);
ED_label(e).setStruct("pos", ND_coord(ln));
ED_label(e).setBoolean("set", NOT(false));
if (et == (1 << 1)) {
UNSUPPORTED("ataaqkehwb736ts2x6olzqokx"); // pointf startp, endp, lp;
UNSUPPORTED("48h6vk2e5niep4dmpua377248"); // startp = add_pointf(ND_coord(tn), ED_tail_port(e).p);
UNSUPPORTED("8fokfn1629eyiqnzi7mey9o2q"); // endp = add_pointf(ND_coord(hn), ED_head_port(e).p);
@ -2117,44 +2120,44 @@ UNSUPPORTED("16h577fdghqtaeot735guew4e"); // points[2] = points[3] = points[4]
UNSUPPORTED("9zjfovamhwwehbviws68s5woy"); // points[5] = points[6] = endp;
UNSUPPORTED("68ojpcos92c96bc0i5ag1yb6v"); // ps = points;
UNSUPPORTED("1uunj4jbr2uhiqxwor6rzmr3j"); // pn = 7;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("1nyzbeonram6636b1w955bypn"); // else {
UNSUPPORTED("a2ktjdvwdjqm5k16lyu2kb9p1"); // lb.LL.x = ND_coord(ln).x - ND_lw(ln);
UNSUPPORTED("aaxxwwsjqfp8wlp533usgoy1f"); // lb.UR.x = ND_coord(ln).x + ND_rw(ln);
UNSUPPORTED("9bzbf90sno5klnryi82eiq6no"); // lb.UR.y = ND_coord(ln).y + ND_ht(ln)/2;
UNSUPPORTED("7icctylzzzf3ri0g6b4xyk9uq"); // ydelta = ND_coord(ln).y - GD_rank(g)[ND_rank(tn)].ht1 -
UNSUPPORTED("595az3g8wpli9zbezhepmnhoj"); // ND_coord(tn).y + GD_rank(g)[ND_rank(tn)].ht2;
UNSUPPORTED("b8nayd66d4d320ka3ekuz7blh"); // ydelta /= 6.;
UNSUPPORTED("2ignn66bmpppbu7dp7w292etb"); // lb.LL.y = lb.UR.y - MAX(5.,ydelta);
UNSUPPORTED("cpcqkqkhkaviy153h92apd82e"); // boxn = 0;
UNSUPPORTED("54ht2ejal0tj2agculfiatewb"); // makeFlatEnd (g, sp, P, tn, e, &tend, NOT(0));
UNSUPPORTED("a5lgn4cehe2xhjf7cgo6c5htj"); // makeFlatEnd (g, sp, P, hn, e, &hend, 0);
UNSUPPORTED("7n7f256w4ewtzexwfxjo28b2"); // boxes[boxn].LL.x = tend.boxes[tend.boxn - 1].LL.x;
UNSUPPORTED("4j0i4s2lrtzag8b83kw9pjkwj"); // boxes[boxn].LL.y = tend.boxes[tend.boxn - 1].UR.y;
UNSUPPORTED("7l5fi22zal85w5dhymjexacfn"); // boxes[boxn].UR.x = lb.LL.x;
UNSUPPORTED("8hruixi5whaq33pyi09lkzkgf"); // boxes[boxn].UR.y = lb.LL.y;
UNSUPPORTED("cbrsymd5wpvadg3ziz4dypa50"); // boxn++;
UNSUPPORTED("7n7f256w4ewtzexwfxjo28b2"); // boxes[boxn].LL.x = tend.boxes[tend.boxn - 1].LL.x;
UNSUPPORTED("d3g098pcho9v9ps9dvglljhxj"); // boxes[boxn].LL.y = lb.LL.y;
UNSUPPORTED("46ftsiqovpzo9r0mnlc4nf83"); // boxes[boxn].UR.x = hend.boxes[hend.boxn - 1].UR.x;
UNSUPPORTED("9f0avhu5z1a4981e6fx1j7dxc"); // boxes[boxn].UR.y = lb.UR.y;
UNSUPPORTED("cbrsymd5wpvadg3ziz4dypa50"); // boxn++;
UNSUPPORTED("d2h8tilryherl5fzcnf40idnw"); // boxes[boxn].LL.x = lb.UR.x;
UNSUPPORTED("8hruixi5whaq33pyi09lkzkgf"); // boxes[boxn].UR.y = lb.LL.y;
UNSUPPORTED("89g976vu77oko4kykk8he02e1"); // boxes[boxn].LL.y = hend.boxes[hend.boxn - 1].UR.y;
UNSUPPORTED("46ftsiqovpzo9r0mnlc4nf83"); // boxes[boxn].UR.x = hend.boxes[hend.boxn - 1].UR.x;
UNSUPPORTED("cbrsymd5wpvadg3ziz4dypa50"); // boxn++;
UNSUPPORTED("btf01fbx0jvqqnw9jqujm3dex"); // for (i = 0; i < tend.boxn; i++) add_box(P, tend.boxes[i]);
UNSUPPORTED("6649sr74316jjvkmaog3es19a"); // for (i = 0; i < boxn; i++) add_box(P, boxes[i]);
UNSUPPORTED("54yh5l8nmdkl43k2b8rwna2wb"); // for (i = hend.boxn - 1; i >= 0; i--) add_box(P, hend.boxes[i]);
UNSUPPORTED("30lreuk69d9ofxwfrn3pknyer"); // if (et == (5 << 1)) ps = routesplines(P, &pn);
UNSUPPORTED("dfku80ag90r137s9az9493oow"); // else ps = routepolylines(P, &pn);
UNSUPPORTED("bsufj6s3achf08p108njdfyqc"); // if (pn == 0) return;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("2lwfdg8sizcd97rafsnx7tghs"); // clip_and_install(e, aghead(e), ps, pn, &sinfo);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
}
else {
lb.getStruct("LL").setDouble("x", ND_coord(ln).getDouble("x") - ND_lw(ln));
lb.getStruct("UR").setDouble("x", ND_coord(ln).getDouble("x") + ND_rw(ln));
lb.getStruct("UR").setDouble("y", ND_coord(ln).getDouble("y") + ND_ht(ln)/2);
ydelta = (int)(ND_coord(ln).getDouble("y") - GD_rank(g).plus(ND_rank(tn)).getDouble("ht1") -
ND_coord(tn).getDouble("y") + GD_rank(g).plus(ND_rank(tn)).getDouble("ht2"));
ydelta = (int)(ydelta / 6.);
lb.getStruct("LL").setDouble("y", lb.getStruct("UR").getDouble("y") - MAX(5.,ydelta));
boxn = 0;
makeFlatEnd (g, sp, P, tn, e, tend.amp(), NOT(false));
makeFlatEnd (g, sp, P, hn, e, hend.amp(), false);
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", lb.getStruct("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("LL").getDouble("y"));
boxn++;
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", lb.getStruct("LL").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("UR").getDouble("y"));
boxn++;
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", lb.getStruct("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("LL").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x"));
boxn++;
for (i = 0; i < tend.getInt("boxn"); i++) add_box(P, tend.getArrayOfStruct("boxes").plus(i).getStruct());
for (i = 0; i < boxn; i++) add_box(P, Z._().boxes.plus(i).getStruct());
for (i = hend.getInt("boxn") - 1; i >= 0; i--) add_box(P, hend.getArrayOfStruct("boxes").plus(i).getStruct());
if (et == (5 << 1)) ps = routesplines(P, pn);
else ps = routepolylines(P, pn);
if (pn[0] == 0) return;
}
clip_and_install(e, aghead(e), ps, pn[0], Z._().sinfo.amp());
} finally {
LEAVING("w8ptjibydq995d2lexg85mku","make_flat_labeled_edge");
}
}
@ -2249,8 +2252,8 @@ try {
e = (Agedge_s) edges.plus(ind).getPtr();
isAdjacent = ED_adjacent(e);
if ((ED_tree_index(e) & 32)!=0) {
MAKEFWDEDGE(fwdedge.getPtr("out"), e);
e = (Agedge_s) fwdedge.getPtr("out");
MAKEFWDEDGE(fwdedge.getStruct("out").amp(), e);
e = (Agedge_s) fwdedge.getStruct("out").amp();
}
for (i = 1; i < cnt; i++) {
if (ED_adjacent(edges.plus(ind+i).getPtr())!=0) {
@ -2304,26 +2307,26 @@ try {
final __struct__<boxf> b = __struct__.from(boxf.class);
e = (Agedge_s) edges.plus(ind + i).getPtr();
boxn = 0;
b.____(tend.getArrayOfPtr("boxes").plus(tend.getInt("boxn") - 1).getStruct());
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getPtr("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getPtr("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getPtr("UR").getDouble("x") + (i + 1) * stepx);
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", b.getPtr("UR").getDouble("y") + (i + 1) * stepy);
b.____(tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct());
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getStruct("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getStruct("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getStruct("UR").getDouble("x") + (i + 1) * stepx);
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", b.getStruct("UR").getDouble("y") + (i + 1) * stepy);
boxn++;
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfPtr("boxes").plus(tend.getInt("boxn") - 1).getPtr().getPtr("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", Z._().boxes.plus(boxn-1).getStruct().getStruct("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfPtr("boxes").plus(hend.getInt("boxn") - 1).getPtr().getPtr("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", Z._().boxes.plus(boxn).getStruct().getStruct("LL").getDouble("y") + stepy);
boxn++;
b.____(tend.getArrayOfPtr("boxes").plus(tend.getInt("boxn") - 1).getStruct());
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getPtr("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getPtr("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getPtr("LL").getDouble("x") - (i + 1) * stepx);
b.____(hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct());
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getStruct("UR").getDouble("x"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getStruct("UR").getDouble("y"));
Z._().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getStruct("LL").getDouble("x") - (i + 1) * stepx);
Z._().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", Z._().boxes.plus(boxn-1).getStruct().getStruct("LL").getDouble("y"));
boxn++;
for (j = 0; j < tend.getInt("boxn"); j++) add_box(P, tend.getArrayOfPtr("boxes").plus(j).getStruct());
for (j = 0; j < tend.getInt("boxn"); j++) add_box(P, tend.getArrayOfStruct("boxes").plus(j).getStruct());
for (j = 0; j < boxn; j++) add_box(P, Z._().boxes.plus(j).getStruct());
for (j = hend.getInt("boxn") - 1; j >= 0; j--) add_box(P, hend.getArrayOfPtr("boxes").plus(j).getStruct());
for (j = hend.getInt("boxn") - 1; j >= 0; j--) add_box(P, hend.getArrayOfStruct("boxes").plus(j).getStruct());
if (et == (5 << 1)) ps = (pointf) routesplines(P, pn);
else ps = (pointf) routepolylines(P, pn);
if (pn[0] == 0)
@ -2969,8 +2972,8 @@ LEAVING("9fsg0uiyhtrayd4mimmc0i25e","bot_bound");
public static boolean cl_vninside(Agraph_s cl, Agnode_s n) {
ENTERING("65uvkv1mextaah5m997ibe3qs","cl_vninside");
try {
return (BETWEEN(GD_bb(cl).getPtr("LL").getDouble("x"), (double)(ND_coord(n).getDouble("x")), GD_bb(cl).getPtr("UR").getDouble("x")) &&
BETWEEN(GD_bb(cl).getPtr("LL").getDouble("y"), (double)(ND_coord(n).getDouble("y")), GD_bb(cl).getPtr("UR").getDouble("y")));
return (BETWEEN(GD_bb(cl).getStruct("LL").getDouble("x"), (double)(ND_coord(n).getDouble("x")), GD_bb(cl).getStruct("UR").getDouble("x")) &&
BETWEEN(GD_bb(cl).getStruct("LL").getDouble("y"), (double)(ND_coord(n).getDouble("y")), GD_bb(cl).getStruct("UR").getDouble("y")));
} finally {
LEAVING("65uvkv1mextaah5m997ibe3qs","cl_vninside");
}

View File

@ -801,13 +801,13 @@ LEAVING("1yw7ahdnxnexnicj552zqyyej","find_fast_node");
//3 bf1j97keudu416avridkj9fpb
// edge_t *find_flat_edge(node_t * u, node_t * v)
public static Object find_flat_edge(Object... arg) {
UNSUPPORTED("7vpm7qea310e9m7awi46kfwai"); // edge_t *find_flat_edge(node_t * u, node_t * v)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("18qalexpxkuadlxy4m2s0n3kj"); // return ffe(u, ND_flat_out(u), v, ND_flat_in(v));
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static Agedge_s find_flat_edge(Agnode_s u, Agnode_s v) {
ENTERING("bf1j97keudu416avridkj9fpb","find_flat_edge");
try {
return ffe(u, ND_flat_out(u), v, ND_flat_in(v));
} finally {
LEAVING("bf1j97keudu416avridkj9fpb","find_flat_edge");
}
}
@ -1105,17 +1105,17 @@ LEAVING("8dvukicq96g5t3xgdl0ue35mj","flat_edge");
//3 clspalhiuedfnk9g9rlvfqpg7
// void delete_flat_edge(edge_t * e)
public static Object delete_flat_edge(Object... arg) {
UNSUPPORTED("aqfnj6ol88hxku6kp95jau3of"); // void delete_flat_edge(edge_t * e)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("axei6r4pdvrumkaqc9p82yzjh"); // assert(e != NULL);
UNSUPPORTED("9v6s5qnulknm8ocmw3u5trsva"); // if (ED_to_orig(e) && ED_to_virt(ED_to_orig(e)) == e)
UNSUPPORTED("c888zxlacyihq4c88giw4nx8t"); // ED_to_virt(ED_to_orig(e)) = NULL;
UNSUPPORTED("2xqnpgrhajmcb90rpbjdy5rvg"); // zapinlist(&(ND_flat_out(agtail(e))), e);
UNSUPPORTED("j90opr99k7w1rnczlsb5e6es"); // zapinlist(&(ND_flat_in(aghead(e))), e);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void delete_flat_edge(Agedge_s e) {
ENTERING("clspalhiuedfnk9g9rlvfqpg7","delete_flat_edge");
try {
assert(e != null);
if (ED_to_orig(e)!=null && EQ(ED_to_virt(ED_to_orig(e)), e))
ED_to_virt(ED_to_orig(e), null);
zapinlist((ND_flat_out(agtail(e))).amp(), e);
zapinlist((ND_flat_in(aghead(e))).amp(), e);
} finally {
LEAVING("clspalhiuedfnk9g9rlvfqpg7","delete_flat_edge");
}
}

View File

@ -41,36 +41,56 @@
package gen.lib.dotgen;
import static gen.lib.cgraph.edge__c.aghead;
import static gen.lib.cgraph.edge__c.agtail;
import static gen.lib.common.memory__c.zmalloc;
import static gen.lib.dotgen.dotinit__c.dot_root;
import static gen.lib.dotgen.fastgr__c.virtual_edge;
import static gen.lib.dotgen.fastgr__c.virtual_node;
import static gen.lib.dotgen.mincross__c.rec_reset_vlists;
import static gen.lib.dotgen.mincross__c.rec_save_vlists;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.sizeof_starstar_empty;
import static smetana.core.JUtilsDebug.ENTERING;
import static smetana.core.JUtilsDebug.LEAVING;
import static smetana.core.Macro.ALLOC;
import static smetana.core.Macro.ED_adjacent;
import static smetana.core.Macro.ED_dist;
import static smetana.core.Macro.ED_edge_type;
import static smetana.core.Macro.ED_head_port;
import static smetana.core.Macro.ED_label;
import static smetana.core.Macro.ED_tail_port;
import static smetana.core.Macro.ED_to_virt;
import static smetana.core.Macro.GD_flip;
import static smetana.core.Macro.GD_maxrank;
import static smetana.core.Macro.GD_minrank;
import static smetana.core.Macro.GD_n_cluster;
import static smetana.core.Macro.GD_nlist;
import static smetana.core.Macro.GD_rank;
import static smetana.core.Macro.GD_ranksep;
import static smetana.core.Macro.MAX;
import static smetana.core.Macro.N;
import static smetana.core.Macro.ND_alg;
import static smetana.core.Macro.ND_coord;
import static smetana.core.Macro.ND_flat_in;
import static smetana.core.Macro.ND_flat_out;
import static smetana.core.Macro.ND_ht;
import static smetana.core.Macro.ND_in;
import static smetana.core.Macro.ND_label;
import static smetana.core.Macro.ND_lw;
import static smetana.core.Macro.ND_next;
import static smetana.core.Macro.ND_node_type;
import static smetana.core.Macro.ND_order;
import static smetana.core.Macro.ND_other;
import static smetana.core.Macro.ND_out;
import static smetana.core.Macro.ND_rank;
import static smetana.core.Macro.ND_rw;
import static smetana.core.Macro.NOT;
import static smetana.core.Macro.UNSUPPORTED;
import h.Agedge_s;
import h.Agnode_s;
import h.Agraph_s;
import h.boxf;
import h.pointf;
import h.rank_t;
import smetana.core.__ptr__;
import smetana.core.__struct__;
@ -716,25 +736,28 @@ throw new UnsupportedOperationException();
//3 e0gtvsxlvztmwu8yy44wfvf97
// static node_t *make_vn_slot(graph_t * g, int r, int pos)
public static Object make_vn_slot(Object... arg) {
UNSUPPORTED("6m2xf6fxxaql7vem92hzjc8fp"); // static node_t *make_vn_slot(graph_t * g, int r, int pos)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("b17di9c7wgtqm51bvsyxz6e2f"); // int i;
UNSUPPORTED("k6mzus8dzfcrn2mimw2889gf"); // node_t **v, *n;
UNSUPPORTED("9volkyra7bou8xk4n58fmgayg"); // v = GD_rank(g)[r].v =
UNSUPPORTED("98pm80154jco555m8h96szolv"); // ALLOC(GD_rank(g)[r].n + 2, GD_rank(g)[r].v, node_t *);
UNSUPPORTED("1t4az8z4cu09ad732rhmg2zs9"); // for (i = GD_rank(g)[r].n; i > pos; i--) {
UNSUPPORTED("d653sou5aavushonpsq3rojar"); // v[i] = v[i - 1];
UNSUPPORTED("419bemae3pyxex9tkuozq4mcs"); // ND_order(v[i])++;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("5x919dkpsk0dy889enmq6whfw"); // n = v[pos] = virtual_node(g);
UNSUPPORTED("coce01g8l9wwvhm336qyr01pr"); // ND_order(n) = pos;
UNSUPPORTED("721r8n7jqzrn8p615jhj6e1nd"); // ND_rank(n) = r;
UNSUPPORTED("3aa4n8p5f3gmsm3ncf3kt0ppb"); // v[++(GD_rank(g)[r].n)] = NULL;
UNSUPPORTED("c5ot8tl1vuasdwmcuvxfbqr9s"); // return v[pos];
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static Agnode_s make_vn_slot(Agraph_s g, int r, int pos) {
ENTERING("e0gtvsxlvztmwu8yy44wfvf97","make_vn_slot");
try {
int i;
__ptr__ v;
Agnode_s n;
v = ALLOC(GD_rank(g).plus(r).getInt("n") + 2, GD_rank(g).plus(r).getPtr("v"), Agnode_s.class);
GD_rank(g).plus(r).setPtr("v", v);
for (i = GD_rank(g).plus(r).getInt("n"); i > pos; i--) {
v.plus(i).setPtr(v.plus(i - 1).getPtr());
ND_order(v.plus(i).getPtr(), ND_order(v.plus(i).getPtr())+1);
}
n = virtual_node(g);
v.plus(pos).setPtr(n);
ND_order(n, pos);
ND_rank(n, r);
GD_rank(g).plus(r).setInt("n", GD_rank(g).plus(r).getInt("n")+1);
v.plus(GD_rank(g).plus(r).getInt("n")).setPtr(null);
return (Agnode_s) v.plus(pos).getPtr();
} finally {
LEAVING("e0gtvsxlvztmwu8yy44wfvf97","make_vn_slot");
}
}
@ -742,22 +765,22 @@ throw new UnsupportedOperationException();
//3 d64wt9oqphauv3hp4axbg2ep3
// static void findlr(node_t * u, node_t * v, int *lp, int *rp)
public static Object findlr(Object... arg) {
UNSUPPORTED("681bcbcuif21qisamphs133uy"); // static void findlr(node_t * u, node_t * v, int *lp, int *rp)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("arkr7i4jzac7qk3u7gyj5ne5f"); // int l, r;
UNSUPPORTED("cfkl23mbdzjad4hcxx376f56l"); // l = ND_order(u);
UNSUPPORTED("b3yo6msovxcqte14ymf7bdjyd"); // r = ND_order(v);
UNSUPPORTED("7l6ijucuxeogy3xuz0xg9v6m8"); // if (l > r) {
UNSUPPORTED("6rwd1uzwub1i7fdj732xxx3pz"); // int t = l;
UNSUPPORTED("82gycmzjz3d4nhrib9iyrg9e6"); // l = r;
UNSUPPORTED("db6wv16tk7pw4usb2wkcu2qoq"); // r = t;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("8wqb8gv26n6bf4mwr5kuni32i"); // *lp = l;
UNSUPPORTED("dg3t88wsqmpoz8cxundhay27h"); // *rp = r;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void findlr(Agnode_s u, Agnode_s v, int lp[], int rp[]) {
ENTERING("d64wt9oqphauv3hp4axbg2ep3","findlr");
try {
int l, r;
l = ND_order(u);
r = ND_order(v);
if (l > r) {
int t = l;
l = r;
r = t;
}
lp[0] = l;
rp[0] = r;
} finally {
LEAVING("d64wt9oqphauv3hp4axbg2ep3","findlr");
}
}
@ -765,53 +788,54 @@ throw new UnsupportedOperationException();
//3 bwjjmaydx5a2fnpeoligkha0r
// static void setbounds(node_t * v, int *bounds, int lpos, int rpos)
public static Object setbounds(Object... arg) {
UNSUPPORTED("eh12vgz846rsgrkapf0el54dq"); // static void setbounds(node_t * v, int *bounds, int lpos, int rpos)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("8sfd94fmvgnux6fpkv2mh1fyr"); // int i, l, r, ord;
UNSUPPORTED("6ag74vz3kjmohe4bp89fktey4"); // edge_t *f;
UNSUPPORTED("6pgq59rfcqra1p4y9gfqbbe6f"); // if (ND_node_type(v) == 1) {
UNSUPPORTED("z9v7wcosgqr4lahnn5p124fl"); // ord = ND_order(v);
UNSUPPORTED("5ler26nqdkle00g8mf3hmjk7y"); // if (ND_in(v).size == 0) { /* flat */
UNSUPPORTED("68mw0v10p28v1l9wiev8wiwwe"); // assert(ND_out(v).size == 2);
UNSUPPORTED("2p6ryz10nmc2nnb3wjeqv59u7"); // findlr(aghead(ND_out(v).list[0]), aghead(ND_out(v).list[1]), &l,
UNSUPPORTED("6l0e20kyakuyzpdg48nc14sct"); // &r);
UNSUPPORTED("9cryh0v2a4y3bxo8ymkchbs7o"); // /* the other flat edge could be to the left or right */
UNSUPPORTED("7sgnk9izzhdr8zcxc3kr69f9k"); // if (r <= lpos)
UNSUPPORTED("bnb5eabiuho72dql5vn30qj9j"); // bounds[2] = bounds[0] = ord;
UNSUPPORTED("epc2twtjdh3r3wo9xn28i7pyx"); // else if (l >= rpos)
UNSUPPORTED("4dlbkbik5ngvtp3qnxsxmwzai"); // bounds[3] = bounds[1] = ord;
UNSUPPORTED("4vrvr66gereeur03utb20qgp6"); // /* could be spanning this one */
UNSUPPORTED("4feswozh0ao93z431h9ujklum"); // else if ((l < lpos) && (r > rpos)); /* ignore */
UNSUPPORTED("18i9llnvinqtpimsosit4m40r"); // /* must have intersecting ranges */
UNSUPPORTED("6q044im7742qhglc4553noina"); // else {
UNSUPPORTED("acar424w2sae3hmeex20r8527"); // if ((l < lpos) || ((l == lpos) && (r < rpos)))
UNSUPPORTED("5uufcofg08a5z9og8eqr33rpo"); // bounds[2] = ord;
UNSUPPORTED("7n9lwgeo2dn1xk207ig8ym9jh"); // if ((r > rpos) || ((r == rpos) && (l > lpos)))
UNSUPPORTED("5lgtzk9e0kqeju0ljn7bdjnav"); // bounds[3] = ord;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("5ec6i27os7k6h5wbpf1m0dw3r"); // } else { /* forward */
UNSUPPORTED("dxsyfhmm2n87tu1rcz4ibn7ln"); // boolean onleft, onright;
UNSUPPORTED("1tis7oczmmke48lchz9ywixrq"); // onleft = onright = 0;
UNSUPPORTED("c0ju79jfpf8rwox0n1r1y87uu"); // for (i = 0; (f = ND_out(v).list[i]); i++) {
UNSUPPORTED("30ffttqa49q5i7t4t5td9snec"); // if (ND_order(aghead(f)) <= lpos) {
UNSUPPORTED("3w4qosbmlbp893czpb4ylcpm"); // onleft = NOT(0);
UNSUPPORTED("2yi9az7ibt7j9bwztjilyo0v2"); // continue;
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
UNSUPPORTED("c5edwmybh587pr07dirbdi31h"); // if (ND_order(aghead(f)) >= rpos) {
UNSUPPORTED("er4yvpcdf0st411gonh1gbqts"); // onright = NOT(0);
UNSUPPORTED("2yi9az7ibt7j9bwztjilyo0v2"); // continue;
UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // }
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("d1zigzczzi72fqgney93wg4dj"); // if (onleft && (onright == 0))
UNSUPPORTED("e017pvlz8jlng4axrlfzpx08o"); // bounds[0] = ord + 1;
UNSUPPORTED("7kc4dw4aciei6s2witludqcjc"); // if (onright && (onleft == 0))
UNSUPPORTED("dombbs101g2x93io2heyqos7a"); // bounds[1] = ord - 1;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void setbounds(Agnode_s v, int bounds[], int lpos[], int rpos[]) {
ENTERING("bwjjmaydx5a2fnpeoligkha0r","setbounds");
try {
int i, ord;
int[] l = new int[1], r = new int[1];
Agedge_s f;
if (ND_node_type(v) == 1) {
ord = ND_order(v);
if (ND_in(v).getInt("size") == 0) { /* flat */
assert(ND_out(v).getInt("size") == 2);
findlr((Agnode_s) aghead(ND_out(v).getArrayOfPtr("list").plus(0).getPtr()), (Agnode_s) aghead(ND_out(v).getArrayOfPtr("list").plus(1).getPtr()), l,
r);
/* the other flat edge could be to the left or right */
if (r[0] <= lpos[0])
bounds[2] = bounds[0] = ord;
else if (l[0] >= rpos[0])
bounds[3] = bounds[1] = ord;
/* could be spanning this one */
else if ((l[0] < lpos[0]) && (r[0] > rpos[0])); /* ignore */
/* must have intersecting ranges */
else {
if ((l[0] < lpos[0]) || ((l[0] == lpos[0]) && (r[0] < rpos[0])))
bounds[2] = ord;
if ((r[0] > rpos[0]) || ((r[0] == rpos[0]) && (l[0] > lpos[0])))
bounds[3] = ord;
}
} else { /* forward */
boolean onleft, onright;
onleft = onright = false;
for (i = 0; (f = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) {
if (ND_order(aghead(f)) <= lpos[0]) {
onleft = NOT(false);
continue;
}
if (ND_order(aghead(f)) >= rpos[0]) {
onright = NOT(false);
continue;
}
}
if (onleft && (onright == false))
bounds[0] = ord + 1;
if (onright && (onleft == false))
bounds[1] = ord - 1;
}
}
} finally {
LEAVING("bwjjmaydx5a2fnpeoligkha0r","setbounds");
}
}
@ -819,35 +843,37 @@ throw new UnsupportedOperationException();
//3 3bc4otcsxj1dujj49ydbb19oa
// static int flat_limits(graph_t * g, edge_t * e)
public static Object flat_limits(Object... arg) {
UNSUPPORTED("66a89nfyth1x37pd0k1jazsux"); // static int flat_limits(graph_t * g, edge_t * e)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("53tr3vwgqtyyblccnlzyf011y"); // int lnode, rnode, r, bounds[4], lpos, rpos, pos;
UNSUPPORTED("6q6egelp2q8lyq1cmef6qxo0k"); // node_t **rank;
UNSUPPORTED("9a26ouzlqhoigdeuk7yhrabi"); // r = ND_rank(agtail(e)) - 1;
UNSUPPORTED("4gxqkprq99assc62ze8q8xd2h"); // rank = GD_rank(g)[r].v;
UNSUPPORTED("9gigo865vqoreozo35b83joab"); // lnode = 0;
UNSUPPORTED("dtzzlc138kaz1nln0d8e5yvq5"); // rnode = GD_rank(g)[r].n - 1;
UNSUPPORTED("81lya4jfbr35c9sm0wgyaukvb"); // bounds[0] = bounds[2] = lnode - 1;
UNSUPPORTED("1svpqg6r9odrita8rebc0hpuv"); // bounds[1] = bounds[3] = rnode + 1;
UNSUPPORTED("62if5g6i8b97mw27pyeswbdrz"); // findlr(agtail(e), aghead(e), &lpos, &rpos);
UNSUPPORTED("2nl8wgr8777ej3q2mxtgh1dcm"); // while (lnode <= rnode) {
UNSUPPORTED("1rdhgaynvpu54ynu73e6wsye"); // setbounds(rank[lnode], bounds, lpos, rpos);
UNSUPPORTED("gpt0y61czu1whc5svspdecor"); // if (lnode != rnode)
UNSUPPORTED("j7s178ehkq0r3k5qu7xui5ya"); // setbounds(rank[rnode], bounds, lpos, rpos);
UNSUPPORTED("9bdpmfv605lazcrg4sngt84sp"); // lnode++;
UNSUPPORTED("9hw99ncl5q35tiabdnhmxagxn"); // rnode--;
UNSUPPORTED("aeu1tyfcxhxvlb3iqnn8vrzyn"); // if (bounds[1] - bounds[0] <= 1)
UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("d81zqerpraa7vwwgfyzs8q0gy"); // if (bounds[0] <= bounds[1])
UNSUPPORTED("ei1uwic1hm0hwxnd0ll5fhwtv"); // pos = (bounds[0] + bounds[1] + 1) / 2;
UNSUPPORTED("div10atae09n36x269sl208r1"); // else
UNSUPPORTED("a7fy9h7b2xsivnzfdzcwggo2p"); // pos = (bounds[2] + bounds[3] + 1) / 2;
UNSUPPORTED("2kr5zds5y6oiaubm8wiunqccr"); // return pos;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static int flat_limits(Agraph_s g, Agedge_s e) {
ENTERING("3bc4otcsxj1dujj49ydbb19oa","flat_limits");
try {
int lnode, rnode, r, pos;
int[] lpos = new int[1], rpos = new int[1];
int bounds[] = new int[4];
__ptr__ rank;
r = ND_rank(agtail(e)) - 1;
rank = GD_rank(g).plus(r).getPtr("v");
lnode = 0;
rnode = GD_rank(g).plus(r).getInt("n") - 1;
bounds[0] = bounds[2] = lnode - 1;
bounds[1] = bounds[3] = rnode + 1;
findlr(agtail(e), aghead(e), lpos, rpos);
while (lnode <= rnode) {
setbounds((Agnode_s)rank.plus(lnode).getPtr(), bounds, lpos, rpos);
if (lnode != rnode)
setbounds((Agnode_s)rank.plus(rnode).getPtr(), bounds, lpos, rpos);
lnode++;
rnode--;
if (bounds[1] - bounds[0] <= 1)
break;
}
if (bounds[0] <= bounds[1])
pos = (bounds[0] + bounds[1] + 1) / 2;
else
pos = (bounds[2] + bounds[3] + 1) / 2;
return pos;
} finally {
LEAVING("3bc4otcsxj1dujj49ydbb19oa","flat_limits");
}
}
@ -855,56 +881,56 @@ throw new UnsupportedOperationException();
//3 4cw9yo9ap8ze1r873v6jat4yc
// static void flat_node(edge_t * e)
public static Object flat_node(Object... arg) {
UNSUPPORTED("59dl3yc4jbcy2pb7j1njhlybi"); // static void
UNSUPPORTED("49p8slcuawyhvoi4g2a74s4ho"); // flat_node(edge_t * e)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("8qht7xq85blwlgkrcz5qeyndi"); // int r, place, ypos, h2;
UNSUPPORTED("djl3ek9tn11htu3vj4zglczzz"); // graph_t *g;
UNSUPPORTED("4q3je7zvvatv7v4lmw10j50te"); // node_t *n, *vn;
UNSUPPORTED("5wf092biicw6tx6dwyi4yipi0"); // edge_t *ve;
UNSUPPORTED("bgjjpl6jaaa122twwwd0vif6x"); // pointf dimen;
UNSUPPORTED("92p9dkk43p8eerc9e4hnz3oy1"); // if (ED_label(e) == NULL)
UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return;
UNSUPPORTED("e2npof9ijzmrweahohhn7ps53"); // g = dot_root(agtail(e));
UNSUPPORTED("6gwhfstthx3ytwdf54bl9tpj2"); // r = ND_rank(agtail(e));
UNSUPPORTED("bevzt1r0xvtfqac7dsrqatbjb"); // place = flat_limits(g, e);
UNSUPPORTED("9f9l4bvgmkm055cwc3bmaccje"); // /* grab ypos = LL.y of label box before make_vn_slot() */
UNSUPPORTED("b8jt668wd0my9zwca820tgrv7"); // if ((n = GD_rank(g)[r - 1].v[0]))
UNSUPPORTED("kftn4cdef7vxdc0gjlfu9vsz"); // ypos = ND_coord(n).y - GD_rank(g)[r - 1].ht1;
UNSUPPORTED("1nyzbeonram6636b1w955bypn"); // else {
UNSUPPORTED("6hnggl4qcfpbzppsqmc2lfenv"); // n = GD_rank(g)[r].v[0];
UNSUPPORTED("8gjvue6cjnbib3urxldv4u7ze"); // ypos = ND_coord(n).y + GD_rank(g)[r].ht2 + GD_ranksep(g);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("2uz3d1ierno37z4cjhti84b90"); // vn = make_vn_slot(g, r - 1, place);
UNSUPPORTED("aqtjv7x919xwb5qa2wgdrtd84"); // dimen = ED_label(e)->dimen;
UNSUPPORTED("b2x6j7m1cmmkcmdl5jo9wn0ap"); // if (GD_flip(g)) {
UNSUPPORTED("bb5bobot4on1o96n5vhntudv4"); // double f = dimen.x;
UNSUPPORTED("53h4udsxhgfufqzscgozfggnr"); // dimen.x = dimen.y;
UNSUPPORTED("czlnr9kn3tq349xzvrxiot7gp"); // dimen.y = f;
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("50w4ek594me8kon99e6erqgrj"); // ND_ht(vn) = dimen.y;
UNSUPPORTED("s101g5jij322x1f503gciz76"); // h2 = ND_ht(vn) / 2;
UNSUPPORTED("auyd4muoijj5auwjni74ovt6i"); // ND_lw(vn) = ND_rw(vn) = dimen.x / 2;
UNSUPPORTED("3gi02gfemg51637nu9my6zrpq"); // ND_label(vn) = ED_label(e);
UNSUPPORTED("39kxxbtw2e2k2pptslp2nn7yu"); // ND_coord(vn).y = ypos + h2;
UNSUPPORTED("5na79r81ha358zo42t63fbwi8"); // ve = virtual_edge(vn, agtail(e), e); /* was NULL? */
UNSUPPORTED("8d6roexcfrqd86jdah39se2bh"); // ED_tail_port(ve).p.x = -ND_lw(vn);
UNSUPPORTED("a3qbjas1ycrf1jnc2dgpgkntm"); // ED_head_port(ve).p.x = ND_rw(agtail(e));
UNSUPPORTED("2lqjbl8hyt57q35tmf4s57ian"); // ED_edge_type(ve) = 4;
UNSUPPORTED("2dslllojmalf8ybsfjksfoez7"); // ve = virtual_edge(vn, aghead(e), e);
UNSUPPORTED("81ug9g73sutw6zm92jw3mjtbp"); // ED_tail_port(ve).p.x = ND_rw(vn);
UNSUPPORTED("22by8eq72a8ksqmgbpqdt08o"); // ED_head_port(ve).p.x = ND_lw(aghead(e));
UNSUPPORTED("2lqjbl8hyt57q35tmf4s57ian"); // ED_edge_type(ve) = 4;
UNSUPPORTED("cm5zrllnnvehfc2j1zsylk92i"); // /* another assumed symmetry of ht1/ht2 of a label node */
UNSUPPORTED("7xf3qxblcaoay1tsec9gitv2d"); // if (GD_rank(g)[r - 1].ht1 < h2)
UNSUPPORTED("6ou8m1qzeww97m2i3ohisiqbm"); // GD_rank(g)[r - 1].ht1 = h2;
UNSUPPORTED("ej9mvs4jjlev601ns30mewwm7"); // if (GD_rank(g)[r - 1].ht2 < h2)
UNSUPPORTED("f5aexaptotw72se1bvn2rn0e8"); // GD_rank(g)[r - 1].ht2 = h2;
UNSUPPORTED("3y0eydvctg6zt8ij8567rri9d"); // ND_alg(vn) = e;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void flat_node(Agedge_s e) {
ENTERING("4cw9yo9ap8ze1r873v6jat4yc","flat_node");
try {
int r, place, ypos, h2;
Agraph_s g;
Agnode_s n, vn;
Agedge_s ve;
final __struct__<pointf> dimen = __struct__.from(pointf.class);
if (ED_label(e) == null)
return;
g = dot_root(agtail(e));
r = ND_rank(agtail(e));
place = flat_limits(g, e);
/* grab ypos = LL.y of label box before make_vn_slot() */
if ((n = (Agnode_s) GD_rank(g).plus(r - 1).getArrayOfPtr("v").plus(0).getPtr())!=null)
ypos = (int)(ND_coord(n).getDouble("y") - GD_rank(g).plus(r - 1).getDouble("ht1"));
else {
n = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(0).getPtr();
ypos = (int)(ND_coord(n).getDouble("y") + GD_rank(g).plus(r).getDouble("ht2") + GD_ranksep(g));
}
vn = make_vn_slot(g, r - 1, place);
dimen.____(ED_label(e).getStruct("dimen"));
if (GD_flip(g)!=0) {
double f = dimen.getDouble("x");
dimen.setDouble("x", dimen.getDouble("y"));
dimen.setDouble("y", f);
}
ND_ht(vn, dimen.getDouble("y"));
h2 = (int)(ND_ht(vn) / 2);
ND_rw(vn, dimen.getDouble("x") / 2);
ND_lw(vn, ND_rw(vn));
ND_label(vn, ED_label(e));
ND_coord(vn).setDouble("y", ypos + h2);
ve = virtual_edge(vn, agtail(e), e); /* was NULL? */
ED_tail_port(ve).getStruct("p").setDouble("x", -ND_lw(vn));
ED_head_port(ve).getStruct("p").setDouble("x", ND_rw(agtail(e)));
ED_edge_type(ve, 4);
ve = virtual_edge(vn, aghead(e), e);
ED_tail_port(ve).getStruct("p").setDouble("x", ND_rw(vn));
ED_head_port(ve).getStruct("p").setDouble("x", ND_lw(aghead(e)));
ED_edge_type(ve, 4);
/* another assumed symmetry of ht1/ht2 of a label node */
if (GD_rank(g).plus(r - 1).getDouble("ht1") < h2)
GD_rank(g).plus(r - 1).setDouble("ht1", h2);
if (GD_rank(g).plus(r - 1).getDouble("ht2") < h2)
GD_rank(g).plus(r - 1).setDouble("ht2", h2);
ND_alg(vn, e);
} finally {
LEAVING("4cw9yo9ap8ze1r873v6jat4yc","flat_node");
}
}
@ -912,27 +938,31 @@ throw new UnsupportedOperationException();
//3 1lopavodoru6ee52snd5l6swd
// static void abomination(graph_t * g)
public static Object abomination(Object... arg) {
UNSUPPORTED("3p0ff5y32m4c29nxc3wzf3vmp"); // static void abomination(graph_t * g)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("p6jnh7nvcpnl3zbz636pskbs"); // int r;
UNSUPPORTED("7b7au08xae4b7xjfppefklfes"); // rank_t *rptr;
UNSUPPORTED("3jycy0d207jrxwu5brhja45ih"); // assert(GD_minrank(g) == 0);
UNSUPPORTED("560kbxcnrl4xmypr8ct811ecl"); // /* 3 = one for new rank, one for sentinel, one for off-by-one */
UNSUPPORTED("dcrwjeosho321989vheyd3f24"); // r = GD_maxrank(g) + 3;
UNSUPPORTED("946x5990us5a5enmn7rfa7c6m"); // rptr = ALLOC(r, GD_rank(g), rank_t);
UNSUPPORTED("8v6x3666mzgcsspv0qcq699j0"); // GD_rank(g) = rptr + 1;
UNSUPPORTED("7lsxe517wqqg8hav1ydoenpr2"); // for (r = GD_maxrank(g); r >= 0; r--)
UNSUPPORTED("8l1are42fil0nxqk865ope67x"); // GD_rank(g)[r] = GD_rank(g)[r - 1];
UNSUPPORTED("dc83xf8i9yoizasey2ikpjrhl"); // GD_rank(g)[r].n = GD_rank(g)[r].an = 0;
UNSUPPORTED("bg0m21jdi57yb6ckltvnrp1qo"); // GD_rank(g)[r].v = GD_rank(g)[r].av = (node_t **)zmalloc((2)*sizeof(node_t *));
UNSUPPORTED("6vkt3w1t9jqw3cyznn3tye1fk"); // GD_rank(g)[r].flat = NULL;
UNSUPPORTED("4ekrtr9xsu5a9k77f4lxotpy8"); // GD_rank(g)[r].ht1 = GD_rank(g)[r].ht2 = 1;
UNSUPPORTED("8ufuk0l3ohor1iik35q18n600"); // GD_rank(g)[r].pht1 = GD_rank(g)[r].pht2 = 1;
UNSUPPORTED("g577nwvng3nqlr1ejqd8tiqz"); // GD_minrank(g)--;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void abomination(Agraph_s g) {
ENTERING("1lopavodoru6ee52snd5l6swd","abomination");
try {
int r;
__ptr__ rptr;
assert(GD_minrank(g) == 0);
/* 3 = one for new rank, one for sentinel, one for off-by-one */
r = GD_maxrank(g) + 3;
rptr = ALLOC(r, GD_rank(g), rank_t.class);
GD_rank(g, rptr.plus(1));
for (r = GD_maxrank(g); r >= 0; r--)
GD_rank(g).plus(r).getPtr().setStruct(GD_rank(g).plus(r - 1).getPtr().getStruct());
GD_rank(g).plus(r).setInt("n", 0);
GD_rank(g).plus(r).setInt("an", 0);
GD_rank(g).plus(r).setPtr("v", zmalloc(sizeof_starstar_empty(Agnode_s.class, 2)));
GD_rank(g).plus(r).setPtr("av", GD_rank(g).plus(r).getPtr("v"));
GD_rank(g).plus(r).setPtr("flat", null);
GD_rank(g).plus(r).setDouble("ht1", 1);
GD_rank(g).plus(r).setDouble("ht2", 1);
GD_rank(g).plus(r).setDouble("pht1", 1);
GD_rank(g).plus(r).setDouble("pht2", 1);
GD_minrank(g, GD_minrank(g)-1);
} finally {
LEAVING("1lopavodoru6ee52snd5l6swd","abomination");
}
}

View File

@ -61,6 +61,9 @@ import static gen.lib.dotgen.cluster__c.mark_lowclusters;
import static gen.lib.dotgen.decomp__c.decompose;
import static gen.lib.dotgen.dotinit__c.dot_root;
import static gen.lib.dotgen.fastgr__c.delete_flat_edge;
import static gen.lib.dotgen.fastgr__c.flat_edge;
import static gen.lib.dotgen.fastgr__c.merge_oneway;
import static gen.lib.dotgen.fastgr__c.new_virtual_edge;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.atof;
@ -75,8 +78,10 @@ import static smetana.core.Macro.ALLOC;
import static smetana.core.Macro.ALLOC_INT;
import static smetana.core.Macro.ED_edge_type;
import static smetana.core.Macro.ED_head_port;
import static smetana.core.Macro.ED_label;
import static smetana.core.Macro.ED_tail_port;
import static smetana.core.Macro.ED_to_orig;
import static smetana.core.Macro.ED_to_virt;
import static smetana.core.Macro.ED_weight;
import static smetana.core.Macro.ED_xpenalty;
import static smetana.core.Macro.GD_clust;
@ -107,6 +112,7 @@ import static smetana.core.Macro.ND_next;
import static smetana.core.Macro.ND_node_type;
import static smetana.core.Macro.ND_onstack;
import static smetana.core.Macro.ND_order;
import static smetana.core.Macro.ND_other;
import static smetana.core.Macro.ND_out;
import static smetana.core.Macro.ND_prev;
import static smetana.core.Macro.ND_rank;
@ -115,6 +121,7 @@ import static smetana.core.Macro.ND_weight_class;
import static smetana.core.Macro.NOT;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.Macro.agtail;
import static smetana.core.Macro.elist_append;
import h.Agedge_s;
import h.Agnode_s;
import h.Agraph_s;
@ -1111,14 +1118,14 @@ try {
if (Z._().ReMincross == false) {
if (NEQ(ND_clust(v), ND_clust(w)) && (ND_clust(v)!=null) && (ND_clust(w)!=null)) {
/* the following allows cluster skeletons to be swapped */
UNSUPPORTED("91bhygw897qpxvqf8l18732s1"); // if ((ND_ranktype(v) == 7)
UNSUPPORTED("a283wt6pnchihxx1zk7i9oc0f"); // && (ND_node_type(v) == 1))
UNSUPPORTED("5izxoao5ryte71964f8yjfd5y"); // return 0;
UNSUPPORTED("6hjnzko0r1bxentznakcjjl7w"); // if ((ND_ranktype(w) == 7)
UNSUPPORTED("5zaowq2gpa6nw67z1nexnl1b9"); // && (ND_node_type(w) == 1))
UNSUPPORTED("5izxoao5ryte71964f8yjfd5y"); // return 0;
UNSUPPORTED("9qhn9m3123s8n6wwxjfo8awlm"); // return NOT(0);
UNSUPPORTED("f1wmsam8cmwci21kvsofgc0ex"); // /*return ((ND_ranktype(v) != CLUSTER) && (ND_ranktype(w) != CLUSTER)); */
if ((ND_ranktype(v) == 7)
&& (ND_node_type(v) == 1))
return false;
if ((ND_ranktype(w) == 7)
&& (ND_node_type(w) == 1))
return false;
return NOT(false);
/*return ((ND_ranktype(v) != CLUSTER) && (ND_ranktype(w) != CLUSTER)); */
}
} else {
UNSUPPORTED("8lltx4lxwrqossx8qw1khzwf9"); // if ((ND_clust(v)) != (ND_clust(w)))
@ -1128,12 +1135,12 @@ UNSUPPORTED("9qhn9m3123s8n6wwxjfo8awlm"); // return NOT(0);
if (M == null)
rv = false;
else {
UNSUPPORTED("21zvq2qx1j34j1i1879zyhzpj"); // if (GD_flip(g)) {
UNSUPPORTED("7hejrtprimtp2cmdj1zhhjiw4"); // node_t *t = v;
UNSUPPORTED("at1y9wq7tpqtpgge0vh0j1b4g"); // v = w;
UNSUPPORTED("e24z7zdnyun249iha0nfhw4s"); // w = t;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
UNSUPPORTED("at8hgk5lstgpydu7gbt31yxvk"); // rv = (M->data[((ND_low(v))*M->ncols)+(ND_low(w))]);
if (GD_flip(g)!=0) {
Agnode_s t = v;
v = w;
w = t;
}
rv = (M.getArrayOfInteger("data").plus(((ND_low(v))*M.getInt("ncols"))+(ND_low(w))).getInt())!=0;
}
return rv;
} finally {
@ -1903,37 +1910,37 @@ LEAVING("7fy4chyk12o7bgp1rv3h27yl3","init_mincross");
//3 6fprrp93vmz0jn3l4ro0iropp
// void flat_rev(Agraph_t * g, Agedge_t * e)
public static Object flat_rev(Object... arg) {
UNSUPPORTED("60meymegvcl5kyusa9nowiyey"); // void flat_rev(Agraph_t * g, Agedge_t * e)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("2bs0wcp6367dz1o5x166ec7l8"); // int j;
UNSUPPORTED("2d7hxar9c7ew4kb78h8e080dg"); // Agedge_t *rev;
UNSUPPORTED("17klu3t0xbhd7x7s7rg71ains"); // if (!ND_flat_out(aghead(e)).list)
UNSUPPORTED("cppohlb5j66cx1gu5b993qugy"); // rev = NULL;
UNSUPPORTED("div10atae09n36x269sl208r1"); // else
UNSUPPORTED("7jd6rutmiqbt8ivw52dxbdw3x"); // for (j = 0; (rev = ND_flat_out(aghead(e)).list[j]); j++)
UNSUPPORTED("7bf7vjqpade7io8u0hbqeqs8m"); // if (aghead(rev) == agtail(e))
UNSUPPORTED("9ekmvj13iaml5ndszqyxa8eq"); // break;
UNSUPPORTED("8m5izg2w8ldt7aqh5be7ctq0d"); // if (rev) {
UNSUPPORTED("47of6vwi8sp1rp81106pjrha0"); // merge_oneway(e, rev);
UNSUPPORTED("4qby4hntb1heomfmqtkreewwk"); // if (ED_to_virt(e) == 0)
UNSUPPORTED("1qkkzbb9lkiz6be8afd7kgsma"); // ED_to_virt(e) = rev;
UNSUPPORTED("69siqm3b5l9eifk19g4lm3ptr"); // if ((ED_edge_type(rev) == 4)
UNSUPPORTED("5l5v5l7h3ge53wqz49vbojipy"); // && (ED_to_orig(rev) == 0))
UNSUPPORTED("9k8si77u043a3671bef8no4ko"); // ED_to_orig(rev) = e;
UNSUPPORTED("do5r4saurlfjjbjxaqvyvfdsz"); // elist_append(e, ND_other(agtail(e)));
UNSUPPORTED("c07up7zvrnu2vhzy6d7zcu94g"); // } else {
UNSUPPORTED("epgpomoed7i398231ndqkpv3w"); // rev = new_virtual_edge(aghead(e), agtail(e), e);
UNSUPPORTED("9mjzpo9lfftkal4fgr6kbobso"); // if (ED_edge_type(e) == 4)
UNSUPPORTED("dgu6abw4apcihw1ncbxycmmyo"); // ED_edge_type(rev) = 4;
UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else
UNSUPPORTED("6zjolflkvuyob7hg17citc4xa"); // ED_edge_type(rev) = 3;
UNSUPPORTED("9h3aexk46uq9l3je9dw0aa7zt"); // ED_label(rev) = ED_label(e);
UNSUPPORTED("3escrp0dky3o15ajakxnglpcy"); // flat_edge(g, rev);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static void flat_rev(Agraph_s g, Agedge_s e) {
ENTERING("6fprrp93vmz0jn3l4ro0iropp","flat_rev");
try {
int j;
Agedge_s rev;
if (N(ND_flat_out(aghead(e)).getArrayOfPtr("list")))
rev = null;
else
for (j = 0; (rev = (Agedge_s) ND_flat_out(aghead(e)).getArrayOfPtr("list").plus(j).getPtr())!=null; j++)
if (EQ(aghead(rev), agtail(e)))
break;
if (rev!=null) {
merge_oneway(e, rev);
if (ED_to_virt(e) == null)
ED_to_virt(e, rev);
if ((ED_edge_type(rev) == 4)
&& (ED_to_orig(rev) == null))
ED_to_orig(rev, e);
elist_append(e, ND_other(agtail(e)));
} else {
rev = new_virtual_edge(aghead(e), agtail(e), e);
if (ED_edge_type(e) == 4)
ED_edge_type(rev, 4);
else
ED_edge_type(rev, 3);
ED_label(rev, ED_label(e));
flat_edge(g, rev);
}
} finally {
LEAVING("6fprrp93vmz0jn3l4ro0iropp","flat_rev");
}
}
@ -1959,14 +1966,14 @@ try {
if (ED_weight(e) == 0)
continue;
if (ND_onstack(aghead(e)) == NOT(false)) {
UNSUPPORTED("cgkgsq3cgt6yvpwsn9st1phym"); // assert(ND_low(aghead(e)) < M->nrows);
UNSUPPORTED("38hoycfuki3wuy5cj039e3b00"); // assert(ND_low(agtail(e)) < M->ncols);
UNSUPPORTED("ehj17yz9fge33i8h1scw4m7q6"); // (M->data[((ND_low(aghead(e)))*M->ncols)+(ND_low(agtail(e)))]) = 1;
UNSUPPORTED("1iwplhbmvtv3d8gseqen1bn52"); // delete_flat_edge(e);
UNSUPPORTED("b5737gtfqocrc9dqgtvfuz5e7"); // i--;
UNSUPPORTED("8x0ryen4203ncnio11ie1rl6o"); // if (ED_edge_type(e) == 4)
UNSUPPORTED("2yi9az7ibt7j9bwztjilyo0v2"); // continue;
UNSUPPORTED("8nnedzb0mcoepaac60ovylf44"); // flat_rev(g, e);
assert(ND_low(aghead(e)) < M.getInt("nrows"));
assert(ND_low(agtail(e)) < M.getInt("ncols"));
M.getArrayOfInteger("data").plus(ND_low(aghead(e))*M.getInt("ncols")+ND_low(agtail(e))).setInt(1);
delete_flat_edge(e);
i--;
if (ED_edge_type(e) == 4)
continue;
flat_rev(g, e);
} else {
assert(ND_low(aghead(e)) < M.getInt("nrows"));
assert(ND_low(agtail(e)) < M.getInt("ncols"));
@ -2300,10 +2307,10 @@ try {
for (j = 0; (e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) {
if ( ((GD_flip(g) == 0) && (ND_order(aghead(e)) < ND_order(agtail(e)))) ||
( (GD_flip(g)!=0) && (ND_order(aghead(e)) > ND_order(agtail(e)) ))) {
UNSUPPORTED("3omkik04m6s1wn9lkk45pivko"); // assert(constraining_flat_edge(g,v,e) == 0);
UNSUPPORTED("7ebw4lyjfgu8v0is6gfktqm7x"); // delete_flat_edge(e);
UNSUPPORTED("39xps1d6e8rc55xmsxaunuia8"); // j--;
UNSUPPORTED("1w583swkkvuwckydgv3bcn71d"); // flat_rev(g, e);
assert(constraining_flat_edge(g,v,e) == false);
delete_flat_edge(e);
j--;
flat_rev(g, e);
}
}
}

View File

@ -912,21 +912,21 @@ LEAVING("90vn63m6v0w9fn9a2dgfxxx3h","nsiter2");
//3 5bax8ut6nnk4pr7yxdumk9chl
// static int go(node_t * u, node_t * v)
public static Object go(Object... arg) {
UNSUPPORTED("du9fkh4e3ytotaov5j9lvdf8m"); // static int go(node_t * u, node_t * v)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("b17di9c7wgtqm51bvsyxz6e2f"); // int i;
UNSUPPORTED("5gypxs09iuryx5a2eho9lgdcp"); // edge_t *e;
UNSUPPORTED("eveu2z2y0w7zqrw75i6lrylfh"); // if (u == v)
UNSUPPORTED("bp2y18pqq5n09006utwifdyxo"); // return NOT(0);
UNSUPPORTED("cwft57krh42f5w81qkosv232u"); // for (i = 0; (e = ND_out(u).list[i]); i++) {
UNSUPPORTED("2lunxrm3s4yalew19asx9twp3"); // if (go(aghead(e), v))
UNSUPPORTED("9qhn9m3123s8n6wwxjfo8awlm"); // return NOT(0);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
UNSUPPORTED("5oxhd3fvp0gfmrmz12vndnjt"); // return 0;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
public static boolean go(Agnode_s u, Agnode_s v) {
ENTERING("5bax8ut6nnk4pr7yxdumk9chl","go");
try {
int i;
Agedge_s e;
if (EQ(u, v))
return NOT(false);
for (i = 0; (e = (Agedge_s) ND_out(u).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) {
if (go(aghead(e), v))
return NOT(false);
}
return false;
} finally {
LEAVING("5bax8ut6nnk4pr7yxdumk9chl","go");
}
}
@ -934,15 +934,10 @@ throw new UnsupportedOperationException();
//3 9xz8numztzj4qsq85pziahv1k
// static int canreach(node_t * u, node_t * v)
public static int canreach(Agnode_s u, Agnode_s v) {
public static boolean canreach(Agnode_s u, Agnode_s v) {
ENTERING("9xz8numztzj4qsq85pziahv1k","canreach");
try {
UNSUPPORTED("3s0ewlrlu43uwu0l0qufqx5cv"); // static int canreach(node_t * u, node_t * v)
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
UNSUPPORTED("7y60k9o06xiya28w59cc3pe0"); // return go(u, v);
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
throw new UnsupportedOperationException();
return go(u, v);
} finally {
LEAVING("9xz8numztzj4qsq85pziahv1k","canreach");
}
@ -1071,11 +1066,11 @@ try {
m1 = m0 + ((int)(ND_rw(aghead(e0)) + ND_lw(agtail(e0))));
/* these guards are needed because the flat edges
* work very poorly with cluster layout */
if (canreach(agtail(e0), aghead(e0)) == 0)
if (canreach(agtail(e0), aghead(e0)) == false)
make_aux_edge(aghead(e0), agtail(e0), m1,
ED_weight(e));
m1 = m0 + ((int)(ND_rw(agtail(e1)) + ND_lw(aghead(e1))));
if (canreach(aghead(e1), agtail(e1)) == 0)
if (canreach(aghead(e1), agtail(e1)) == false)
make_aux_edge(agtail(e1), aghead(e1), m1,
ED_weight(e));
}
@ -1220,10 +1215,10 @@ try {
for (i = ND_order(v) - 1; i >= 0; i--) {
u = (Agnode_s) GD_rank(dot_root(g)).plus(r).getArrayOfPtr("v").plus(i).getPtr();
/* can't use "is_a_vnode_of" because elists are swapped */
UNSUPPORTED("1u1psf6u6uvy7d3qjlwojrkgp"); // if ((ND_node_type(u) == 0) || vnode_not_related_to(g, u)) {
UNSUPPORTED("76fuk1ed83l1ghp7j9rmhrfcy"); // make_aux_edge(u, GD_ln(g), margin + ND_rw(u), 0);
UNSUPPORTED("9ekmvj13iaml5ndszqyxa8eq"); // break;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
if ((ND_node_type(u) == 0) || vnode_not_related_to(g, u)) {
make_aux_edge(u, GD_ln(g), margin + ND_rw(u), 0);
break;
}
}
for (i = ND_order(v) + GD_rank(g).plus(r).getInt("n"); i < GD_rank(dot_root(g)).plus(r).getInt("n");
i++) {
@ -1283,24 +1278,24 @@ try {
make_lrvn((Agraph_s) GD_clust(g).plus(i).getPtr());
for (i = 1; i <= GD_n_cluster(g); i++) {
for (j = i + 1; j <= GD_n_cluster(g); j++) {
UNSUPPORTED("b48z8w7dnun90uu22eubqf3ba"); // low = GD_clust(g)[i];
UNSUPPORTED("b4bomfgcbfoeb0x86ajnx3rtj"); // high = GD_clust(g)[j];
UNSUPPORTED("vo4qmqyvzlhhbt0j7ug6t0ko"); // if (GD_minrank(low) > GD_minrank(high)) {
UNSUPPORTED("8lj913vkr5f3g8lhn0j3jns04"); // graph_t *temp = low;
UNSUPPORTED("30p2o6g0q9ig9oxjny2uotj7x"); // low = high;
UNSUPPORTED("a15s004bpmrww58h27n7hccfc"); // high = temp;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("276toniyxhad8vepjexcictjb"); // if (GD_maxrank(low) < GD_minrank(high))
UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue;
UNSUPPORTED("7qjv295ka7fo6i7wdqnfzgxgf"); // if (ND_order(GD_rank(low)[GD_minrank(high)].v[0])
UNSUPPORTED("2ssyjgg7hi2c8lxyahi0vpvag"); // < ND_order(GD_rank(high)[GD_minrank(high)].v[0])) {
UNSUPPORTED("8mbnhsgk6ygbfbtr0ub1ua8hm"); // left = low;
UNSUPPORTED("6a0lq4h8rsmgdgdhmojhwjjoz"); // right = high;
UNSUPPORTED("175pyfe8j8mbhdwvrbx3gmew9"); // } else {
UNSUPPORTED("9bglj5z5yjbj7kdxit59pg9nn"); // left = high;
UNSUPPORTED("cccouqr9pvz3dlpiqjaiqpfeh"); // right = low;
UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // }
UNSUPPORTED("4y4h66g0xeki0v3ihql3aw6ii"); // make_aux_edge(GD_rn(left), GD_ln(right), margin, 0);
low = (Agraph_s) GD_clust(g).plus(i).getPtr();
high = (Agraph_s) GD_clust(g).plus(j).getPtr();
if (GD_minrank(low) > GD_minrank(high)) {
Agraph_s temp = low;
low = high;
high = temp;
}
if (GD_maxrank(low) < GD_minrank(high))
continue;
if (ND_order(GD_rank(low).plus(GD_minrank(high)).getPtr("v").plus(0).getPtr())
< ND_order(GD_rank(high).plus(GD_minrank(high)).getPtr("v").plus(0).getPtr())) {
left = low;
right = high;
} else {
left = high;
right = low;
}
make_aux_edge(GD_rn(left), GD_ln(right), margin, 0);
}
separate_subclust((Agraph_s) GD_clust(g).plus(i).getPtr());
}
@ -2082,8 +2077,8 @@ try {
rn = virtual_node(dot_root(g));
ND_node_type(rn, 2);
if (GD_label(g)!=null && NEQ(g, dot_root(g)) && N(GD_flip(agroot(g)))) {
UNSUPPORTED("470nwt9sh3uwq56a0edpk2hzs"); // int w = MAX(GD_border(g)[0].x, GD_border(g)[2].x);
UNSUPPORTED("b91l57rpte7zb5f3pknr7bnm0"); // make_aux_edge(ln, rn, w, 0);
int w = MAX((int)GD_border(g).plus(0).getDouble("x"), (int)GD_border(g).plus(2).getDouble("x"));
make_aux_edge(ln, rn, w, 0);
}
GD_ln(g, ln);
GD_rn(g, rn);

View File

@ -63,6 +63,7 @@ import static gen.lib.dotgen.class1__c.class1_;
import static gen.lib.dotgen.decomp__c.decompose;
import static gen.lib.dotgen.dotinit__c.dot_root;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.strncmp;
import static smetana.core.JUtilsDebug.ENTERING;
@ -936,7 +937,7 @@ try {
Agnode_s n, nn;
Agedge_s e;
int i;
System.err.println("node_induce");
LOG2("node_induce");
/* enforce that a node is in at most one cluster at this level */
for (n = agfstnode(g); n!=null; n = nn) {
nn = agnxtnode(g, n);

View File

@ -43,6 +43,7 @@ import static gen.lib.cgraph.obj__c.agroot;
import static gen.lib.cgraph.rec__c.agbindrec;
import static gen.lib.common.emit__c.gv_fixLocale;
import static gen.lib.common.input__c.graph_init;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.enumAsInt;
import static smetana.core.JUtils.function;
@ -241,7 +242,7 @@ UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
gvle.call("layout", g);
if (gvle.getPtr("cleanup")!=null)
if (GD_cleanup(g)==null)
System.err.println("WARNING WE CHEAT GD_cleanup(g) is NULL"); else
LOG2("WARNING WE CHEAT GD_cleanup(g) is NULL"); else
GD_cleanup(g).setPtr(gvle.getPtr("cleanup"));
}
gv_fixLocale (0);

View File

@ -40,6 +40,7 @@
*/
package gen.lib.pathplan;
import static smetana.core.JUtils.EQ;
import static smetana.core.JUtils.LOG2;
import static smetana.core.JUtils.NEQ;
import static smetana.core.JUtils.setjmp;
import static smetana.core.JUtils.sizeof;
@ -149,15 +150,15 @@ try {
Z._().pnll++;
}
} else {
UNSUPPORTED("6r16p93hkrjz2x5g64y5fvgp"); // for (pi = 0; pi < polyp->pn; pi++) {
UNSUPPORTED("ag73m5oix1rqdl22sblc6xe7n"); // if (pi > 0 && polyp->ps[pi].x == polyp->ps[pi - 1].x &&
UNSUPPORTED("ve8lcg4wuejy1iamgezldd1l"); // polyp->ps[pi].y == polyp->ps[pi - 1].y)
UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue;
UNSUPPORTED("f1orneg1h1k54qv8qiymscdmu"); // pnls[pnll].pp = &polyp->ps[pi];
UNSUPPORTED("c7iuzik6cedqibya39odsn8rs"); // pnls[pnll].link = &pnls[pnll % polyp->pn];
UNSUPPORTED("263qphtd3ct9iq5g9ttrt3v8"); // pnlps[pnll] = &pnls[pnll];
UNSUPPORTED("91ms6j3km9gat978l2eswlq29"); // pnll++;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
for (pi = 0; pi < polyp.getInt("pn"); pi++) {
if (pi > 0 && polyp.getPtr("ps").plus(pi).getDouble("x") == polyp.getPtr("ps").plus(pi - 1).getDouble("x") &&
polyp.getPtr("ps").plus(pi).getDouble("y") == polyp.getPtr("ps").plus(pi - 1).getDouble("y"))
continue;
Z._().pnls.plus(Z._().pnll).setPtr("pp", polyp.getPtr("ps").plus(pi));
Z._().pnls.plus(Z._().pnll).setPtr("link", Z._().pnls.plus(Z._().pnll % polyp.getInt("pn")));
Z._().pnlps.plus(Z._().pnll).setPtr(Z._().pnls.plus(Z._().pnll));
Z._().pnll++;
}
}
/* generate list of triangles */
triangulate(Z._().pnlps, Z._().pnll);
@ -178,8 +179,8 @@ UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1;
if (pointintri(trii, eps.plus(1).getStruct().amp()))
break;
if (trii == Z._().tril) {
UNSUPPORTED("qofj6tr7dq65r0b7a12fhakq"); // fprintf (stderr, "libpath/%s:%d: %s\n", "graphviz-2.38.0\\lib\\pathplan\\shortest.c", 26, ("destination point not in any triangle"));
UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1;
System.err.println("libpath/%s:%d: %s\n" + "graphviz-2.38.0\\lib\\pathplan\\shortest.c" + 26 + ("destination point not in any triangle"));
return -1;
}
ltrii = trii;
/* mark the strip of triangles from eps[0] to eps[1] */
@ -292,6 +293,7 @@ public static void triangulate(__ptr__ pnlps, int pnln) {
ENTERING("73cr7m3mqvtuotpzrmaw2y8zm","triangulate");
try {
int pnli, pnlip1, pnlip2;
LOG2("triangulate "+pnln);
if (pnln > 3)
{
for (pnli = 0; pnli < pnln; pnli++)
@ -307,7 +309,7 @@ try {
return;
}
}
UNSUPPORTED("b7cubu75mkrcno7zj7e0t4dqk"); // fprintf (stderr, "libpath/%s:%d: %s\n", "graphviz-2.38.0\\lib\\pathplan\\shortest.c", 26, ("triangulation failed"));
throw new IllegalStateException("libpath/%s:%d: %s\n" + "graphviz-2.38.0\\lib\\pathplan\\shortest.c" + 26 + ("triangulation failed"));
}
else
loadtriangle(pnlps.plus(0).getPtr(), pnlps.plus(1).getPtr(), pnlps.plus(2).getPtr());

View File

@ -36,10 +36,8 @@ package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.ConditionStyle;
@ -80,7 +78,7 @@ public interface ISkinParam extends ISkinSimple {
public DotSplines getDotSplines();
public GraphvizLayoutStrategy getStrategy();
public String getDotExecutable();
public boolean shadowing();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19396 $
*
*/
package net.sourceforge.plantuml;
@ -47,6 +47,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.preproc.Defines;
public class Option {
@ -140,8 +141,7 @@ public class Option {
if (i == arg.length) {
continue;
}
OptionFlags.getInstance().setDotExecutable(
StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i]));
GraphvizUtils.setDotExecutable(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i]));
} else if (s.equalsIgnoreCase("-charset")) {
i++;
if (i == arg.length) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19196 $
* Revision $Revision: 19396 $
*
*/
package net.sourceforge.plantuml;
@ -73,7 +73,7 @@ public class OptionFlags {
metadata = false;
word = false;
systemExit = exit;
dotExecutable = null;
GraphvizUtils.setDotExecutable(null);
gui = false;
quiet = false;
checkDotError = false;
@ -95,7 +95,6 @@ public class OptionFlags {
private boolean metadata;
private boolean word;
private boolean systemExit;
private String dotExecutable;
private boolean gui;
private boolean quiet;
private boolean checkDotError;
@ -154,14 +153,6 @@ public class OptionFlags {
this.systemExit = systemExit;
}
public final String getDotExecutable() {
return dotExecutable;
}
public final void setDotExecutable(String dotExecutable) {
this.dotExecutable = dotExecutable;
}
public final boolean isGui() {
return gui;
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19254 $
*
*/
package net.sourceforge.plantuml;
@ -155,11 +155,11 @@ public class OptionPrint {
final int lastversion = PSystemVersion.extractDownloadableVersion(null, null);
if (lastversion == -1) {
System.out.println("Error");
System.out.println("Cannot connect to http://plantuml.sourceforge.net/");
System.out.println("Cannot connect to http://plantuml.com/");
System.out.println("Maybe you should set your proxy ?");
} else if (lastversion == 0) {
System.out.println("Error");
System.out.println("Cannot retrieve last version from http://plantuml.sourceforge.net/");
System.out.println("Cannot retrieve last version from http://plantuml.com/");
} else {
System.out.println("Last available version for download : " + lastversion);
System.out.println();

View File

@ -113,7 +113,6 @@ public class PSystemBuilder {
private List<PSystemFactory> getAllFactories() {
final List<PSystemFactory> factories = new ArrayList<PSystemFactory>();
//factories.add(new PSystemMemorialFactory());
factories.add(new SequenceDiagramFactory());
factories.add(new ClassDiagramFactory());
factories.add(new ActivityDiagramFactory());
@ -152,6 +151,7 @@ public class PSystemBuilder {
factories.add(new PSystemPathFactory());
factories.add(new PSystemOregonFactory());
factories.add(new PSystemCharlieFactory());
factories.add(new PSystemMemorialFactory());
if (License.getCurrent() == License.GPL) {
factories.add(new PSystemXearthFactory());
}

View File

@ -36,17 +36,12 @@ package net.sourceforge.plantuml;
import java.util.LinkedHashMap;
import java.util.Map;
import net.sourceforge.plantuml.StringUtils;
public class Pragma {
private final Map<String, String> values = new LinkedHashMap<String, String>();
public void define(String name, String value) {
values.put(name, value);
if (name.equalsIgnoreCase("graphviz_dot")) {
OptionFlags.getInstance().setDotExecutable(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value));
}
}
public boolean isDefine(String name) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19462 $
*
*/
package net.sourceforge.plantuml;
@ -274,7 +274,16 @@ public class Run {
ps.println(system.getDescription());
}
} else if (option.isPipe()) {
sourceStringReader.generateImage(ps, 0, option.getFileFormatOption());
final String result = sourceStringReader.generateImage(ps, 0, option.getFileFormatOption());
if ("(error)".equalsIgnoreCase(result)) {
System.err.println("ERROR");
final Diagram system = sourceStringReader.getBlocks().get(0).getDiagram();
final PSystemError sys = (PSystemError) system;
System.err.println(sys.getHigherErrorPosition());
for (ErrorUml er : sys.getErrorsUml()) {
System.err.println(er.getError());
}
}
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19248 $
* Revision $Revision: 19398 $
*
*/
package net.sourceforge.plantuml;
@ -49,7 +49,6 @@ import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
@ -69,16 +68,25 @@ import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
public class SkinParam implements ISkinParam {
private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>";
private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString);
private final Map<String, String> params = new HashMap<String, String>();
private Rankdir rankdir = Rankdir.TOP_TO_BOTTOM;
private String dotExecutable;
public String getDotExecutable() {
return dotExecutable;
}
public void setDotExecutable(String dotExecutable) {
this.dotExecutable = dotExecutable;
}
public void setParam(String key, String value) {
params.put(cleanForKey(key), StringUtils.trin(value));
}
private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>";
private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString);
public static SkinParam noShadowing() {
final SkinParam result = new SkinParam();
result.setParam("shadowing", "false");
@ -378,23 +386,6 @@ public class SkinParam implements ISkinParam {
return DotSplines.SPLINES;
}
public GraphvizLayoutStrategy getStrategy() {
final String value = getValue("layout");
if ("neato".equalsIgnoreCase(value)) {
return GraphvizLayoutStrategy.NEATO;
}
if ("circo".equalsIgnoreCase(value)) {
return GraphvizLayoutStrategy.CIRCO;
}
if ("fdp".equalsIgnoreCase(value)) {
return GraphvizLayoutStrategy.FDP;
}
if ("twopi".equalsIgnoreCase(value)) {
return GraphvizLayoutStrategy.TWOPI;
}
return GraphvizLayoutStrategy.DOT;
}
public HorizontalAlignment getHorizontalAlignment(AlignParam param) {
final String value;
switch (param) {

View File

@ -36,7 +36,6 @@ package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
@ -97,8 +96,8 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getDotSplines();
}
public GraphvizLayoutStrategy getStrategy() {
return skinParam.getStrategy();
public String getDotExecutable() {
return skinParam.getDotExecutable();
}
public HorizontalAlignment getHorizontalAlignment(AlignParam param) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19235 $
* Revision $Revision: 19398 $
*
*/
package net.sourceforge.plantuml;
@ -428,4 +428,8 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann
public boolean isUseJDot() {
return useJDot;
}
public void setDotExecutable(String dotExecutable) {
skinParam.setDotExecutable(dotExecutable);
}
}

View File

@ -56,8 +56,9 @@ public class UrlBuilder {
}
private static final String URL_PATTERN_OLD = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{((?:[^{}]|\\{[^{}]*\\})+)\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]";
private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g])?([\\w\\W]*)\\]\\]";
private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{" + "(" + levelN(3)
private static final String URL_PATTERN_BAD = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{" + "(" + levelN(3)
+ ")" + "\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]";
private final String topurl;
@ -100,14 +101,41 @@ public class UrlBuilder {
if (m.matches() == false) {
return null;
}
String url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(1));
if (url.startsWith("http:") == false && url.startsWith("https:") == false) {
// final String top = getSystem().getSkinParam().getValue("topurl");
if (topurl != null) {
url = topurl + url;
// String url = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(m.group(1));
// if (url.startsWith("http:") == false && url.startsWith("https:") == false) {
// // final String top = getSystem().getSkinParam().getValue("topurl");
// if (topurl != null) {
// url = topurl + url;
// }
// }
final String quotedPart = m.group(1);
final String full = m.group(2);
final int openBracket = full.indexOf('{');
final int closeBracket = full.lastIndexOf('}');
if (quotedPart == null) {
if (openBracket != -1 && closeBracket != -1) {
return new Url(withTopUrl(full.substring(0, openBracket)),
full.substring(openBracket + 1, closeBracket), full.substring(closeBracket + 1).trim());
}
final int firstSpace = full.indexOf(' ');
if (firstSpace == -1) {
return new Url(full, null, null);
}
return new Url(withTopUrl(full.substring(0, firstSpace)), null, full.substring(firstSpace + 1).trim());
}
return new Url(url, m.group(2), m.group(3));
if (openBracket != -1 && closeBracket != -1) {
return new Url(withTopUrl(quotedPart), full.substring(openBracket + 1, closeBracket), full.substring(
closeBracket + 1).trim());
}
return new Url(withTopUrl(quotedPart), null, null);
}
private String withTopUrl(String url) {
if (url.startsWith("http:") == false && url.startsWith("https:") == false && topurl != null) {
return topurl + url;
}
return url;
}
public static String getRegexp() {

View File

@ -38,6 +38,7 @@ import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
import net.sourceforge.plantuml.cucadiagram.Display;
@ -50,10 +51,12 @@ public class InstructionWhile implements Instruction, InstructionCollection {
private final Instruction parent;
private final LinkRendering nextLinkRenderer;
private final HtmlColor color;
private boolean killed = false;
private final Display test;
private Display yes;
private Display out = Display.NULL;
private boolean testCalled = false;
private LinkRendering endInlinkRendering;
private LinkRendering afterEndwhile;
private final Swimlane swimlane;
@ -93,6 +96,9 @@ public class InstructionWhile implements Instruction, InstructionCollection {
if (note != null) {
tmp = new FtileWithNoteOpale(tmp, note, position, skinParam, false);
}
if (killed) {
return new FtileKilled(tmp);
}
return tmp;
}
@ -101,6 +107,10 @@ public class InstructionWhile implements Instruction, InstructionCollection {
}
final public boolean kill() {
if (testCalled) {
this.killed = true;
return true;
}
return repeatList.kill();
}
@ -114,6 +124,7 @@ public class InstructionWhile implements Instruction, InstructionCollection {
if (out == null) {
throw new IllegalArgumentException();
}
this.testCalled = true;
}
public void afterEndwhile(LinkRendering linkRenderer) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19396 $
*
*/
package net.sourceforge.plantuml.ant;
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.GeneratedImage;
import net.sourceforge.plantuml.Option;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SourceFileReader;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.preproc.Defines;
import org.apache.tools.ant.BuildException;
@ -317,7 +318,7 @@ public class PlantUmlTask extends Task {
}
public void setGraphvizDot(String s) {
OptionFlags.getInstance().setDotExecutable(s);
GraphvizUtils.setDotExecutable(s);
}
public void setNbThread(String s) {

View File

@ -52,6 +52,8 @@ public class CommandPragma extends SingleLineCommand<UmlDiagram> {
system.getPragma().define(name, value);
if (name.equalsIgnoreCase("graphviz_dot") && value.equalsIgnoreCase("jdot")) {
system.setUseJDot(true);
} else if (name.equalsIgnoreCase("graphviz_dot")) {
system.setDotExecutable(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value));
}
return CommandExecutionResult.ok();
}

View File

@ -60,12 +60,14 @@ public class AtomImg implements Atom {
private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,";
private final BufferedImage image;
private final double scale;
private AtomImg(BufferedImage image) {
private AtomImg(BufferedImage image, double scale) {
this.image = image;
this.scale = scale;
}
public static Atom create(String src, final ImgValign valign, final int vspace) {
public static Atom create(String src, final ImgValign valign, final int vspace, final double scale) {
final UFont font = new UFont("Monospaced", Font.PLAIN, 14);
final FontConfiguration fc = FontConfiguration.blackBlueTrue(font);
@ -73,7 +75,7 @@ public class AtomImg implements Atom {
final String data = src.substring(DATA_IMAGE_PNG_BASE64.length(), src.length());
try {
final byte bytes[] = Base64Coder.decode(data);
return build(src, fc, bytes);
return build(src, fc, bytes, scale);
} catch (Exception e) {
return AtomText.create("ERROR " + e.toString(), fc);
}
@ -85,7 +87,7 @@ public class AtomImg implements Atom {
// Check if valid URL
if (src.startsWith("http:") || src.startsWith("https:")) {
final byte image[] = getFile(src);
return build(src, fc, image);
return build(src, fc, image, scale);
}
return AtomText.create("(File not found: " + f + ")", fc);
}
@ -97,18 +99,19 @@ public class AtomImg implements Atom {
if (read == null) {
return AtomText.create("(Cannot decode: " + f + ")", fc);
}
return new AtomImg(ImageIO.read(f));
return new AtomImg(ImageIO.read(f), scale);
} catch (IOException e) {
return AtomText.create("ERROR " + e.toString(), fc);
}
}
private static Atom build(String source, final FontConfiguration fc, final byte[] data) throws IOException {
private static Atom build(String source, final FontConfiguration fc, final byte[] data, double scale)
throws IOException {
final BufferedImage read = ImageIO.read(new ByteArrayInputStream(data));
if (read == null) {
return AtomText.create("(Cannot decode: " + source + ")", fc);
}
return new AtomImg(read);
return new AtomImg(read, scale);
}
// Added by Alain Corbiere
@ -136,7 +139,7 @@ public class AtomImg implements Atom {
// End
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(image.getWidth(), image.getHeight());
return new Dimension2DDouble(image.getWidth() * scale, image.getHeight() * scale);
}
public double getStartingAltitude(StringBounder stringBounder) {
@ -145,9 +148,8 @@ public class AtomImg implements Atom {
public void drawU(UGraphic ug) {
// final double h = calculateDimension(ug.getStringBounder()).getHeight();
ug.draw(new UImage(image));
ug.draw(new UImage(image, scale));
// tileImage.drawU(ug.apply(new UTranslate(0, -h)));
}
}

View File

@ -66,12 +66,25 @@ public class CommandCreoleImg implements Command {
throw new IllegalStateException();
}
String src = m.group(2);
final double scale = getScale(m.group(3));
if (src.toLowerCase().startsWith("src=")) {
src = src.substring(4);
}
src = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(src, "\"");
stripe.addImage(src);
stripe.addImage(src, scale);
return line.substring(m.group(1).length());
}
public static double getScale(String s) {
if (s == null) {
return 1;
}
final Pattern p = Pattern.compile("scale=([0-9.]+)");
final Matcher m = p.matcher(s);
if (m.find()) {
return Double.parseDouble(m.group(1));
}
return 1;
}
}

View File

@ -65,7 +65,8 @@ public class CommandCreoleSprite implements Command {
throw new IllegalStateException();
}
final String src = m.group(2);
stripe.addSprite(src);
final double scale = CommandCreoleImg.getScale(m.group(3));
stripe.addSprite(src, scale);
return line.substring(m.group(1).length());
}

View File

@ -137,8 +137,8 @@ public class StripeSimple implements Stripe {
}
}
public void addImage(String src) {
atoms.add(AtomImg.create(src, ImgValign.TOP, 0));
public void addImage(String src, double scale) {
atoms.add(AtomImg.create(src, ImgValign.TOP, 0, scale));
}
public void addSpace(int size) {
@ -149,10 +149,10 @@ public class StripeSimple implements Stripe {
atoms.add(AtomText.createUrl(url, fontConfiguration));
}
public void addSprite(String src) {
public void addSprite(String src, double scale) {
final Sprite sprite = skinParam.getSprite(src);
if (sprite != null) {
atoms.add(new AtomSprite(sprite.asTextBlock(fontConfiguration.getColor()), fontConfiguration));
atoms.add(new AtomSprite(sprite.asTextBlock(fontConfiguration.getColor(), scale), fontConfiguration));
}
}

View File

@ -33,7 +33,124 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
import java.util.EnumSet;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public enum EntityPosition {
NORMAL, ENTRY_POINT, EXIT_POINT
NORMAL, ENTRY_POINT, EXIT_POINT, INPUT_PIN, OUTPUT_PIN, EXPANSION_INPUT, EXPANSION_OUTPUT;
public static final double RADIUS = 6;
public void drawSymbol(UGraphic ug, Rankdir rankdir) {
if (this == NORMAL) {
throw new IllegalStateException();
} else if (this == ENTRY_POINT || this == EXIT_POINT) {
final Shadowable circle = new UEllipse(RADIUS * 2, RADIUS * 2);
ug.draw(circle);
if (this == EntityPosition.EXIT_POINT) {
final double xc = 0 + RADIUS + .5;
final double yc = 0 + RADIUS + .5;
final double radius = RADIUS - .5;
drawLine(ug, getPointOnCircle(xc, yc, Math.PI / 4, radius),
getPointOnCircle(xc, yc, Math.PI + Math.PI / 4, radius));
drawLine(ug, getPointOnCircle(xc, yc, -Math.PI / 4, radius),
getPointOnCircle(xc, yc, Math.PI - Math.PI / 4, radius));
}
} else if (this == INPUT_PIN || this == OUTPUT_PIN) {
final Shadowable rectangle = new URectangle(RADIUS * 2, RADIUS * 2);
ug.draw(rectangle);
} else if (this == EXPANSION_INPUT || this == EXPANSION_OUTPUT) {
if (rankdir == Rankdir.TOP_TO_BOTTOM) {
final Shadowable rectangle = new URectangle(RADIUS * 2 * 4, RADIUS * 2);
ug.draw(rectangle);
final ULine vline = new ULine(0, RADIUS * 2);
ug.apply(new UTranslate(RADIUS * 2, 0)).draw(vline);
ug.apply(new UTranslate(RADIUS * 2 * 2, 0)).draw(vline);
ug.apply(new UTranslate(RADIUS * 2 * 3, 0)).draw(vline);
} else {
final Shadowable rectangle = new URectangle(RADIUS * 2, RADIUS * 2 * 4);
ug.apply(new UTranslate(0, 0)).draw(rectangle);
final ULine hline = new ULine(RADIUS * 2, 0);
ug.apply(new UTranslate(0, RADIUS * 2)).draw(hline);
ug.apply(new UTranslate(0, RADIUS * 2 * 2)).draw(hline);
ug.apply(new UTranslate(0, RADIUS * 2 * 3)).draw(hline);
}
}
}
public Dimension2D getDimension(Rankdir rankdir) {
if (this == EXPANSION_INPUT || this == EXPANSION_OUTPUT) {
if (rankdir == Rankdir.TOP_TO_BOTTOM) {
return new Dimension2DDouble(EntityPosition.RADIUS * 2 * 4, EntityPosition.RADIUS * 2);
}
return new Dimension2DDouble(EntityPosition.RADIUS * 2, EntityPosition.RADIUS * 2 * 4);
}
return new Dimension2DDouble(EntityPosition.RADIUS * 2, EntityPosition.RADIUS * 2);
}
private Point2D getPointOnCircle(double xc, double yc, double angle, double radius) {
final double x = xc + radius * Math.cos(angle);
final double y = yc + radius * Math.sin(angle);
return new Point2D.Double(x, y);
}
static private void drawLine(UGraphic ug, Point2D p1, Point2D p2) {
final double dx = p2.getX() - p1.getX();
final double dy = p2.getY() - p1.getY();
ug.apply(new UTranslate(p1.getX(), p1.getY())).draw(new ULine(dx, dy));
}
public ShapeType getShapeType() {
if (this == NORMAL) {
throw new IllegalStateException();
}
if (this == ENTRY_POINT || this == EXIT_POINT) {
return ShapeType.CIRCLE;
}
return ShapeType.RECTANGLE;
}
public static EntityPosition fromStereotype(String label) {
if ("<<entrypoint>>".equalsIgnoreCase(label)) {
return ENTRY_POINT;
}
if ("<<exitpoint>>".equalsIgnoreCase(label)) {
return EXIT_POINT;
}
if ("<<inputpin>>".equalsIgnoreCase(label)) {
return INPUT_PIN;
}
if ("<<outputpin>>".equalsIgnoreCase(label)) {
return OUTPUT_PIN;
}
if ("<<expansioninput>>".equalsIgnoreCase(label)) {
return EXPANSION_INPUT;
}
if ("<<expansionoutput>>".equalsIgnoreCase(label)) {
return EXPANSION_OUTPUT;
}
return EntityPosition.NORMAL;
}
public static EnumSet<EntityPosition> getInputs() {
return EnumSet.of(ENTRY_POINT, INPUT_PIN, EXPANSION_INPUT);
}
public static EnumSet<EntityPosition> getOutputs() {
return EnumSet.of(EXIT_POINT, OUTPUT_PIN, EXPANSION_OUTPUT);
}
}

View File

@ -61,7 +61,7 @@ public class MemberImpl implements Member {
final Matcher mstart = pstart.matcher(tmpDisplay);
if (mstart.matches()) {
if (mstart.groupCount() != 5) {
if (mstart.groupCount() != 4) {
throw new IllegalStateException();
}
final UrlBuilder urlBuilder = new UrlBuilder(null, ModeUrl.AT_START);
@ -74,7 +74,7 @@ public class MemberImpl implements Member {
final Matcher mend = pend.matcher(tmpDisplay);
if (mend.matches()) {
if (mend.groupCount() != 5) {
if (mend.groupCount() != 4) {
throw new IllegalStateException();
}
final UrlBuilder urlBuilder = new UrlBuilder(null, ModeUrl.AT_END);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19398 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@ -38,6 +38,7 @@ import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.StringUtils;
@ -47,31 +48,31 @@ abstract class AbstractGraphviz implements Graphviz {
private final File dotExe;
private final String dotString;
private final String[] type;
private final ISkinParam skinParam;
static boolean isWindows() {
return File.separatorChar == '\\';
}
AbstractGraphviz(String dotString, String... type) {
AbstractGraphviz(ISkinParam skinParam, String dotString, String... type) {
if (type == null) {
throw new IllegalArgumentException();
}
this.skinParam = skinParam;
this.dotExe = searchDotExe();
this.dotString = dotString;
this.type = type;
}
private File searchDotExe() {
if (OptionFlags.getInstance().getDotExecutable() == null) {
if (skinParam == null || skinParam.getDotExecutable() == null) {
final String getenv = GraphvizUtils.getenvGraphvizDot();
if (getenv == null) {
return specificDotExe();
}
return new File(getenv);
}
return new File(OptionFlags.getInstance().getDotExecutable());
return new File(skinParam.getDotExecutable());
}
abstract protected File specificDotExe();

View File

@ -1,60 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3977 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File;
import net.sourceforge.plantuml.OptionFlags;
public enum GraphvizLayoutStrategy {
DOT, NEATO, FDP, TWOPI, CIRCO;
public File getSystemForcedExecutable() {
return getSystemForcedDot();
}
private File getSystemForcedDot() {
if (OptionFlags.getInstance().getDotExecutable() == null) {
final String getenv = GraphvizUtils.getenvGraphvizDot();
if (getenv == null) {
return null;
}
return new File(getenv);
}
return new File(OptionFlags.getInstance().getDotExecutable());
}
}

View File

@ -28,17 +28,19 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19395 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File;
import net.sourceforge.plantuml.ISkinParam;
class GraphvizLinux extends AbstractGraphviz {
GraphvizLinux(String dotString, String... type) {
super(dotString, type);
GraphvizLinux(ISkinParam skinParam, String dotString, String... type) {
super(skinParam, dotString, type);
}
@Override

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19398 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@ -42,6 +42,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
public class GraphvizUtils {
@ -52,13 +53,22 @@ public class GraphvizUtils {
return File.separatorChar == '\\';
}
@Deprecated
public static Graphviz create(String dotString, String... type) {
private static String dotExecutable;
public static final String getDotExecutableForTest() {
return dotExecutable;
}
public static final void setDotExecutable(String value) {
dotExecutable = value;
}
public static Graphviz create(ISkinParam skinParam, String dotString, String... type) {
final AbstractGraphviz result;
if (isWindows()) {
result = new GraphvizWindows(dotString, type);
result = new GraphvizWindows(skinParam, dotString, type);
} else {
result = new GraphvizLinux(dotString, type);
result = new GraphvizLinux(skinParam, dotString, type);
}
// if (OptionFlags.GRAPHVIZCACHE) {
// return new GraphvizCached(result);
@ -66,16 +76,14 @@ public class GraphvizUtils {
return result;
}
// public static Graphviz create2(GraphvizLayoutStrategy strategy, String
// dotString, String... type) {
// return new AbstractGraphviz2(getOS(), strategy, dotString, type);
// }
static public File getDotExe() {
return create(null, "png").getDotExe();
}
public static String getenvGraphvizDot() {
if (StringUtils.isNotEmpty(dotExecutable)) {
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(dotExecutable);
}
final String env = System.getProperty("GRAPHVIZ_DOT");
if (StringUtils.isNotEmpty(env)) {
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(env);
@ -204,7 +212,7 @@ public class GraphvizUtils {
}
static String getTestCreateSimpleFile() throws IOException {
final Graphviz graphviz2 = GraphvizUtils.create("digraph foo { test; }", "svg");
final Graphviz graphviz2 = GraphvizUtils.create(null, "digraph foo { test; }", "svg");
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ProcessState state = graphviz2.createFile3(baos);
if (state.differs(ProcessState.TERMINATED_OK())) {
@ -223,11 +231,4 @@ public class GraphvizUtils {
return null;
}
// public static OS getOS() {
// if (isWindows()) {
// return new OSWindows();
// }
// return new OSLinux();
// }
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19395 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
class GraphvizWindows extends AbstractGraphviz {
@ -86,8 +87,8 @@ class GraphvizWindows extends AbstractGraphviz {
return dots.get(0);
}
GraphvizWindows(String dotString, String... type) {
super(dotString, type);
GraphvizWindows(ISkinParam skinParam, String dotString, String... type) {
super(skinParam, dotString, type);
}
}

View File

@ -1,50 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 6104 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File;
abstract class OS {
static boolean isWindows() {
return File.separatorChar == '\\';
}
abstract String getFileName(GraphvizLayoutStrategy strategy);
abstract File getExecutable(GraphvizLayoutStrategy strategy);
public abstract String getCommand(GraphvizLayoutStrategy strategy);
}

View File

@ -1,68 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 6104 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File;
import net.sourceforge.plantuml.StringUtils;
class OSLinux extends OS {
@Override
File getExecutable(GraphvizLayoutStrategy strategy) {
final File result = strategy.getSystemForcedExecutable();
if (result != null) {
return result;
}
final String fileName = getFileName(strategy);
final File usrLocalBin = new File("/usr/local/bin/" + fileName);
if (usrLocalBin.exists()) {
return usrLocalBin;
}
final File usrBin = new File("/usr/bin/" + fileName);
return usrBin;
}
@Override
String getFileName(GraphvizLayoutStrategy strategy) {
return StringUtils.goLowerCase(strategy.name());
}
@Override
public String getCommand(GraphvizLayoutStrategy strategy) {
return getExecutable(strategy).getAbsolutePath();
}
}

View File

@ -1,96 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 6104 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
class OSWindows extends OS {
@Override
File getExecutable(GraphvizLayoutStrategy strategy) {
File result = strategy.getSystemForcedExecutable();
if (result != null) {
return result;
}
result = searchInDir(new File("c:/Program Files"), strategy);
if (result != null) {
return result;
}
result = searchInDir(new File("c:/Program Files (x86)"), strategy);
return result;
}
private File searchInDir(final File programFile, GraphvizLayoutStrategy strategy) {
if (programFile.exists() == false || programFile.isDirectory() == false) {
return null;
}
final List<File> dots = new ArrayList<File>();
for (File f : programFile.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory() && pathname.getName().startsWith("Graphviz");
}
})) {
final File result = new File(new File(f, "bin"), getFileName(strategy));
if (result.exists() && result.canRead()) {
dots.add(result.getAbsoluteFile());
}
}
return higherVersion(dots);
}
static File higherVersion(List<File> dots) {
if (dots.size() == 0) {
return null;
}
Collections.sort(dots, Collections.reverseOrder());
return dots.get(0);
}
@Override
String getFileName(GraphvizLayoutStrategy strategy) {
return StringUtils.goLowerCase(strategy.name()) + ".exe";
}
@Override
public String getCommand(GraphvizLayoutStrategy strategy) {
return "\"" + getExecutable(strategy).getAbsolutePath() + "\"";
}
}

View File

@ -287,14 +287,7 @@ final class EntityImpl implements ILeaf, IGroup {
if (stereotype == null) {
return EntityPosition.NORMAL;
}
final String label = stereotype.getLabel(false);
if ("<<entrypoint>>".equalsIgnoreCase(label)) {
return EntityPosition.ENTRY_POINT;
}
if ("<<exitpoint>>".equalsIgnoreCase(label)) {
return EntityPosition.EXIT_POINT;
}
return EntityPosition.NORMAL;
return EntityPosition.fromStereotype(stereotype.getLabel(false));
}

View File

@ -66,7 +66,7 @@ public class PSystemDot extends AbstractPSystem {
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
final Graphviz graphviz = GraphvizUtils
.create(data, StringUtils.goLowerCase(fileFormat.getFileFormat().name()));
.create(null, data, StringUtils.goLowerCase(fileFormat.getFileFormat().name()));
if (graphviz.illegalDotExe()) {
final TextBlock result = GraphicStrings.createDefault(Arrays.asList("There is an issue with your Dot/Graphviz installation"), false);
UGraphicUtils.writeImage(os, null, fileFormat, new ColorMapperIdentity(), HtmlColorUtils.WHITE, result);

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfTKa5osp0ClECLF6lIHoXMwevi9nqxwI4tM48isZIXafHJwMszzME5tCgaZ1Cnm0AxuEOc-n_au3i5SYgtWQt62bufYy5dM7DCdOTyWk8UbYwMg8STxT47ZLOzSsCXjpKxjMGA0utFZm_fcDhHmXgJHJP0eQT46yZZQBx0heiKUbZgR1wMePnOTXvsWTg6h5emjwAlcFQGXzNv3ieE5coqLLlkF47PtTMp8ukGAMarR1BMU4vJMPKR-eMsbdCk6YrJ3-XwKRgzoRO7U4xPXm5UZBu8eD3LIPZVAjh2ax-DjWc9Z2vG36STNA_Ms72DK8v7VszGnYTz6PduNHAdNivaCKYVy1DUvJ_oT9gfilKilIAr3382Ut513_0jbck6ZQuQCkeHjUbJ1MP8oNX_Jwqaj5zAh7vsv5NHxHtArvee_mSV0rMDMZdq62aTI1oRVE3dQ3HfKIk-wDGtL-UyHVqQOPjuULmnqtaKT9kuZ4_ZeHxPeKNJFgXt2iYjXwteHLUhbHv_6huQTkFvDtz-6tFrGFI7IRmgxbhVtELmElveWcQkoCDVlhxmVW00";
public static final String DONORS = "UDfTKakMqp0GtFSfjFQ3GtXY2Cz9PkOvm69s7RidLgAeZIG7xBEnusAq0uxaz4hz-bTLgjna_uCSl58Wft8Rs6giuIjbCVW2Muwfyv3FetY0jOib6c1F1_H1erNFt5h8RSDEhPd2IDFp_LqwvdQqiCNaa0rGw3dH1lAucg-mxoE40TOwMuPbA6UKlOTzeAubgrRCdV0hvZlaONDv66K7ApRQgefxJr3s3_Nin49aJZeDkmGrNj9KJkM6Vg5jHCvLgsNh4TqWJAixRNk4vnHz6E75wAiC5Be-2_9xHLluvE-hRG8YeoiKuqK7DwWjjjmWb9FeRotA-gGl8nE_I-8yY4mMW_G9Fi5L_WDFvmKhsopIswIMHKR6NbpG8to9vOPXf-kMZ7f2ROQKWHbJCDu_GYi9xSSIwnyzULNq1uVojIRI_ywdG7MhDWuzHaX74iSc7_XpCfgqg0rVTUgRctE-HVuQeKgyF9rOy3p9T9UuZC-JK4_iqABfFgWt2iYTXqhueclKHay_3PyDkqd-tP_Vnjmy4FrX4g-AkxPtTpcSnPzCq2uP-SGmar2lE7kdqWluVm4JoFai";
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
final GraphicStrings result = getGraphicStrings();

View File

@ -75,7 +75,7 @@ public class PSystemMemorial extends AbstractPSystem {
final String name = portrait.getName();
final String quote = portrait.getQuote();
final String age = "" + portrait.getAge() + " years old";
final UFont font = new UFont("SansSerif", Font.BOLD, 16);
final UFont font = new UFont("SansSerif", Font.BOLD, 14);
final BufferedImage im = portrait.getBufferedImage();
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLACK,
true);

View File

@ -42,7 +42,7 @@ public class PSystemMemorialFactory extends PSystemSingleLineFactory {
@Override
protected AbstractPSystem executeLine(String line) {
final Portrait portrait = Portraits.getOne();
final Portrait portrait = Portraits.getOne(line);
if (portrait != null) {
return new PSystemMemorial(portrait);
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -272,9 +272,7 @@ public class Elastane {
final TextBlock textBlock = Display.create(label).create(
FontConfiguration.blackBlueTrue(UFont.getCurrentFont(g2d)), HorizontalAlignment.LEFT,
new SpriteContainerEmpty());
textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// textBlock.drawTOBEREMOVED(new ColorMapperIdentity(), g2d, center.getXint() - dim.getWidth() / 2,
// center.getYint() - dim.getHeight() / 2);
textBlock.calculateDimension(StringBounderUtils.asStringBounder());
}
g2d.setColor(red);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -71,7 +71,7 @@ class EntityImageActivity extends AbstractEntityImage {
@Override
public void draw(ColorMapper colorMapper, Graphics2D g2d) {
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder());
final int width = (int) dimTotal.getWidth();
final int height = (int) dimTotal.getHeight();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -65,7 +65,7 @@ class EntityImageDefault extends AbstractEntityImage {
@Override
public void draw(ColorMapper colorMapper, Graphics2D g2d) {
final Dimension2D dim = textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d));
final Dimension2D dim = textBlock.calculateDimension(StringBounderUtils.asStringBounder());
final int width = (int) dim.getWidth();
final int height = (int) dim.getHeight();
g2d.setColor(Color.BLACK);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -69,7 +69,7 @@ class EntityImageNote extends AbstractEntityImage {
@Override
public void draw(ColorMapper colorMapper, Graphics2D g2d) {
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder());
final int width = (int) dimTotal.getWidth();
final int height = (int) dimTotal.getHeight();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -76,7 +76,7 @@ class EntityImageUsecase extends AbstractEntityImage {
@Override
public void draw(ColorMapper colorMapper, Graphics2D g2d) {
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder());
// Shape ellipse = new Ellipse2D.Double(0, 0, dimTotal.getWidth(),
// dimTotal.getHeight());

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -46,22 +46,15 @@ import net.sourceforge.plantuml.graphic.StringBounderUtils;
public class Graph2 {
final private static Graphics2D dummyGraphics2D;
private final Elastane elastane;
private int widthCell;
private int heightCell;
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
dummyGraphics2D = builder.getGraphics2D();
}
public Graph2(Board board) {
board.normalize();
for (ANode n : board.getNodes()) {
final Dimension2D dim = images(n).getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D));
final Dimension2D dim = images(n).getDimension(StringBounderUtils.asStringBounder());
widthCell = Math.max(widthCell, (int) dim.getWidth());
heightCell = Math.max(heightCell, (int) dim.getHeight());
}
@ -69,7 +62,7 @@ public class Graph2 {
elastane = new Elastane(galaxy);
for (ANode n : board.getNodes()) {
final Dimension2D dim = images(n).getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D));
final Dimension2D dim = images(n).getDimension(StringBounderUtils.asStringBounder());
elastane.addBox(n, (int) dim.getWidth(), (int) dim.getHeight());
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -67,8 +67,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
public class Graph3 {
final private static Graphics2D dummyGraphics2D;
private final int spaceWidth = 40;
private final int spaceHeight = 40;
private final int minDistBetweenPoint = 20;
@ -84,11 +82,6 @@ public class Graph3 {
private int maxRow;
private int maxCol;
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
dummyGraphics2D = builder.getGraphics2D();
}
class ANodePoint implements Pointable, XMoveable {
final private ANode node;
private int deltaX = 0;
@ -154,8 +147,8 @@ public class Graph3 {
final Point2DInt p = nodePoint.getPosition();
final AbstractEntityImage image = getImage(nodePoint.getNode());
int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D)).getWidth();
int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D)).getHeight();
int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder()).getWidth();
int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder()).getHeight();
if (widthCell % 2 == 1) {
widthCell++;
}
@ -185,7 +178,7 @@ public class Graph3 {
final double x = point.getPosition().getX();
final double y = point.getPosition().getY();
final Dimension2D dim = getImage(point.getNode()).getDimension(
StringBounderUtils.asStringBounder(dummyGraphics2D));
StringBounderUtils.asStringBounder());
final Frame frame = new Frame(x, y, (int) dim.getWidth(), (int) dim.getHeight());
frames.put(point, frame);
world.addFrame(frame);
@ -433,8 +426,8 @@ public class Graph3 {
for (ANodePoint nodePoint : nodePoints.values()) {
final Frame frame = frames.get(nodePoint);
final AbstractEntityImage image = getImage(nodePoint.getNode());
final double width = image.getDimension(StringBounderUtils.asStringBounder(g2d)).getWidth();
final double height = image.getDimension(StringBounderUtils.asStringBounder(g2d)).getHeight();
final double width = image.getDimension(StringBounderUtils.asStringBounder()).getWidth();
final double height = image.getDimension(StringBounderUtils.asStringBounder()).getHeight();
g2d.translate(frame.getX() - width / 2, frame.getY() - height / 2);
image.draw(new ColorMapperIdentity(), g2d);
g2d.translate(-frame.getX() + width / 2, -frame.getY() + height / 2);
@ -461,8 +454,8 @@ public class Graph3 {
final Point2DInt p = nodePoint.getPosition();
// Log.println("p=" + p);
final AbstractEntityImage image = getImage(nodePoint.getNode());
final int width = (int) (image.getDimension(StringBounderUtils.asStringBounder(g2d)).getWidth());
final int height = (int) (image.getDimension(StringBounderUtils.asStringBounder(g2d)).getHeight());
final int width = (int) (image.getDimension(StringBounderUtils.asStringBounder()).getWidth());
final int height = (int) (image.getDimension(StringBounderUtils.asStringBounder()).getHeight());
g2d.translate(p.getXint() - width / 2, p.getYint() - height / 2);
image.draw(new ColorMapperIdentity(), g2d);
g2d.translate(-p.getXint() + width / 2, -p.getYint() + height / 2);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -63,8 +63,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
public class Graph4 {
final private static Graphics2D dummyGraphics2D;
private final int spaceWidth = 40;
private final int spaceHeight = 40;
@ -80,11 +78,6 @@ public class Graph4 {
private int addedWidth = 0;
private int addedHeight = 0;
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
dummyGraphics2D = builder.getGraphics2D();
}
class ANodePoint implements Pointable, XMoveable {
final private ANode node;
private int deltaX = 0;
@ -128,8 +121,8 @@ public class Graph4 {
final Point2DInt p = nodePoint.getPosition();
final AbstractEntityImage image = getImage(nodePoint.getNode());
int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D)).getWidth();
int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D)).getHeight();
int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder()).getWidth();
int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder()).getHeight();
if (widthCell % 2 == 1) {
widthCell++;
}
@ -155,7 +148,7 @@ public class Graph4 {
final double x = point.getPosition().getX();
final double y = point.getPosition().getY();
final Dimension2D dim = getImage(point.getNode()).getDimension(
StringBounderUtils.asStringBounder(dummyGraphics2D));
StringBounderUtils.asStringBounder());
final int width = (int) dim.getWidth();
final int height = (int) dim.getHeight();
final Frame frame = new Frame(x - width / 2, y - height / 2, width, height);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graph;
@ -57,8 +57,6 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
public class Graph5 {
final private static Graphics2D dummyGraphics2D;
private final int spaceWidth = 40;
private final int spaceHeight = 40;
@ -73,11 +71,6 @@ public class Graph5 {
// private final IInflationTransform inflationTransform = new
// IdentityInflationTransform();
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
dummyGraphics2D = builder.getGraphics2D();
}
private AbstractEntityImage getImage(ANode n) {
return new EntityImageFactory().createEntityImage((IEntity) n.getUserData());
}
@ -95,9 +88,9 @@ public class Graph5 {
for (ANode n : board.getNodes()) {
final AbstractEntityImage image = getImage(n);
final Point2D.Double pos = getPosition(n);
final int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D))
final int widthCell = (int) image.getDimension(StringBounderUtils.asStringBounder())
.getWidth() + 20;
final int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder(dummyGraphics2D))
final int heightCell = (int) image.getDimension(StringBounderUtils.asStringBounder())
.getHeight() + 20;
inflationTransform.addInflationX(pos.getX(), widthCell);
inflationTransform.addInflationY(pos.getY(), heightCell);
@ -136,8 +129,8 @@ public class Graph5 {
final AbstractEntityImage image = getImage(n);
Point2D pos = getPosition(n);
pos = inflationTransform.inflatePoint2D(pos);
final double x = pos.getX() - image.getDimension(StringBounderUtils.asStringBounder(g2d)).getWidth() / 2;
final double y = pos.getY() - image.getDimension(StringBounderUtils.asStringBounder(g2d)).getHeight() / 2;
final double x = pos.getX() - image.getDimension(StringBounderUtils.asStringBounder()).getWidth() / 2;
final double y = pos.getY() - image.getDimension(StringBounderUtils.asStringBounder()).getHeight() / 2;
g2d.translate(x, y);
image.draw(new ColorMapperIdentity(), g2d);
g2d.translate(-x, -y);

View File

@ -168,8 +168,13 @@ public class QuoteUtils {
"We shall never surrender", //
"Absolute honesty isn't always the most diplomatic nor the safest form of communication with emotional beings.", //
"Humor: seventy-five percent. [Confirmed] Self destruct sequence in T minus 10, 9... " //
// It's... complicated.
// Do not open until 1985
// I still mess up but I'll just start again
// I won't give up, no I won't give in; Till I reach the end; And then I'll start again
// I wanna try even though I could fail
// Sometimes we come last but we did our best
);
// It's... complicated.
private QuoteUtils() {
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19273 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -71,7 +71,7 @@ class SingleLine extends AbstractTextBlock implements Line {
} else if (cmd instanceof SpriteCommand) {
final Sprite sprite = spriteContainer.getSprite(((SpriteCommand) cmd).getSprite());
if (sprite != null) {
blocs.add(sprite.asTextBlock(fontConfiguration.getColor()));
blocs.add(sprite.asTextBlock(fontConfiguration.getColor(), 1));
}
} else if (cmd instanceof FontChange) {
fontConfiguration = ((FontChange) cmd).apply(fontConfiguration);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19271 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -55,12 +55,14 @@ public class Splitter {
static final String fontSup = "\\<sup\\>";
static final String fontSub = "\\<sub\\>";
static final String imgPattern = "\\<img\\s+(src[%s]*=[%s]*[%q%g]?[^\\s%g>]+[%q%g]?[%s]*|vspace\\s*=\\s*[%q%g]?\\d+[%q%g]?\\s*|valign[%s]*=[%s]*[%q%g]?(top|middle|bottom)[%q%g]?[%s]*)+\\>";
public static final String imgPatternNoSrcColon = "\\<img[\\s:]+([^>]+)/?\\>";
public static final String imgPatternNoSrcColon = "\\<img[\\s:]+([^>{}]+)" + "(\\{scale=(?:[0-9.]+)\\})?" + "\\>";
public static final String fontFamilyPattern = "\\<font[\\s:]+([^>]+)/?\\>";
public static final String svgAttributePattern = "\\<text[\\s:]+([^>]+)/?\\>";
public static final String openiconPattern = "\\<&([-\\w]+)\\>";
public static final String spritePattern = "\\<\\$" + SpriteUtils.SPRITE_NAME + "\\>";
public static final String spritePattern2 = "\\<\\$(" + SpriteUtils.SPRITE_NAME + ")\\>";
public static final String spritePattern = "\\<\\$" + SpriteUtils.SPRITE_NAME + "(?:\\{scale=(?:[0-9.]+)\\})?"
+ "\\>";
public static final String spritePattern2 = "\\<\\$(" + SpriteUtils.SPRITE_NAME + ")"
+ "(\\{scale=(?:[0-9.]+)\\})?" + "\\>";
static final String htmlTag;
static final String linkPattern = "\\[\\[([^\\[\\]]+)\\]\\]";

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19265 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -37,18 +37,22 @@ import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UFont;
public class StringBounderUtils {
public static StringBounder asStringBounder(final Graphics2D g2d) {
final static BufferedImage imDummy = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
final static Graphics2D gg = imDummy.createGraphics();
public static StringBounder asStringBounder() {
return new StringBounder() {
public Dimension2D calculateDimension(UFont font, String text) {
final FontMetrics fm = g2d.getFontMetrics(font.getFont());
final Rectangle2D rect = fm.getStringBounds(text, g2d);
final FontMetrics fm = gg.getFontMetrics(font.getFont());
final Rectangle2D rect = fm.getStringBounds(text, gg);
return new Dimension2DDouble(rect.getWidth(), rect.getHeight());
}
};

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -101,7 +101,7 @@ public class TextBlockUtils {
static {
final BufferedImage imDummy = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
gg = imDummy.createGraphics();
dummyStringBounder = StringBounderUtils.asStringBounder(gg);
dummyStringBounder = StringBounderUtils.asStringBounder();
}
public static boolean isEmpty(TextBlock text) {

View File

@ -37,13 +37,16 @@ import static gen.lib.cgraph.attr__c.agsafeset;
import static gen.lib.cgraph.edge__c.agedge;
import static gen.lib.cgraph.graph__c.agopen;
import static gen.lib.cgraph.node__c.agnode;
import static gen.lib.cgraph.subg__c.agsubg;
import static gen.lib.gvc.gvc__c.gvContext;
import static gen.lib.gvc.gvlayout__c.gvLayoutJobs;
import h.Agedge_s;
import h.Agnode_s;
import h.Agnodeinfo_t;
import h.Agraph_s;
import h.Agraphinfo_t;
import h.GVC_s;
import h.boxf;
import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D;
@ -52,6 +55,7 @@ import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -97,20 +101,25 @@ import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.Shape;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import smetana.core.CString;
import smetana.core.JUtils;
import smetana.core.Macro;
import smetana.core.Z;
import smetana.core.__ptr__;
import smetana.core.__struct__;
public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
private final CucaDiagram diagram;
private final Bibliotekon bibliotekon = new Bibliotekon();
private final ColorSequence colorSequence = new ColorSequence();
private final StringBounder stringBounder = TextBlockUtils.getDummyStringBounder();
private final Map<ILeaf, Agnode_s> nodes = new HashMap<ILeaf, Agnode_s>();
private final Map<Link, Agedge_s> edges = new HashMap<Link, Agedge_s>();
private final Map<ILeaf, Agnode_s> nodes = new LinkedHashMap<ILeaf, Agnode_s>();
private final Map<Link, Agedge_s> edges = new LinkedHashMap<Link, Agedge_s>();
private final Map<IGroup, Agraph_s> clusters = new LinkedHashMap<IGroup, Agraph_s>();
private Map<IGroup, ILeaf> emptyGroups = new HashMap<IGroup, ILeaf>();
private final DotStringFactory dotStringFactory;
@ -123,12 +132,17 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
public void drawU(UGraphic ug) {
for (Map.Entry<IGroup, Agraph_s> ent : clusters.entrySet()) {
drawGroup(ug, ymirror, ent.getKey(), ent.getValue());
}
for (Map.Entry<ILeaf, Agnode_s> ent : nodes.entrySet()) {
final ILeaf leaf = ent.getKey();
final Agnode_s node = ent.getValue();
final Point2D corner = getCorner(node);
final Shape shape = bibliotekon.getShape(leaf);
final Shape shape = dotStringFactory.getBibliotekon().getShape(leaf);
final IEntityImage image = shape.getImage();
image.drawU(ug.apply(new UTranslate(corner)));
}
@ -157,13 +171,35 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
public CucaDiagramFileMakerJDot(CucaDiagram diagram) {
this.diagram = diagram;
this.dotStringFactory = new DotStringFactory(colorSequence, stringBounder, diagram);
this.dotStringFactory = new DotStringFactory(new ColorSequence(), stringBounder, diagram);
// printGroups(diagram.getRootGroup());
// printEntities(getUnpackagedEntities());
printGroups(diagram.getRootGroup());
printEntities(getUnpackagedEntities());
}
public void drawGroup(UGraphic ug, YMirror ymirror, IGroup group, Agraph_s gr) {
JUtils.LOG2("drawGroup");
final __ptr__ data = Macro.AGDATA(gr).castTo(Agraphinfo_t.class);
final __struct__<boxf> bb = data.getStruct("bb");
final double llx = bb.getStruct("LL").getDouble("x");
double lly = bb.getStruct("LL").getDouble("y");
final double urx = bb.getStruct("UR").getDouble("x");
double ury = bb.getStruct("UR").getDouble("y");
if (ymirror != null) {
final double tmpUry = ury;
ury = ymirror.getMirrored(lly);
lly = ymirror.getMirrored(tmpUry);
}
final Cluster cluster = dotStringFactory.getBibliotekon().getCluster(group);
cluster.setPosition(llx, lly, urx, ury);
JUtils.LOG2("cluster=" + cluster);
// ug.apply(new UTranslate(llx, lly)).apply(new UChangeColor(HtmlColorUtils.BLUE))
// .draw(new URectangle(urx - llx, ury - lly));
cluster.drawU(ug, new UStroke(1.5), diagram.getUmlDiagramType(), diagram.getSkinParam());
}
private void printGroups(IGroup parent) {
for (IGroup g : diagram.getChildrenGroups(parent)) {
if (g.isRemoved()) {
@ -172,6 +208,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) {
final ILeaf folder = diagram.getEntityFactory().createLeaf(g.getCode(), g.getDisplay(),
LeafType.EMPTY_PACKAGE, g.getParentContainer(), null, diagram.getNamespaceSeparator());
emptyGroups.put(g, folder);
final USymbol symbol = g.getUSymbol();
folder.setUSymbol(symbol);
folder.setStereotype(g.getStereotype());
@ -240,14 +277,35 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
}
private void exportEntities(Agraph_s g, Collection<ILeaf> entities2) {
for (ILeaf ent : entities2) {
if (ent.isRemoved()) {
continue;
}
exportEntity(g, ent);
}
}
private void exportEntity(Agraph_s g, ILeaf leaf) {
final Shape shape = dotStringFactory.getBibliotekon().getShape(leaf);
final Agnode_s node = agnode(g, new CString(shape.getUid()), true);
agsafeset(node, new CString("shape"), new CString("box"), new CString(""));
final String width = "" + (shape.getWidth() / 72);
final String height = "" + (shape.getHeight() / 72);
agsafeset(node, new CString("width"), new CString(width), new CString(""));
agsafeset(node, new CString("height"), new CString(height), new CString(""));
System.err.println("NODE " + leaf.getUid() + " " + width + " " + height);
nodes.put(leaf, node);
}
private void printEntity(ILeaf ent) {
if (ent.isRemoved()) {
throw new IllegalStateException();
}
final IEntityImage image = printEntityInternal(ent);
final Dimension2D dim = image.calculateDimension(stringBounder);
final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), colorSequence,
ent.isTop(), image.getShield(), ent.getEntityPosition());
final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(),
dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(), ent.getEntityPosition());
dotStringFactory.addShape(shape);
getBibliotekon().putShape(ent, shape);
}
@ -271,7 +329,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
if (stereotype.getSprite() != null) {
final Sprite tmp = diagram.getSkinParam().getSprite(stereotype.getSprite());
if (tmp != null) {
return tmp.asTextBlock(stereotype.getHtmlColor());
return tmp.asTextBlock(stereotype.getHtmlColor(), 1);
}
}
final List<String> stereos = stereotype.getLabels(diagram.getSkinParam().useGuillemet());
@ -306,7 +364,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
final String height = "" + (shape.getHeight() / 72);
agsafeset(node, new CString("width"), new CString(width), new CString(""));
agsafeset(node, new CString("height"), new CString(height), new CString(""));
final ILeaf leaf = bibliotekon.getLeaf(shape);
final ILeaf leaf = dotStringFactory.getBibliotekon().getLeaf(shape);
nodes.put(leaf, node);
}
@ -324,22 +382,26 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
final Agraph_s g = agopen(new CString("g"), Z._().Agdirected, null);
// printCluster(g, root);
exportEntities(g, getUnpackagedEntities());
exportGroups(g, diagram.getEntityFactory().getRootGroup());
for (ILeaf leaf : diagram.getLeafsvalues()) {
final Shape shape = bibliotekon.getShape(leaf);
final Agnode_s node = agnode(g, new CString(shape.getUid()), true);
agsafeset(node, new CString("shape"), new CString("box"), new CString(""));
final String width = "" + (shape.getWidth() / 72);
final String height = "" + (shape.getHeight() / 72);
agsafeset(node, new CString("width"), new CString(width), new CString(""));
agsafeset(node, new CString("height"), new CString(height), new CString(""));
nodes.put(leaf, node);
// System.err
// .println("NODE " + leaf.getUid() + " [shape=box, width=" + width + ", height=" + height + "]");
}
// for (ILeaf leaf : diagram.getLeafsvalues()) {
// final Shape shape = bibliotekon.getShape(leaf);
// final Agnode_s node = agnode(g, new CString(shape.getUid()), true);
// agsafeset(node, new CString("shape"), new CString("box"), new CString(""));
// final String width = "" + (shape.getWidth() / 72);
// final String height = "" + (shape.getHeight() / 72);
// agsafeset(node, new CString("width"), new CString(width), new CString(""));
// agsafeset(node, new CString("height"), new CString(height), new CString(""));
// nodes.put(leaf, node);
// // System.err
// // .println("NODE " + leaf.getUid() + " [shape=box, width=" + width + ", height=" + height + "]");
// }
//
for (Link link : diagram.getLinks()) {
System.err.println("link=" + link);
final Agedge_s e = createEdge(g, link);
System.err.println("Agedge_s=" + e);
if (e != null) {
edges.put(link, e);
}
@ -373,6 +435,36 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
}
private void exportGroups(Agraph_s graph, IGroup parent) {
for (IGroup g : diagram.getChildrenGroups(parent)) {
if (g.isRemoved()) {
continue;
}
if (diagram.isEmpty(g) && g.getGroupType() == GroupType.PACKAGE) {
final ILeaf folder = emptyGroups.get(g);
exportEntity(graph, folder);
} else {
exportGroup(graph, g);
}
}
}
private void exportGroup(Agraph_s graph, IGroup group) {
final Cluster cluster = getBibliotekon().getCluster(group);
JUtils.LOG2("cluster = " + cluster.getClusterId());
final Agraph_s cluster1 = agsubg(graph, new CString(cluster.getClusterId()), true);
if (cluster.isLabel()) {
final double width = cluster.getTitleAndAttributeWidth();
final double height = cluster.getTitleAndAttributeHeight() - 5;
agsafeset(cluster1, new CString("label"),
Macro.createHackInitDimensionFromLabel((int) width, (int) height), new CString(""));
}
this.exportEntities(cluster1, group.getLeafsDirect());
this.clusters.put(group, cluster1);
this.exportGroups(cluster1, group);
}
private TextBlock getLabel(Link link) {
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
ISkinParam skinParam = diagram.getSkinParam();
@ -385,35 +477,57 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
private Agnode_s getAgnodeFromLeaf(IEntity entity) {
final Agnode_s n = nodes.get(entity);
if (n != null) {
return n;
}
final String id = getBibliotekon().getShapeUid((ILeaf) entity);
for (Map.Entry<ILeaf, Agnode_s> ent : nodes.entrySet()) {
if (id.equals(getBibliotekon().getShapeUid(ent.getKey()))) {
return ent.getValue();
}
}
return null;
}
private Agedge_s createEdge(final Agraph_s g, Link link) {
final Agnode_s n = nodes.get(link.getEntity1());
final Agnode_s m = nodes.get(link.getEntity2());
if (n == null || m == null) {
final Agnode_s n = getAgnodeFromLeaf(link.getEntity1());
final Agnode_s m = getAgnodeFromLeaf(link.getEntity2());
if (n == null) {
return null;
}
if (m == null) {
return null;
}
final Agedge_s e = agedge(g, n, m, null, true);
// System.err.println("EDGE " + link.getEntity1().getUid() + "->" + link.getEntity2().getUid());
agsafeset(e, new CString("arrowtail"), new CString("none"), new CString(""));
agsafeset(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(e, new CString("minlen"), new CString("" + (length - 1)), new CString(""));
//}
// System.err.println("length=" + length);
// if (/* pragma.horizontalLineBetweenDifferentPackageAllowed() || */link.isInvis() || length != 1) {
agsafeset(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) == false) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
// System.err.println("dimLabel = " + dimLabel);
agsafeset(e, new CString("label"),
Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(), (int) dimLabel.getHeight()),
new CString(""));
final CString hackDim = Macro.createHackInitDimensionFromLabel((int) dimLabel.getWidth(),
(int) dimLabel.getHeight());
agsafeset(e, new CString("label"), hackDim, new CString(""));
System.err.print(" label=" + hackDim.getContent());
}
System.err.println();
return e;
}
static private List<String> getFailureText3(Throwable exception) {
exception.printStackTrace();
final List<String> strings = new ArrayList<String>();
strings.add("An error has occured : " + exception);
final String quote = QuoteUtils.getSomeQuote();
@ -434,14 +548,14 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
}
final IEntityImage image = printEntityInternal(ent);
final Dimension2D dim = image.calculateDimension(stringBounder);
final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(), colorSequence,
ent.isTop(), image.getShield(), ent.getEntityPosition());
final Shape shape = new Shape(image, image.getShapeType(), dim.getWidth(), dim.getHeight(),
dotStringFactory.getColorSequence(), ent.isTop(), image.getShield(), ent.getEntityPosition());
// dotStringFactory.addShape(shape);
getBibliotekon().putShape(ent, shape);
}
private Bibliotekon getBibliotekon() {
return bibliotekon;
return dotStringFactory.getBibliotekon();
}
private IEntityImage printEntityInternal(ILeaf ent) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19254 $
*
*/
package net.sourceforge.plantuml.png;
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.Log;
public class PngIO {
private static final String copyleft = "Generated by http://plantuml.sourceforge.net";
private static final String copyleft = "Generated by http://plantuml.com";
public static void write(RenderedImage image, File file, int dpi) throws IOException {
write(image, file, null, dpi);

View File

@ -41,6 +41,7 @@ import java.util.Iterator;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
import net.sourceforge.plantuml.Log;
@ -48,9 +49,10 @@ import com.sun.imageio.plugins.png.PNGMetadata;
public class PngIOMetadata {
private static final String copyleft = "Generated by http://plantuml.sourceforge.net";
private static final String copyleft = "Generated by http://plantuml.com";
public static void writeWithMetadata(RenderedImage image, OutputStream os, String metadata, int dpi, String debugData) throws IOException {
public static void writeWithMetadata(RenderedImage image, OutputStream os, String metadata, int dpi,
String debugData) throws IOException {
// Create & populate metadata
final PNGMetadata pngMetadata = new PNGMetadata();
@ -66,19 +68,13 @@ public class PngIOMetadata {
pngMetadata.zTXt_keyword.add("plantuml");
pngMetadata.zTXt_compressionMethod.add(new Integer(0));
pngMetadata.zTXt_text.add(metadata);
// Log.println("metadata=" + metadata);
// if (metadata.equals("Generated by
// http://plantuml.sourceforge.net")) {
// throw new IllegalArgumentException();
// }
}
if (debugData != null) {
pngMetadata.tEXt_keyword.add("debug");
pngMetadata.tEXt_text.add(debugData);
}
pngMetadata.tEXt_keyword.add("copyleft");
pngMetadata.tEXt_text.add(copyleft);
@ -91,16 +87,26 @@ public class PngIOMetadata {
final ImageWriter imagewriter = getImageWriter();
Log.debug("PngIOMetadata imagewriter=" + imagewriter);
// See http://plantuml.sourceforge.net/qa/?qa=4367/sometimes-missing-response-headers-for-broken-png-images
// Code provided by Michael Griffel
synchronized (imagewriter) {
imagewriter.setOutput(ImageIO.createImageOutputStream(os));
imagewriter.write(null, iioImage, null);
os.flush();
imagewriter.reset();
imagewriter.dispose();
final ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(os);
imagewriter.setOutput(imageOutputStream);
try {
imagewriter.write(null /* default */, iioImage, null /* use default ImageWriteParam */);
} finally {
//os.flush();
// Log.debug("PngIOMetadata finally 1");
imageOutputStream.flush();
// Log.debug("PngIOMetadata finally 2");
imageOutputStream.close();
// Log.debug("PngIOMetadata finally 3");
imagewriter.reset();
// Log.debug("PngIOMetadata finally 4");
imagewriter.dispose();
// Log.debug("PngIOMetadata finally 5");
}
}
// Log.debug("PngIOMetadata before flush");
// os.flush();
// Log.debug("PngIOMetadata after flush");
}
private static ImageWriter getImageWriter() {

View File

@ -102,7 +102,7 @@ public class GraphvizSolverB {
// exportPng(dotString, new File("png", "test1.png"));
final Graphviz graphviz = GraphvizUtils.create(dotString, "svg");
final Graphviz graphviz = GraphvizUtils.create(null, dotString, "svg");
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ProcessState state = graphviz.createFile3(baos);
baos.close();
@ -243,7 +243,7 @@ public class GraphvizSolverB {
}
private void exportPng(final String dotString, File f) throws IOException {
final Graphviz graphviz = GraphvizUtils.create(dotString, "png");
final Graphviz graphviz = GraphvizUtils.create(null, dotString, "png");
final OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
final ProcessState state = graphviz.createFile3(os);
os.close();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19361 $
*
*/
package net.sourceforge.plantuml.statediagram;
@ -165,52 +165,5 @@ public class StateDiagram extends AbstractEntityDiagram {
return hideEmptyDescription;
}
// public Link isEntryPoint(IEntity ent) {
// final Stereotype stereotype = ent.getStereotype();
// if (stereotype == null) {
// return null;
// }
// final String label = stereotype.getLabel();
// if ("<<entrypoint>>".equalsIgnoreCase(label) == false) {
// return null;
// }
// Link inLink = null;
// Link outLink = null;
// for (Link link : getLinks()) {
// if (link.getEntity1() == ent) {
// if (outLink != null) {
// return null;
// }
// outLink = link;
// }
// if (link.getEntity2() == ent) {
// if (inLink != null) {
// return null;
// }
// inLink = link;
// }
// }
// if (inLink == null || outLink == null) {
// return null;
// }
// final Link result = Link.mergeForEntryPoint(inLink, outLink);
// result.setEntryPoint(ent.getContainer());
// return result;
// }
//
// public void manageExitAndEntryPoints() {
// for (IEntity ent : getEntities().values()) {
// final Link entryPointLink = isEntryPoint(ent);
// if (entryPointLink != null) {
// addLink(entryPointLink);
// for (Link link : new ArrayList<Link>(getLinks())) {
// if (link.contains(ent)) {
// removeLink(link);
// }
// }
// }
// }
//
// }
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19254 $
*
*/
package net.sourceforge.plantuml.sudoku;
@ -127,7 +127,7 @@ public class GraphicsSudoku {
ug = ug.apply(new UTranslate(0, sudoHeight));
final List<String> texts = new ArrayList<String>();
texts.add("http://plantuml.sourceforge.net");
texts.add("http://plantuml.com");
texts.add("Seed " + Long.toString(sudoku.getSeed(), 36));
texts.add("Difficulty " + sudoku.getRatting());
final TextBlock textBlock = Display.create(texts).create(FontConfiguration.blackBlueTrue(font),

View File

@ -38,6 +38,7 @@ import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -198,12 +199,12 @@ public class Cluster implements Moveable {
return firsts;
}
private List<Shape> getShapesEntryExit(EntityPosition position) {
private List<Shape> getShapesEntryExit(EnumSet<EntityPosition> positions) {
final List<Shape> result = new ArrayList<Shape>();
for (final Iterator<Shape> it = shapes.iterator(); it.hasNext();) {
final Shape sh = it.next();
if (sh.getEntityPosition() == position) {
if (positions.contains(sh.getEntityPosition())) {
result.add(sh);
}
}
@ -511,8 +512,7 @@ public class Cluster implements Moveable {
}
public void printClusterEntryExit(StringBuilder sb, StringBounder stringBounder) {
// final List<? extends IShapePseudo> entries = getShapesEntryExit(EntityPosition.ENTRY_POINT);
final List<Shape> shapesEntryExitList = getShapesEntryExit(EntityPosition.ENTRY_POINT);
final List<Shape> shapesEntryExitList = getShapesEntryExit(EntityPosition.getInputs());
final double maxWith = getMaxWidthFromLabelForEntryExit(shapesEntryExitList, stringBounder);
final double naturalSpace = 70;
final List<? extends IShapePseudo> entries;
@ -531,7 +531,7 @@ public class Cluster implements Moveable {
sh.appendShape(sb);
}
}
final List<Shape> exits = getShapesEntryExit(EntityPosition.EXIT_POINT);
final List<Shape> exits = getShapesEntryExit(EntityPosition.getOutputs());
if (exits.size() > 0) {
sb.append("{rank=sink;");
for (Shape sh : exits) {
@ -700,9 +700,8 @@ public class Cluster implements Moveable {
sb.append("style=solid;");
sb.append("color=\"" + StringUtils.getAsHtml(color) + "\";");
final boolean isLabel = getTitleAndAttributeHeight() > 0 && getTitleAndAttributeWidth() > 0;
final String label;
if (isLabel) {
if (isLabel()) {
final StringBuilder sblabel = new StringBuilder("<");
Line.appendTable(sblabel, getTitleAndAttributeWidth(), getTitleAndAttributeHeight() - 5, colorTitle);
sblabel.append(">");
@ -771,6 +770,10 @@ public class Cluster implements Moveable {
SvekUtils.println(sb);
}
public boolean isLabel() {
return getTitleAndAttributeHeight() > 0 && getTitleAndAttributeWidth() > 0;
}
private void subgraphCluster(StringBuilder sb, String id) {
subgraphCluster(sb, id, "\"\"");
}

View File

@ -67,8 +67,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
static private final StringBounder stringBounder;
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
stringBounder = StringBounderUtils.asStringBounder(builder.getGraphics2D());
stringBounder = StringBounderUtils.asStringBounder();
}
public CucaDiagramFileMakerSvek(CucaDiagram diagram) throws IOException {

View File

@ -125,8 +125,7 @@ public final class CucaDiagramFileMakerSvek2 {
static private final StringBounder stringBounder;
static {
final EmptyImageBuilder builder = new EmptyImageBuilder(10, 10, Color.WHITE);
stringBounder = StringBounderUtils.asStringBounder(builder.getGraphics2D());
stringBounder = StringBounderUtils.asStringBounder();
}
public CucaDiagramFileMakerSvek2(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma) {
@ -568,7 +567,7 @@ public final class CucaDiagramFileMakerSvek2 {
if (stereotype.getSprite() != null) {
final Sprite tmp = dotData.getSkinParam().getSprite(stereotype.getSprite());
if (tmp != null) {
return tmp.asTextBlock(stereotype.getHtmlColor());
return tmp.asTextBlock(stereotype.getHtmlColor(), 1);
}
}
final List<String> stereos = stereotype.getLabels(dotData.getSkinParam().useGuillemet());

View File

@ -269,7 +269,7 @@ public class DotStringFactory implements Moveable {
}
public GraphvizVersion getGraphvizVersion() {
final Graphviz graphviz = GraphvizUtils.create("foo;", "svg");
final Graphviz graphviz = GraphvizUtils.create(skinParam, "foo;", "svg");
final File f = graphviz.getDotExe();
return GraphvizVersions.getInstance().getVersion(f);
}
@ -282,7 +282,7 @@ public class DotStringFactory implements Moveable {
SvekUtils.traceDotString(dotString);
}
final Graphviz graphviz = GraphvizUtils.create(dotString, "svg");
final Graphviz graphviz = GraphvizUtils.create(skinParam, dotString, "svg");
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ProcessState state = graphviz.createFile3(baos);
baos.close();
@ -301,13 +301,13 @@ public class DotStringFactory implements Moveable {
}
public boolean illegalDotExe() {
final Graphviz graphviz = GraphvizUtils.create(null, "svg");
final Graphviz graphviz = GraphvizUtils.create(skinParam, "svg");
final File dotExe = graphviz.getDotExe();
return dotExe == null || dotExe.isFile() == false || dotExe.canRead() == false;
}
public File getDotExe() {
final Graphviz graphviz = GraphvizUtils.create(null, "svg");
final Graphviz graphviz = GraphvizUtils.create(skinParam, "svg");
return graphviz.getDotExe();
}
@ -450,4 +450,8 @@ public class DotStringFactory implements Moveable {
return bibliotekon;
}
public ColorSequence getColorSequence() {
return colorSequence;
}
}

View File

@ -36,11 +36,11 @@ package net.sourceforge.plantuml.svek;
import java.awt.geom.Point2D;
import java.util.Collection;
import net.sourceforge.plantuml.svek.image.EntityImageStateBorder;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
public class FrontierCalculator {
private static final double DELTA = 3 * EntityImageStateBorder.RADIUS;
private static final double DELTA = 3 * EntityPosition.RADIUS;
private ClusterPosition core;
private final ClusterPosition initial;

View File

@ -121,7 +121,7 @@ public class EntityImageClassHeader2 extends AbstractEntityImage {
private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) {
final Stereotype stereotype = entity.getStereotype();
if (stereotype != null && stereotype.getSprite() != null) {
return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor());
return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor(), 1);
}
final UFont font = SkinParamUtils.getFont(getSkinParam(), FontParam.CIRCLED_CHARACTER, null);
final HtmlColor classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, stereotype);

View File

@ -102,7 +102,7 @@ public class EntityImageDescription extends AbstractEntityImage {
if (stereotype != null && stereotype.getSprite() != null
&& getSkinParam().getSprite(stereotype.getSprite()) != null) {
symbol = symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
stereo = getSkinParam().getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor());
stereo = getSkinParam().getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor(), 1);
} else if (stereotype != null && stereotype.getLabel(false) != null
&& portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) {
stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create(

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -55,26 +56,24 @@ import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.svek.Cluster;
import net.sourceforge.plantuml.svek.Shape;
import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class EntityImageStateBorder extends AbstractEntityImage {
public static final double RADIUS = 6;
private final TextBlock desc;
private final Cluster stateParent;
private final EntityPosition entityPosition;
private final Bibliotekon bibliotekon;
private final Rankdir rankdir;
public EntityImageStateBorder(ILeaf leaf, ISkinParam skinParam, Cluster stateParent, final Bibliotekon bibliotekon) {
super(leaf, skinParam);
this.bibliotekon = bibliotekon;
this.rankdir = skinParam.getRankdir();
this.entityPosition = leaf.getEntityPosition();
if (entityPosition == EntityPosition.NORMAL) {
@ -94,7 +93,7 @@ public class EntityImageStateBorder extends AbstractEntityImage {
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(RADIUS * 2, RADIUS * 2);
return entityPosition.getDimension(rankdir);
}
public double getMaxWidthFromLabelForEntryExit(StringBounder stringBounder) {
@ -103,18 +102,14 @@ public class EntityImageStateBorder extends AbstractEntityImage {
}
final public void drawU(UGraphic ug) {
final Shadowable circle = new UEllipse(RADIUS * 2, RADIUS * 2);
// if (getSkinParam().shadowing()) {
// circle.setDeltaShadow(4);
// }
double y = 0;
final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder());
final double x = 0 - (dimDesc.getWidth() - 2 * RADIUS) / 2;
final double x = 0 - (dimDesc.getWidth() - 2 * EntityPosition.RADIUS) / 2;
if (upPosition()) {
y -= 2 * RADIUS + dimDesc.getHeight();
y -= 2 * EntityPosition.RADIUS + dimDesc.getHeight();
} else {
y += 2 * RADIUS;
y += 2 * EntityPosition.RADIUS;
}
desc.drawU(ug.apply(new UTranslate(x, y)));
@ -126,33 +121,12 @@ public class EntityImageStateBorder extends AbstractEntityImage {
}
ug = ug.apply(new UChangeBackColor(backcolor));
ug.draw(circle);
if (entityPosition == EntityPosition.EXIT_POINT) {
final double xc = 0 + RADIUS + .5;
final double yc = 0 + RADIUS + .5;
final double radius = RADIUS - .5;
drawLine(ug, getPointOnCircle(xc, yc, Math.PI / 4, radius),
getPointOnCircle(xc, yc, Math.PI + Math.PI / 4, radius));
drawLine(ug, getPointOnCircle(xc, yc, -Math.PI / 4, radius),
getPointOnCircle(xc, yc, Math.PI - Math.PI / 4, radius));
}
}
private Point2D getPointOnCircle(double xc, double yc, double angle, double radius) {
final double x = xc + radius * Math.cos(angle);
final double y = yc + radius * Math.sin(angle);
return new Point2D.Double(x, y);
}
static private void drawLine(UGraphic ug, Point2D p1, Point2D p2) {
final double dx = p2.getX() - p1.getX();
final double dy = p2.getY() - p1.getY();
ug.apply(new UTranslate(p1.getX(), p1.getY())).draw(new ULine(dx, dy));
entityPosition.drawSymbol(ug, rankdir);
}
public ShapeType getShapeType() {
return ShapeType.CIRCLE;
return entityPosition.getShapeType();
}
public int getShield() {

View File

@ -28,11 +28,13 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19271 $
*
*/
package net.sourceforge.plantuml.ugraphic;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
public class UImage implements UShape {
@ -43,6 +45,25 @@ public class UImage implements UShape {
this.image = image;
}
public UImage(BufferedImage before, double scale) {
if (scale == 1) {
this.image = before;
return;
}
final int w = (int) Math.round(before.getWidth() * scale);
final int h = (int) Math.round(before.getHeight() * scale);
final BufferedImage after = new BufferedImage(w, h, before.getType());
final AffineTransform at = new AffineTransform();
at.scale(scale, scale);
final AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
this.image = scaleOp.filter(before, after);
}
public UImage scale(double scale) {
return new UImage(image, scale);
}
public final BufferedImage getImage() {
return image;
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.ugraphic.g2d;
@ -82,7 +82,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
final UFont font = fontConfiguration.getFont().scaled(param.getScale());
final Dimension2D dimBack = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dimBack = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
final Color extended = mapper.getMappedColor(fontConfiguration.getExtendedColor());
if (extended != null) {
@ -107,14 +107,14 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
if (extended != null) {
g2d.setColor(mapper.getMappedColor(extended));
}
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final int ypos = (int) (y + 2.5);
g2d.setStroke(new BasicStroke((float) 1));
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
g2d.setStroke(new BasicStroke());
}
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final int ypos = (int) (y + 2.5) - 1;
final HtmlColor extended = fontConfiguration.getExtendedColor();
if (extended != null) {
@ -126,7 +126,7 @@ public class DriverTextAsPathG2d implements UDriver<Graphics2D> {
}
}
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final FontMetrics fm = g2d.getFontMetrics(font.getFont());
final int ypos = (int) (y - fm.getDescent() - 0.5);
final HtmlColor extended = fontConfiguration.getExtendedColor();

View File

@ -78,7 +78,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
final UFont font = fontConfiguration.getFont().scaled(param.getScale());
final Dimension2D dimBack = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dimBack = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
if (fontConfiguration.containsStyle(FontStyle.BACKCOLOR)) {
final Color extended = mapper.getMappedColor(fontConfiguration.getExtendedColor());
if (extended != null) {
@ -100,14 +100,14 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
if (extended != null) {
g2d.setColor(mapper.getMappedColor(extended));
}
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final int ypos = (int) (y + 2.5);
g2d.setStroke(new BasicStroke((float) 1));
g2d.drawLine((int) x, ypos, (int) (x + dim.getWidth()), ypos);
g2d.setStroke(new BasicStroke());
}
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final int ypos = (int) (y + 2.5) - 1;
final HtmlColor extended = fontConfiguration.getExtendedColor();
if (extended != null) {
@ -119,7 +119,7 @@ public class DriverTextG2d implements UDriver<Graphics2D> {
}
}
if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d), font, shape.getText());
final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(), font, shape.getText());
final FontMetrics fm = g2d.getFontMetrics(font.getFont());
final int ypos = (int) (y - fm.getDescent() - 0.5);
final HtmlColor extended = fontConfiguration.getExtendedColor();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
* Revision $Revision: 19267 $
*
*/
package net.sourceforge.plantuml.ugraphic.g2d;
@ -156,7 +156,7 @@ public class UGraphicG2d extends AbstractUGraphic<Graphics2D> implements EnsureV
if (hasAffineTransform) {
return TextBlockUtils.getDummyStringBounder();
}
return StringBounderUtils.asStringBounder(getGraphicObject());
return StringBounderUtils.asStringBounder();
}
@Override

View File

@ -38,6 +38,6 @@ import net.sourceforge.plantuml.graphic.TextBlock;
public interface Sprite {
public TextBlock asTextBlock(final HtmlColor color);
public TextBlock asTextBlock(final HtmlColor color, double scale);
}

View File

@ -56,15 +56,15 @@ public class SpriteImage implements Sprite {
this.img = new UImage(img);
}
public TextBlock asTextBlock(final HtmlColor color) {
public TextBlock asTextBlock(final HtmlColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
ug.draw(img);
ug.draw(img.scale(scale));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(img.getWidth(), img.getHeight());
return new Dimension2DDouble(img.getWidth() * scale, img.getHeight() * scale);
}
};
}

View File

@ -106,15 +106,16 @@ public class SpriteMonochrome implements Sprite {
return new UImage(im);
}
public TextBlock asTextBlock(final HtmlColor color) {
public TextBlock asTextBlock(final HtmlColor color, final double scale) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
ug.draw(toUImage(ug.getColorMapper(), ug.getParam().getBackcolor(), color));
final UImage image = toUImage(ug.getColorMapper(), ug.getParam().getBackcolor(), color);
ug.draw(image.scale(scale));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return new Dimension2DDouble(getWidth(), getHeight());
return new Dimension2DDouble(getWidth() * scale, getHeight() * scale);
}
};
}

View File

@ -175,7 +175,7 @@ public class PSystemVersion extends AbstractPSystem {
strings.add("<u>Logo</u>: Benjamin Croizet");
strings.add(" ");
strings.add("http://plantuml.sourceforge.net");
strings.add("http://plantuml.com");
strings.add(" ");
return new PSystemVersion(true, strings);
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19252 $
* Revision $Revision: 19505 $
*
*/
package net.sourceforge.plantuml.version;
@ -39,11 +39,11 @@ import java.util.Date;
public class Version {
public static int version() {
return 8037;
return 8038;
}
public static String versionString() {
if (beta() != 0) {
if (beta() != 1) {
return "" + (version() + 1) + "beta" + beta();
}
return "" + version();
@ -63,7 +63,7 @@ public class Version {
}
private static long compileTime() {
return 1457273929160L;
return 1459789355152L;
}
public static String compileTimeString() {

View File

@ -36,10 +36,13 @@ package net.sourceforge.plantuml.webp;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.version.PSystemVersion;
@ -102,4 +105,49 @@ public class Portraits {
current.getAndIncrement();
}
public static Portrait getOne(String line) {
Portrait candidat = null;
for (Portrait p : all) {
final int dist = similar(p.getName(), line);
if (dist <= 3) {
if (candidat != null && dist < similar(candidat.getName(), line)) {
continue;
}
candidat = p;
}
}
return candidat;
}
public static int similar(String s1, String s2) {
final int[] tab1 = countLetter(s1);
final int[] tab2 = countLetter(s2);
int result = 0;
for (int i = 0; i < tab1.length; i++) {
result += Math.abs(tab1[i] - tab2[i]);
}
return result;
}
private static String noAccent(String str) {
final String nfdNormalizedString = Normalizer.normalize(str, Normalizer.Form.NFD);
final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
return pattern.matcher(nfdNormalizedString).replaceAll("");
}
private static int[] countLetter(String s) {
s = noAccent(s).toLowerCase(Locale.US);
final int[] result = new int[26];
for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(i);
if (c >= 'a' && c <= 'z') {
result[c - 'a']++;
}
}
return result;
}
static final List<Portrait> getAll() {
return all;
}
}

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.statediagram.StateDiagram;
public final class CucaDiagramXmiMaker {
@ -57,7 +58,9 @@ public final class CucaDiagramXmiMaker {
public void createFiles(OutputStream fos) throws IOException {
try {
final IXmiClassDiagram xmi;
if (fileFormat == FileFormat.XMI_STANDARD) {
if (diagram instanceof StateDiagram) {
xmi = new XmiStateDiagram((StateDiagram) diagram);
} else if (fileFormat == FileFormat.XMI_STANDARD) {
xmi = new XmiClassDiagramStandard((ClassDiagram) diagram);
} else if (fileFormat == FileFormat.XMI_ARGO) {
xmi = new XmiClassDiagramArgo((ClassDiagram) diagram);
@ -67,8 +70,6 @@ public final class CucaDiagramXmiMaker {
throw new UnsupportedOperationException();
}
xmi.transformerXml(fos);
// fos.close();
// return Collections.singletonList(suggestedFile);
} catch (ParserConfigurationException e) {
Log.error(e.toString());
e.printStackTrace();

View File

@ -121,14 +121,14 @@ public class XmiClassDiagramStar implements IXmiClassDiagram {
// }
}
// private boolean isStandalone(IEntity ent) {
// for (final Link link : classDiagram.getLinks()) {
// if (link.getEntity1() == ent || link.getEntity2() == ent) {
// return false;
// }
// }
// return true;
// }
// private boolean isStandalone(IEntity ent) {
// for (final Link link : classDiagram.getLinks()) {
// if (link.getEntity1() == ent || link.getEntity2() == ent) {
// return false;
// }
// }
// return true;
// }
public static String forXMI(String s) {
return s.replace(':', ' ');
@ -147,7 +147,7 @@ public class XmiClassDiagramStar implements IXmiClassDiagram {
final Element association = document.createElement("UML:Association");
association.setAttribute("xmi.id", assId);
association.setAttribute("namespace", "model1");
if (link.getLabel() != null) {
if (Display.isNull(link.getLabel()) == false) {
association.setAttribute("name", forXMI(link.getLabel()));
}

View File

@ -0,0 +1,255 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5616 $
*
*/
package net.sourceforge.plantuml.xmi;
import java.io.OutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.Member;
import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.utils.UniqueSequence;
import net.sourceforge.plantuml.version.Version;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class XmiStateDiagram implements IXmiClassDiagram {
private final StateDiagram diagram;
private final Document document;
private final Element ownedElement;
public XmiStateDiagram(StateDiagram diagram) throws ParserConfigurationException {
this.diagram = diagram;
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = factory.newDocumentBuilder();
this.document = builder.newDocument();
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
final Element xmi = document.createElement("XMI");
xmi.setAttribute("xmi.version", "1.1");
xmi.setAttribute("xmlns:UML", "href://org.omg/UML/1.3");
document.appendChild(xmi);
final Element header = document.createElement("XMI.header");
xmi.appendChild(header);
final Element metamodel = document.createElement("XMI.metamodel");
metamodel.setAttribute("xmi.name", "UML");
metamodel.setAttribute("xmi.version", "1.3");
header.appendChild(metamodel);
final Element content = document.createElement("XMI.content");
xmi.appendChild(content);
// <UML:Model xmi.id="UMLModel.4" name="Design Model"
// visibility="public" isSpecification="false" isRoot="false"
// isLeaf="false" isAbstract="false">
final Element model = document.createElement("UML:Model");
model.setAttribute("xmi.id", "model1");
model.setAttribute("name", "PlantUML "+Version.versionString());
content.appendChild(model);
// <UML:Namespace.ownedElement>
this.ownedElement = document.createElement("UML:Namespace.ownedElement");
model.appendChild(ownedElement);
for (final IGroup gr : diagram.getGroups(false)) {
if (gr.getParentContainer() instanceof GroupRoot) {
addState(gr, ownedElement);
}
}
for (final IEntity ent : diagram.getLeafsvalues()) {
if (ent.getParentContainer() instanceof GroupRoot) {
addState(ent, ownedElement);
}
}
for (final Link link : diagram.getLinks()) {
addLink(link);
}
}
private void addState(final IEntity tobeAdded, Element container) {
final Element elementState = createEntityNode(tobeAdded);
container.appendChild(elementState);
for (final IEntity ent : diagram.getGroups(false)) {
if (ent.getParentContainer() == tobeAdded) {
addState(ent, elementState);
}
}
for (final IEntity ent : diagram.getLeafsvalues()) {
if (ent.getParentContainer() == tobeAdded) {
addState(ent, elementState);
}
}
}
public static String forXMI(String s) {
return s.replace(':', ' ');
}
public static String forXMI(Display s) {
return s.get(0).toString().replace(':', ' ');
}
private void addLink(Link link) {
final String assId = "ass" + UniqueSequence.getValue();
final Element association = document.createElement("UML:Association");
association.setAttribute("xmi.id", assId);
association.setAttribute("namespace", "model1");
if (Display.isNull(link.getLabel()) == false) {
association.setAttribute("name", forXMI(link.getLabel()));
}
final Element connection = document.createElement("UML:Association.connection");
final Element end1 = document.createElement("UML:AssociationEnd");
end1.setAttribute("xmi.id", "end" + UniqueSequence.getValue());
end1.setAttribute("association", assId);
end1.setAttribute("type", link.getEntity1().getUid());
if (link.getQualifier1() != null) {
end1.setAttribute("name", forXMI(link.getQualifier1()));
}
final Element endparticipant1 = document.createElement("UML:AssociationEnd.participant");
if (link.getType().getDecor2() == LinkDecor.COMPOSITION) {
end1.setAttribute("aggregation", "composite");
}
if (link.getType().getDecor2() == LinkDecor.AGREGATION) {
end1.setAttribute("aggregation", "aggregate");
}
// }
end1.appendChild(endparticipant1);
connection.appendChild(end1);
final Element end2 = document.createElement("UML:AssociationEnd");
end2.setAttribute("xmi.id", "end" + UniqueSequence.getValue());
end2.setAttribute("association", assId);
end2.setAttribute("type", link.getEntity2().getUid());
if (link.getQualifier2() != null) {
end2.setAttribute("name", forXMI(link.getQualifier2()));
}
final Element endparticipant2 = document.createElement("UML:AssociationEnd.participant");
if (link.getType().getDecor1() == LinkDecor.COMPOSITION) {
end2.setAttribute("aggregation", "composite");
}
if (link.getType().getDecor1() == LinkDecor.AGREGATION) {
end2.setAttribute("aggregation", "aggregate");
}
// }
end2.appendChild(endparticipant2);
connection.appendChild(end2);
association.appendChild(connection);
ownedElement.appendChild(association);
}
private Element createEntityNode(IEntity entity) {
// <UML:Class xmi.id="UMLClass.5" name="Class1" visibility="public"
// isSpecification="false"
// namespace="UMLModel.4" isRoot="false" isLeaf="false"
// isAbstract="false" participant="UMLAssociationEnd.11"
// isActive="false">
final Element cla = document.createElement("UML:State");
cla.setAttribute("xmi.id", entity.getUid());
cla.setAttribute("name", entity.getDisplay().get(0).toString());
cla.setAttribute("namespace", "model1");
final Element feature = document.createElement("UML:Classifier.feature");
cla.appendChild(feature);
for (Member m : entity.getBodier().getFieldsToDisplay()) {
// <UML:Attribute xmi.id="UMLAttribute.6" name="Attribute1"
// visibility="public" isSpecification="false"
// ownerScope="instance" changeability="changeable"
// targetScope="instance" type="" owner="UMLClass.5"/>
final Element attribute = document.createElement("UML:Attribute");
attribute.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
attribute.setAttribute("name", m.getDisplay(false));
feature.appendChild(attribute);
}
for (Member m : entity.getBodier().getMethodsToDisplay()) {
// <UML:Operation xmi.id="UMLOperation.7" name="Operation1"
// visibility="public" isSpecification="false"
// ownerScope="instance" isQuery="false" concurrency="sequential"
// isRoot="false" isLeaf="false"
// isAbstract="false" specification="" owner="UMLClass.5"/>
final Element operation = document.createElement("UML:Operation");
operation.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
operation.setAttribute("name", m.getDisplay(false));
feature.appendChild(operation);
}
return cla;
}
public void transformerXml(OutputStream os) throws TransformerException, ParserConfigurationException {
final Source source = new DOMSource(document);
final Result resultat = new StreamResult(os);
final TransformerFactory fabrique = TransformerFactory.newInstance();
final Transformer transformer = fabrique.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(source, resultat);
}
}

View File

@ -39,10 +39,13 @@ import smetana.core.amiga.StarStruct;
public class CString extends UnsupportedC implements __ptr__, Area {
private static int UID = 100;
private final Throwable creation = new Throwable();
private final List<Character> data2;
private final int currentStart;
private final List<__ptr__> fathers = new ArrayList<__ptr__>();
private final int uid;
public boolean isSameThan(CString other) {
if (this.data2 != other.data2) {
@ -92,6 +95,8 @@ public class CString extends UnsupportedC implements __ptr__, Area {
private CString(List<Character> data2, int currentStart) {
this.data2 = data2;
this.currentStart = currentStart;
this.uid = UID;
UID+=2;
creation.fillInStackTrace();
}
@ -222,4 +227,8 @@ public class CString extends UnsupportedC implements __ptr__, Area {
this.fathers.add(struct);
}
public int getUid() {
return uid;
}
}

View File

@ -185,6 +185,10 @@ public class JUtils {
// System.err.println(s);
}
public static void LOG2(String s) {
// System.err.println(s);
}
public static boolean EQ(Object o1, Object o2) {
if (o1 == o2) {
return true;
@ -236,6 +240,19 @@ public class JUtils {
}
return EQ(o1b, o2b);
}
if (o1 instanceof StarArrayOfStruct && o2 instanceof StarArrayOfStruct) {
StarArrayOfStruct oo1 = (StarArrayOfStruct) o1;
StarArrayOfStruct oo2 = (StarArrayOfStruct) o2;
return oo1.isSameThan(oo2);
}
if (o1 instanceof StarArrayOfPtr && o2 instanceof StarArrayOfStruct) {
StarArrayOfPtr oo1 = (StarArrayOfPtr) o1;
StarArrayOfStruct oo2 = (StarArrayOfStruct) o2;
__struct__ s1 = oo1.getStruct();
__struct__ s2 = oo2.getStruct();
boolean result = s1.getInternalData().isSameThan(s2.getInternalData());
return result;
}
System.err.println("o1=" + o1.getClass() + " " + o1);
System.err.println("o2=" + o2.getClass() + " " + o2);
throw new UnsupportedOperationException();

View File

@ -31,9 +31,6 @@
package smetana.core;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import h.Agedge_s;
import h.Agedgeinfo_t;
import h.Agnode_s;
@ -53,6 +50,9 @@ import h.port;
import h.splines;
import h.textlabel_t;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Macro {
public static <O> O F(O result, Object... dummy) {
@ -374,11 +374,11 @@ public class Macro {
}
// #define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels)
public static int GD_has_labels(Agraph_s g) {
public static int GD_has_labels(__ptr__ g) {
return AGDATA(g).castTo(Agraphinfo_t.class).getInt("has_labels");
}
public static void GD_has_labels(Agraph_s g, int v) {
public static void GD_has_labels(__ptr__ g, int v) {
AGDATA(g).castTo(Agraphinfo_t.class).setInt("has_labels", v);
}
@ -421,8 +421,11 @@ public class Macro {
}
// #define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label)
public static __ptr__ GD_label(Agraph_s g) {
return AGDATA(g).castTo(Agraphinfo_t.class).getPtr("label");
public static textlabel_t GD_label(__ptr__ g) {
return (textlabel_t) AGDATA(g).castTo(Agraphinfo_t.class).getPtr("label");
}
public static void GD_label(__ptr__ g, __ptr__ v) {
AGDATA(g).castTo(Agraphinfo_t.class).setPtr("label", v);
}
// #define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader)
@ -576,6 +579,13 @@ public class Macro {
// #define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos)
public static int GD_label_pos(Agraph_s g) {
return AGDATA(g).castTo(Agraphinfo_t.class).getInt("label_pos");
}
public static void GD_label_pos(Agraph_s g, int v) {
AGDATA(g).castTo(Agraphinfo_t.class).setInt("label_pos", v);
}
// #define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes)
public static int GD_showboxes(Agraph_s g) {
return AGDATA(g).castTo(Agraphinfo_t.class).getInt("showboxes");
@ -607,6 +617,9 @@ public class Macro {
public static __ptr__ ND_alg(Agnode_s n) {
return AGDATA(n).castTo(Agnodeinfo_t.class).getPtr("alg");
}
public static void ND_alg(Agnode_s n, __ptr__ value) {
AGDATA(n).castTo(Agnodeinfo_t.class).setPtr("alg", value);
}
// #define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent)
public static Agnode_s ND_UF_parent(__ptr__ n) {
@ -785,7 +798,7 @@ public class Macro {
public static int ND_order(__ptr__ n) {
return AGDATA(n).castTo(Agnodeinfo_t.class).getInt("order");
}
public static void ND_order(Agnode_s n, int v) {
public static void ND_order(__ptr__ n, int v) {
AGDATA(n).castTo(Agnodeinfo_t.class).setInt("order", v);
}
@ -1142,7 +1155,7 @@ public class Macro {
if (ptr == null) {
return (__ptr__) JUtils.sizeof(type, nb).malloc();
}
return (__ptr__) JUtils.sizeof(type, nb).malloc();
return (__ptr__) JUtils.sizeof(type, nb).realloc(ptr);
}
// #define elist_append(item,L) do {L.list = ALLOC(L.size + 2,L.list,edge_t*); L.list[L.size++] = item;
@ -1242,7 +1255,7 @@ public class Macro {
// (type*)zrealloc(ptr,size,sizeof(type),osize):(type*)zmalloc((size)*sizeof(type)))
public static __ptr__ ZALLOC(int size, __ptr__ ptr, Class type, int osize) {
if (ptr != null) {
throw new UnsupportedOperationException();
return Memory.realloc(ptr, JUtils.sizeof(type, size));
}
return (__ptr__) JUtils.sizeof(type, size).malloc();
}
@ -1346,7 +1359,7 @@ public class Macro {
int hh = Integer.parseInt(m.group(2));
size.setDouble("x", ww);
size.setDouble("y", hh);
System.err.println("Hacking dimension to width=" + ww + " height=" + hh);
JUtils.LOG2("Hacking dimension to width=" + ww + " height=" + hh);
}
}

Some files were not shown because too many files have changed in this diff Show More