48 QCString
label()
const;
52 void move(
int dx,
int dy) {
x+=dx;
y+=dy; }
122 bool doBase,
bool bitmap,
123 uint baseRows,uint superRows,
124 uint cellWidth,uint cellHeight,
126 bool generateMap=TRUE);
128 bool doBase,
bool bitmap,
129 uint baseRows,uint superRows,
130 uint cellWidth,uint cellheight);
166 case Public:
return 0xffffffff;
169 case Private:
return 0xaaaaaaaa;
190 case Public:
return "solid";
202 case Normal:
return 0xffffffff;
203 case Virtual:
return 0xf0f0f0f0;
212 QListIterator<DiagramItem> it(*dil);
215 for (++it;(di=it.current());++it)
221 else if (result==
Private) result=p;
228 int x,
int y,
int w,
int h,
bool firstRow,
229 bool hasDocs,
bool children=FALSE)
231 int colFill = hasDocs ? (firstRow ? 0 : 2) : 7;
232 int colBorder = (firstRow || !hasDocs) ? 1 : 3;
235 image->
fillRect(x+1,y+1,w-2,h-2,colFill,mask);
236 image->
drawRect(x,y,w,h,colBorder,mask);
242 image->
drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff);
247 float x,
float y,
bool children=FALSE)
250 t <<
" (" << di->
label() <<
") " << x <<
" " << y <<
" box\n";
251 if (children) t << x <<
" " << y <<
" mark\n";
256 int x,
int y,
int w,
int h)
269 if (!cd->
anchor().isEmpty())
275 if (!tooltip.isEmpty())
280 t <<
"\" shape=\"rect\" coords=\"" << x <<
"," << y <<
",";
281 t << (x+w) <<
"," << (y+h) <<
"\"/>" <<
endl;
314 if ( n.right(2)==
"-p")
316 n = n.left(n.length()-2);
375 for (;(bcd=it.current());++it)
381 if (count>0 && (prot!=
Private || !doBases))
396 for (;(bcd=it.current());++it)
425 QListIterator<DiagramItem> it(*dil);
427 for (;(di=it.current());++it)
443 int pPos=root->
xPos();
450 for (k=dil->getFirst()->number();k<row->count();k++)
451 row->at(k)->move(pPos-cPos,0);
459 for (k=root->
number();k<row->count();k++)
460 row->at(k)->move(cPos-pPos,0);
465 QListIterator<DiagramItem> it(*dil);
467 for (;(di=it.current()) && !moved && !di->
isInList();++it)
477 QListIterator<DiagramRow> it(*
this);
479 for (;(row=it.current()) && row->count()<
maxTreeWidth;++it) {}
483 QListIterator<DiagramItem> rit(*row);
488 for (;(di=rit.current());++rit)
491 if (pi==opi && !first) { delta-=
gridWidth; }
507 QListIterator<DiagramItem> rit(*row);
509 while ((di=rit.current()))
515 while (di && di->
parentItem()==pi) { ++rit; di=rit.current(); }
529 QListIterator<DiagramRow> it(*
this);
531 for (;(row=it.current()) && !row->getFirst()->isInList();++it)
541 QListIterator<DiagramItem> rit(*row);
543 for (;(di=rit.current());++rit)
545 if (di->
parentItem()!=opi) curListLen=1;
else curListLen++;
546 if (curListLen>maxListLen) maxListLen=curListLen;
558 QListIterator<DiagramRow> it(*
this);
561 for (;(dr=it.current()) && !done;++it)
563 QListIterator<DiagramItem> rit(*dr);
565 for (;(di=rit.current());++rit)
568 if (maxXPos) mx=QMAX(mx,(uint)di->
xPos());
572 if (maxLabelLen) *maxLabelLen=ml;
573 if (maxXPos) *maxXPos=mx;
577 bool doBase,
bool bitmap,
578 uint baseRows,uint superRows,
579 uint cellWidth,uint cellHeight,
583 QListIterator<DiagramRow> it(*
this);
587 bool firstRow = doBase;
588 for (;(dr=it.current()) && !done;++it)
591 float xf=0.0f,yf=0.0f;
592 QListIterator<DiagramItem> rit(*dr);
597 if (doBase) rit.toLast();
else rit.toFirst();
598 while ((di=rit.current()))
609 if (doBase) yf += 1.0f;
621 superRows*cellHeight-
651 if (!firstRow && generateMap)
659 if (doBase) --rit;
else ++rit;
665 for (rit.toFirst();(di=rit.current());++rit)
673 superRows*cellHeight-
683 writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow,hasDocs);
684 if (!firstRow && generateMap)
707 bool doBase,
bool bitmap,
708 uint baseRows,uint superRows,
709 uint cellWidth,uint cellHeight)
711 QListIterator<DiagramRow> it(*
this);
714 for (;(dr=it.current()) && !done;++it)
716 QListIterator<DiagramItem> rit(*dr);
721 float xf=0.0f,yf=0.0f,ysf=0.0f;
722 for (;(di=rit.current());++rit)
778 y = ys - cellHeight/2;
784 y = ys + cellHeight/2;
825 t <<
"1 " << xf <<
" " << yf <<
" hedge\n";
830 t <<
"0 " << xf <<
" " << yf <<
" hedge\n";
834 ++rit; di=rit.current();
863 t <<
"1 " << xf <<
" " << yf <<
" hedge\n";
867 t <<
"0 " << xf <<
" " << yf <<
" hedge\n";
872 t << xf <<
" " << ysf <<
" " << yf <<
" vedge\n";
876 t << xf <<
" " << (ysf + 0.25) <<
" " << yf <<
" vedge\n";
885 for (;(di=rit.current());++rit)
974 if (first!=last && !first->
isInList())
1021 for (;(cd=cli.current());++cli)
1037 int xbase = baseItem->
xPos();
1038 int xsuper = superItem->
xPos();
1041 superItem->
move(xbase-xsuper,0);
1044 else if (xbase<xsuper)
1046 baseItem->
move(xsuper-xbase,0);
1058 const char *fileName)
const
1062 uint baseMaxX, baseMaxLabelWidth, superMaxX, superMaxLabelWidth;
1066 uint rows=baseRows+superRows-1;
1070 uint estHeight = rows*40;
1071 uint estWidth = cols*(20+QMAX(baseMaxLabelWidth,superMaxLabelWidth));
1074 const float pageWidth = 14.0f;
1079 float realHeight = QMIN(rows,12);
1080 float realWidth = realHeight * estWidth/(float)estHeight;
1081 if (realWidth>pageWidth)
1083 realHeight*=pageWidth/realWidth;
1084 realWidth=pageWidth;
1088 output <<
"\\begin{figure}[H]\n"
1091 output <<
"\\includegraphics[height=" << realHeight <<
"cm]{"
1092 << fileName <<
"}" <<
endl;
1093 output <<
"\\end{center}\n"
1098 QCString epsBaseName=(QCString)path+
"/"+fileName;
1099 QCString epsName=epsBaseName+
".eps";
1101 f1.setName(epsName.data());
1102 if (!f1.open(IO_WriteOnly))
1104 err(
"Could not open file %s for writing\n",f1.name().data());
1113 t <<
"%!PS-Adobe-2.0 EPSF-2.0\n";
1114 t <<
"%%Title: ClassName\n";
1115 t <<
"%%Creator: Doxygen\n";
1116 t <<
"%%CreationDate: Time\n";
1118 t <<
"%Magnification: 1.00\n";
1119 t <<
"%%Orientation: Portrait\n";
1120 t <<
"%%BoundingBox: 0 0 500 " << estHeight*500.0/(float)estWidth <<
"\n";
1121 t <<
"%%Pages: 0\n";
1122 t <<
"%%BeginSetup\n";
1123 t <<
"%%EndSetup\n";
1124 t <<
"%%EndComments\n";
1126 t <<
"% ----- variables -----\n";
1128 t <<
"/boxwidth 0 def\n";
1129 t <<
"/boxheight 40 def\n";
1130 t <<
"/fontheight 24 def\n";
1131 t <<
"/marginwidth 10 def\n";
1132 t <<
"/distx 20 def\n";
1133 t <<
"/disty 40 def\n";
1134 t <<
"/boundaspect " << estWidth/(float)estHeight <<
" def % aspect ratio of the BoundingBox (width/height)\n";
1135 t <<
"/boundx 500 def\n";
1136 t <<
"/boundy boundx boundaspect div def\n";
1137 t <<
"/xspacing 0 def\n";
1138 t <<
"/yspacing 0 def\n";
1139 t <<
"/rows " << rows <<
" def\n";
1140 t <<
"/cols " << cols <<
" def\n";
1141 t <<
"/scalefactor 0 def\n";
1142 t <<
"/boxfont /Times-Roman findfont fontheight scalefont def\n";
1144 t <<
"% ----- procedures -----\n";
1146 t <<
"/dotted { [1 4] 0 setdash } def\n";
1147 t <<
"/dashed { [5] 0 setdash } def\n";
1148 t <<
"/solid { [] 0 setdash } def\n";
1150 t <<
"/max % result = MAX(arg1,arg2)\n";
1152 t <<
" /a exch def\n";
1153 t <<
" /b exch def\n";
1154 t <<
" a b gt {a} {b} ifelse\n";
1157 t <<
"/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)\n";
1159 t <<
" 0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max\n";
1162 t <<
"/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))\n";
1164 t <<
" /str exch def\n";
1165 t <<
" /boxwidth boxwidth str stringwidth pop max def\n";
1168 t <<
"/box % draws a box with text `arg1' at grid pos (arg2,arg3)\n";
1170 t <<
" 2 setlinewidth\n";
1172 t <<
" exch xspacing mul xoffset add\n";
1173 t <<
" exch yspacing mul\n";
1175 t <<
" boxwidth 0 rlineto \n";
1176 t <<
" 0 boxheight rlineto \n";
1177 t <<
" boxwidth neg 0 rlineto \n";
1178 t <<
" 0 boxheight neg rlineto \n";
1179 t <<
" closepath\n";
1180 t <<
" dup stringwidth pop neg boxwidth add 2 div\n";
1181 t <<
" boxheight fontheight 2 div sub 2 div\n";
1182 t <<
" rmoveto show stroke\n";
1188 t <<
" exch xspacing mul xoffset add boxwidth add\n";
1189 t <<
" exch yspacing mul\n";
1191 t <<
" 0 boxheight 4 div rlineto\n";
1192 t <<
" boxheight neg 4 div boxheight neg 4 div rlineto\n";
1193 t <<
" closepath\n";
1201 t <<
" 3 -8 rlineto\n";
1202 t <<
" -6 0 rlineto\n";
1203 t <<
" 3 8 rlineto\n";
1204 t <<
" closepath\n";
1209 t <<
"/out % draws an output connector for the block at (arg1,arg2)\n";
1212 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1213 t <<
" exch yspacing mul boxheight add\n";
1214 t <<
" /y exch def\n";
1215 t <<
" /x exch def\n";
1216 t <<
" x y moveto\n";
1217 t <<
" 0 disty 2 div rlineto \n";
1219 t <<
" 1 eq { x y disty 2 div add arrow } if\n";
1222 t <<
"/in % draws an input connector for the block at (arg1,arg2)\n";
1225 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1226 t <<
" exch yspacing mul disty 2 div sub\n";
1227 t <<
" /y exch def\n";
1228 t <<
" /x exch def\n";
1229 t <<
" x y moveto\n";
1230 t <<
" 0 disty 2 div rlineto\n";
1232 t <<
" 1 eq { x y disty 2 div add arrow } if\n";
1237 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1238 t <<
" exch yspacing mul boxheight 2 div sub\n";
1239 t <<
" /y exch def\n";
1240 t <<
" /x exch def\n";
1242 t <<
" x y moveto\n";
1243 t <<
" boxwidth 2 div distx add 0 rlineto\n";
1246 t <<
" { newpath x boxwidth 2 div distx add add y moveto\n";
1247 t <<
" -8 3 rlineto\n";
1248 t <<
" 0 -6 rlineto\n";
1249 t <<
" 8 3 rlineto\n";
1250 t <<
" closepath\n";
1258 t <<
" /ye exch def\n";
1259 t <<
" /ys exch def\n";
1260 t <<
" /xs exch def\n";
1262 t <<
" xs xspacing mul xoffset add boxwidth 2 div add dup\n";
1263 t <<
" ys yspacing mul boxheight 2 div sub\n";
1265 t <<
" ye yspacing mul boxheight 2 div sub\n";
1270 t <<
"/conn % connections the blocks from col `arg1' to `arg2' of row `arg3'\n";
1272 t <<
" /ys exch def\n";
1273 t <<
" /xe exch def\n";
1274 t <<
" /xs exch def\n";
1276 t <<
" xs xspacing mul xoffset add boxwidth 2 div add\n";
1277 t <<
" ys yspacing mul disty 2 div sub\n";
1279 t <<
" xspacing xe xs sub mul 0\n";
1284 t <<
"% ----- main ------\n";
1286 t <<
"boxfont setfont\n";
1287 t <<
"1 boundaspect scale\n";
1291 QListIterator<DiagramRow> bit(*
base);
1293 for (;(dr=bit.current()) && !done;++bit)
1295 QListIterator<DiagramItem> rit(*dr);
1297 for (;(di=rit.current());++rit)
1300 t <<
"(" << di->
label() <<
") cw\n";
1303 QListIterator<DiagramRow> sit(*
super);
1306 for (;(dr=sit.current()) && !done;++sit)
1308 QListIterator<DiagramItem> rit(*dr);
1310 for (;(di=rit.current());++rit)
1313 t <<
"(" << di->
label() <<
") cw\n";
1317 t <<
"/boxwidth boxwidth marginwidth 2 mul add def\n"
1318 <<
"/xspacing boxwidth distx add def\n"
1319 <<
"/yspacing boxheight disty add def\n"
1320 <<
"/scalefactor \n"
1321 <<
" boxwidth cols mul distx cols 1 sub mul add\n"
1322 <<
" boxheight rows mul disty rows 1 sub mul add boundaspect mul \n"
1324 <<
"boundx scalefactor div boundy scalefactor div scale\n";
1326 t <<
"\n% ----- classes -----\n\n";
1330 t <<
"\n% ----- relations -----\n\n";
1337 QCString epstopdfArgs(4096);
1338 epstopdfArgs.sprintf(
"\"%s.eps\" --outfile=\"%s.pdf\"",
1339 epsBaseName.data(),epsBaseName.data());
1344 err(
"Problems running epstopdf. Check your TeX installation!\n");
1354 const char *relPath,
const char *fileName,
1355 bool generateMap)
const
1359 uint rows=baseRows+superRows-1;
1366 uint maxXPos = QMAX(xb,xs);
1367 uint labelVertMargin = 6;
1368 uint cellHeight = labelVertMargin*2+
fontHeight;
1373 Image image(imageWidth,imageHeight);
1375 base->
drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap);
1376 super->
drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap);
1380 #define IMAGE_EXT ".png"
1381 image.save((QCString)path+
"/"+fileName+
IMAGE_EXT);
1384 if (generateMap) t <<
"</map>" <<
endl;