78 using Ptr = std::unique_ptr<DiagramItem>;
79 using Vec = std::vector<Ptr>;
103 using Ptr = std::unique_ptr<DiagramRow>;
104 using Vec = std::vector<Ptr>;
112 bool doBase,
bool bitmap,
116 bool generateMap=
TRUE);
118 bool doBase,
bool bitmap,
124 {
m_rows.push_back(std::make_unique<DiagramRow>(
this,l));
return m_rows.back().get(); }
151 case Public:
return 0xffffffff;
154 case Private:
return 0xaaaaaaaa;
175 case Public:
return "solid";
187 case Normal:
return 0xffffffff;
188 case Virtual:
return 0xf0f0f0f0;
197 auto it = dil.begin();
201 result=(*it)->protection();
202 for (++it;it!=dil.end();++it)
208 else if (result==
Private) result=p;
217 bool hasDocs,
bool children=
FALSE)
219 uchar colFill = hasDocs ? (firstRow ? 0 : 2) : 7;
220 uchar colBorder = (firstRow || !hasDocs) ? 1 : 3;
223 image->
fillRect(x+1,y+1,w-2,h-2,colFill,mask);
224 image->
drawRect(x,y,w,h,colBorder,mask);
231 image->
drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff);
237 float x,
float y,
bool children=
FALSE)
241 if (children) t << x <<
" " << y <<
" mark\n";
270 t <<
"\" shape=\"rect\" coords=\"" << x <<
"," << y <<
",";
271 t << (x+w) <<
"," << (y+h) <<
"\"/>\n";
278 : m_parent(p), m_num(number), m_prot(pr), m_virt(vi), m_templSpec(ts), m_classDef(cd)
290 if ( n.
right(2)==
"-p")
341 if (parent) parent->
addChild(di_ptr);
343 m_items.push_back(std::move(di));
351 if (count>0 && (prot!=
Private || !doBases))
369 doBases?bcd.templSpecifiers:
QCString());
379 auto row = std::make_unique<DiagramRow>(
this,0);
410 for (k=children.front()->number();k<row->numItems();k++)
419 for (k=root->
number();k<row->numItems();k++)
425 auto it = children.begin();
426 for (;it!=children.end() && !moved && !(*it)->isInList();++it)
440 const auto &
row = *it;
445 for (
const auto &di : *
row)
448 if (pi==opi && !first) { delta-=
gridWidth; }
464 const auto &
row = *it;
472 while (rit!=
row->
end() && (*rit)->parentItem()==pi)
490 while (it!=
m_rows.end() && !(*it)->item(0)->isInList())
499 const auto &
row = *it;
503 for (
const auto &di : *
row)
505 if (di->parentItem()!=opi) curListLen=1;
else curListLen++;
506 if (curListLen>maxListLen) maxListLen=curListLen;
518 for (
const auto &dr :
m_rows)
521 for (
const auto &di : *dr)
523 if (di->isInList()) done=
TRUE;
524 if (maxXPos) mx=std::max(mx,(
uint)di->xPos());
529 if (maxLabelLen) *maxLabelLen=ml;
530 if (maxXPos) *maxXPos=mx;
534 template<
class C,
class I>
541 if (fwd)
m_it = container.begin();
542 else m_rit = container.rbegin();
569 bool doBase,
bool bitmap,
576 if (it!=
m_rows.end() && !doBase) ++it;
577 bool firstRow = doBase;
579 for (;it!=
m_rows.end() && !done;++it)
581 const auto &dr = *it;
583 float xf=0.0f,yf=0.0f;
601 if (doBase) yf += 1.0f;
613 superRows*cellHeight-
643 if (!firstRow && generateMap)
657 for (
const auto &di : *dr)
665 superRows*cellHeight-
674 bool hasDocs=di->getClassDef()->isLinkable();
675 writeBitmapBox(di.get(),image,x,y,cellWidth,cellHeight,firstRow,hasDocs);
676 if (!firstRow && generateMap)
677 writeMapArea(t,di->getClassDef(),relPath,x,y,cellWidth,cellHeight);
684 yf = di->yPos()/(float)
gridHeight+superRows-1;
688 yf = superRows-1-di->yPos()/(float)
gridHeight;
699 bool doBase,
bool bitmap,
705 for (;it!=
m_rows.end() && !done;++it)
707 const auto &dr = *it;
712 float xf=0.0f,yf=0.0f,ysf=0.0f;
713 auto rit = dr->begin();
714 while (rit!=dr->end())
771 y = ys - cellHeight/2;
777 y = ys + cellHeight/2;
818 t <<
"1 " << xf <<
" " << yf <<
" hedge\n";
823 t <<
"0 " << xf <<
" " << yf <<
" hedge\n";
828 if (rit!=dr->end()) di = (*rit).get();
else di=0;
857 t <<
"1 " << xf <<
" " << yf <<
" hedge\n";
861 t <<
"0 " << xf <<
" " << yf <<
" hedge\n";
866 t << xf <<
" " << ysf <<
" " << yf <<
" vedge\n";
870 t << xf <<
" " << (ysf + 0.25f) <<
" " << yf <<
" vedge\n";
874 if (rit!=dr->end()) ++rit;
880 for (
const auto &di : *dr)
916 t <<
"1 " << di->xPos()/(float)
gridWidth <<
" "
917 << (di->yPos()/(float)
gridHeight+superRows-1) <<
" in\n";
921 t <<
"0 " << di->xPos()/(float)
gridWidth <<
" "
922 << ((
float)superRows-0.25f-di->yPos()/(float)
gridHeight)
956 t <<
"0 " << di->xPos()/(float)
gridWidth <<
" "
957 << (di->yPos()/(float)
gridHeight+superRows-1) <<
" out\n";
961 t <<
"1 " << di->xPos()/(float)
gridWidth <<
" "
962 << ((
float)superRows-1.75f-di->yPos()/(float)
gridHeight)
969 if (first!=last && !first->
isInList())
1025 p->base.computeLayout();
1026 p->super.computeLayout();
1033 superItem->
move((
int)(xbase-xsuper),0);
1034 p->super.moveChildren(superItem,(
int)(xbase-xsuper));
1036 else if (xbase<xsuper)
1038 baseItem->
move((
int)(xsuper-xbase),0);
1039 p->base.moveChildren(baseItem,(
int)(xsuper-xbase));
1050 uint baseRows=
p->base.computeRows();
1051 uint superRows=
p->super.computeRows();
1052 uint baseMaxX, baseMaxLabelWidth, superMaxX, superMaxLabelWidth;
1053 p->base.computeExtremes(&baseMaxLabelWidth,&baseMaxX);
1054 p->super.computeExtremes(&superMaxLabelWidth,&superMaxX);
1056 uint rows=std::max(1u,baseRows+superRows-1);
1060 uint estHeight = rows*40;
1061 uint estWidth = cols*(20+std::max(baseMaxLabelWidth,superMaxLabelWidth));
1064 const float pageWidth = 14.0f;
1069 float realHeight =
static_cast<float>(std::min(rows,12u));
1070 float realWidth = realHeight * estWidth/
static_cast<float>(estHeight);
1071 if (realWidth>pageWidth)
1073 realHeight*=pageWidth/realWidth;
1077 output <<
"\\begin{figure}[H]\n"
1080 output <<
"\\includegraphics[height=" << realHeight <<
"cm]{"
1081 << fileName <<
"}\n";
1082 output <<
"\\end{center}\n"
1088 QCString epsName=epsBaseName+
".eps";
1089 std::ofstream f(epsName.
str(),std::ofstream::out | std::ofstream::binary);
1092 term(
"Could not open file %s for writing\n",
qPrint(epsName));
1102 t <<
"%!PS-Adobe-2.0 EPSF-2.0\n";
1103 t <<
"%%Title: ClassName\n";
1104 t <<
"%%Creator: Doxygen\n";
1105 t <<
"%%CreationDate: Time\n";
1107 t <<
"%Magnification: 1.00\n";
1108 t <<
"%%Orientation: Portrait\n";
1109 t <<
"%%BoundingBox: 0 0 500 " << estHeight*500.0f/(float)estWidth <<
"\n";
1110 t <<
"%%Pages: 0\n";
1111 t <<
"%%BeginSetup\n";
1112 t <<
"%%EndSetup\n";
1113 t <<
"%%EndComments\n";
1115 t <<
"% ----- variables -----\n";
1117 t <<
"/boxwidth 0 def\n";
1118 t <<
"/boxheight 40 def\n";
1119 t <<
"/fontheight 24 def\n";
1120 t <<
"/marginwidth 10 def\n";
1121 t <<
"/distx 20 def\n";
1122 t <<
"/disty 40 def\n";
1123 t <<
"/boundaspect " << estWidth/(float)estHeight <<
" def % aspect ratio of the BoundingBox (width/height)\n";
1124 t <<
"/boundx 500 def\n";
1125 t <<
"/boundy boundx boundaspect div def\n";
1126 t <<
"/xspacing 0 def\n";
1127 t <<
"/yspacing 0 def\n";
1128 t <<
"/rows " << rows <<
" def\n";
1129 t <<
"/cols " << cols <<
" def\n";
1130 t <<
"/scalefactor 0 def\n";
1131 t <<
"/boxfont /Times-Roman findfont fontheight scalefont def\n";
1133 t <<
"% ----- procedures -----\n";
1135 t <<
"/dotted { [1 4] 0 setdash } def\n";
1136 t <<
"/dashed { [5] 0 setdash } def\n";
1137 t <<
"/solid { [] 0 setdash } def\n";
1139 t <<
"/max % result = MAX(arg1,arg2)\n";
1141 t <<
" /a exch def\n";
1142 t <<
" /b exch def\n";
1143 t <<
" a b gt {a} {b} ifelse\n";
1146 t <<
"/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)\n";
1148 t <<
" 0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max\n";
1151 t <<
"/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))\n";
1153 t <<
" /str exch def\n";
1154 t <<
" /boxwidth boxwidth str stringwidth pop max def\n";
1157 t <<
"/box % draws a box with text 'arg1' at grid pos (arg2,arg3)\n";
1159 t <<
" 2 setlinewidth\n";
1161 t <<
" exch xspacing mul xoffset add\n";
1162 t <<
" exch yspacing mul\n";
1164 t <<
" boxwidth 0 rlineto \n";
1165 t <<
" 0 boxheight rlineto \n";
1166 t <<
" boxwidth neg 0 rlineto \n";
1167 t <<
" 0 boxheight neg rlineto \n";
1168 t <<
" closepath\n";
1169 t <<
" dup stringwidth pop neg boxwidth add 2 div\n";
1170 t <<
" boxheight fontheight 2 div sub 2 div\n";
1171 t <<
" rmoveto show stroke\n";
1177 t <<
" exch xspacing mul xoffset add boxwidth add\n";
1178 t <<
" exch yspacing mul\n";
1180 t <<
" 0 boxheight 4 div rlineto\n";
1181 t <<
" boxheight neg 4 div boxheight neg 4 div rlineto\n";
1182 t <<
" closepath\n";
1190 t <<
" 3 -8 rlineto\n";
1191 t <<
" -6 0 rlineto\n";
1192 t <<
" 3 8 rlineto\n";
1193 t <<
" closepath\n";
1198 t <<
"/out % draws an output connector for the block at (arg1,arg2)\n";
1201 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1202 t <<
" exch yspacing mul boxheight add\n";
1203 t <<
" /y exch def\n";
1204 t <<
" /x exch def\n";
1205 t <<
" x y moveto\n";
1206 t <<
" 0 disty 2 div rlineto \n";
1208 t <<
" 1 eq { x y disty 2 div add arrow } if\n";
1211 t <<
"/in % draws an input connector for the block at (arg1,arg2)\n";
1214 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1215 t <<
" exch yspacing mul disty 2 div sub\n";
1216 t <<
" /y exch def\n";
1217 t <<
" /x exch def\n";
1218 t <<
" x y moveto\n";
1219 t <<
" 0 disty 2 div rlineto\n";
1221 t <<
" 1 eq { x y disty 2 div add arrow } if\n";
1226 t <<
" exch xspacing mul xoffset add boxwidth 2 div add\n";
1227 t <<
" exch yspacing mul boxheight 2 div sub\n";
1228 t <<
" /y exch def\n";
1229 t <<
" /x exch def\n";
1231 t <<
" x y moveto\n";
1232 t <<
" boxwidth 2 div distx add 0 rlineto\n";
1235 t <<
" { newpath x boxwidth 2 div distx add add y moveto\n";
1236 t <<
" -8 3 rlineto\n";
1237 t <<
" 0 -6 rlineto\n";
1238 t <<
" 8 3 rlineto\n";
1239 t <<
" closepath\n";
1247 t <<
" /ye exch def\n";
1248 t <<
" /ys exch def\n";
1249 t <<
" /xs exch def\n";
1251 t <<
" xs xspacing mul xoffset add boxwidth 2 div add dup\n";
1252 t <<
" ys yspacing mul boxheight 2 div sub\n";
1254 t <<
" ye yspacing mul boxheight 2 div sub\n";
1259 t <<
"/conn % connections the blocks from col 'arg1' to 'arg2' of row 'arg3'\n";
1261 t <<
" /ys exch def\n";
1262 t <<
" /xe exch def\n";
1263 t <<
" /xs exch def\n";
1265 t <<
" xs xspacing mul xoffset add boxwidth 2 div add\n";
1266 t <<
" ys yspacing mul disty 2 div sub\n";
1268 t <<
" xspacing xe xs sub mul 0\n";
1273 t <<
"% ----- main ------\n";
1275 t <<
"boxfont setfont\n";
1276 t <<
"1 boundaspect scale\n";
1279 for (
const auto &dr :
p->base)
1282 for (
const auto &di : *dr)
1284 done=di->isInList();
1290 auto it =
p->super.begin();
1291 if (it!=
p->super.end()) ++it;
1292 for (;it!=
p->super.end();++it)
1294 const auto &dr = *it;
1296 for (
const auto &di : *dr)
1298 done=di->isInList();
1304 t <<
"/boxwidth boxwidth marginwidth 2 mul add def\n"
1305 <<
"/xspacing boxwidth distx add def\n"
1306 <<
"/yspacing boxheight disty add def\n"
1307 <<
"/scalefactor \n"
1308 <<
" boxwidth cols mul distx cols 1 sub mul add\n"
1309 <<
" boxheight rows mul disty rows 1 sub mul add boundaspect mul \n"
1311 <<
"boundx scalefactor div boundy scalefactor div scale\n";
1313 t <<
"\n% ----- classes -----\n\n";
1314 p->base.drawBoxes(t,0,
TRUE,
FALSE,baseRows,superRows,0,0);
1315 p->super.drawBoxes(t,0,
FALSE,
FALSE,baseRows,superRows,0,0);
1317 t <<
"\n% ----- relations -----\n\n";
1318 p->base.drawConnectors(t,0,
TRUE,
FALSE,baseRows,superRows,0,0);
1319 p->super.drawConnectors(t,0,
FALSE,
FALSE,baseRows,superRows,0,0);
1327 epstopdfArgs.
sprintf(
"\"%s.eps\" --outfile=\"%s.pdf\"",
1333 err(
"Problems running epstopdf. Check your TeX installation!\n");
1344 bool generateMap)
const
1346 uint baseRows=
p->base.computeRows();
1347 uint superRows=
p->super.computeRows();
1348 uint rows=baseRows+superRows-1;
1351 p->base.computeExtremes(&lb,&xb);
1352 p->super.computeExtremes(&ls,&xs);
1355 uint maxXPos = std::max(xb,xs);
1356 uint labelVertMargin = 6;
1362 Image image(imageWidth,imageHeight);
1364 p->base.drawBoxes(t,&image,
TRUE,
TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap);
1365 p->super.drawBoxes(t,&image,
FALSE,
TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap);
1366 p->base.drawConnectors(t,&image,
TRUE,
TRUE,baseRows,superRows,cellWidth,cellHeight);
1367 p->super.drawConnectors(t,&image,
FALSE,
TRUE,baseRows,superRows,cellWidth,cellHeight);
1369 #define IMAGE_EXT ".png"