52 void move(
int dx,
int dy) {
x+=dx;
y+=dy; }
116 void computeLayout();
122 bool doBase,
bool bitmap,
126 bool generateMap=
TRUE);
128 bool doBase,
bool bitmap,
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;
215 for (++it;(di=it.
current());++it)
228 int x,
int y,
int w,
int h,
bool firstRow,
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);
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)
280 t <<
"\" shape=\"rect\" coords=\"" << x <<
"," << y <<
",";
281 t << (x+
w) <<
"," << (y+h) <<
"\"/>" <<
endl;
314 if ( n.
right(2)==
"-p")
381 if (count>0 && (prot!=
Private || !doBases))
384 if (diagram->count()<=
level+1)
387 diagram->append(row);
443 int pPos=root->
xPos();
451 row->
at(k)->
move(pPos-cPos,0);
460 row->
at(k)->
move(cPos-pPos,0);
469 moved = layoutTree(di,r+1);
488 for (;(di=rit.
current());++rit)
491 if (pi==opi && !first) { delta-=
gridWidth; }
502 while (layoutTree(root,0)) { }
543 for (;(di=rit.
current());++rit)
545 if (di->
parentItem()!=opi) curListLen=1;
else curListLen++;
546 if (curListLen>maxListLen) maxListLen=curListLen;
561 for (;(dr=it.
current()) && !done;++it)
565 for (;(di=rit.
current());++rit)
572 if (maxLabelLen) *maxLabelLen=ml;
573 if (maxXPos) *maxXPos=mx;
577 bool doBase,
bool bitmap,
587 bool firstRow = doBase;
588 for (;(dr=it.
current()) && !done;++it)
591 float xf=0.0f,yf=0.0f;
609 if (doBase) yf += 1.0f;
621 superRows*cellHeight-
651 if (!firstRow && generateMap)
659 if (doBase) --rit;
else ++rit;
673 superRows*cellHeight-
684 if (!firstRow && generateMap)
707 bool doBase,
bool bitmap,
714 for (;(dr=it.
current()) && !done;++it)
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";
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)
1031 base->computeLayout();
1034 super->computeLayout();
1036 DiagramItem *superItem = super->getFirst()->getFirst();
1037 int xbase = baseItem->
xPos();
1038 int xsuper = superItem->
xPos();
1041 superItem->
move(xbase-xsuper,0);
1042 super->moveChildren(superItem,xbase-xsuper);
1044 else if (xbase<xsuper)
1046 baseItem->
move(xsuper-xbase,0);
1047 base->moveChildren(baseItem,xsuper-xbase);
1061 uint superRows=super->computeRows();
1062 uint baseMaxX, baseMaxLabelWidth, superMaxX, superMaxLabelWidth;
1063 base->computeExtremes(&baseMaxLabelWidth,&baseMaxX);
1064 super->computeExtremes(&superMaxLabelWidth,&superMaxX);
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" 1099 QCString epsName=epsBaseName+
".eps";
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";
1293 for (;(dr=bit.
current()) && !done;++bit)
1297 for (;(di=rit.
current());++rit)
1300 t <<
"(" << di->
label() <<
") cw\n";
1306 for (;(dr=sit.
current()) && !done;++sit)
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";
1328 super->drawBoxes(t,0,
FALSE,
FALSE,baseRows,superRows,0,0);
1330 t <<
"\n% ----- relations -----\n\n";
1331 base->drawConnectors(t,0,
TRUE,
FALSE,baseRows,superRows,0,0);
1332 super->drawConnectors(t,0,
FALSE,
FALSE,baseRows,superRows,0,0);
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 1358 uint superRows=super->computeRows();
1359 uint rows=baseRows+superRows-1;
1362 base->computeExtremes(&lb,&xb);
1363 super->computeExtremes(&ls,&xs);
1367 uint labelVertMargin = 6;
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);
1377 base->drawConnectors(t,&image,
TRUE,
TRUE,baseRows,superRows,cellWidth,cellHeight);
1378 super->drawConnectors(t,&image,
FALSE,
TRUE,baseRows,superRows,cellWidth,cellHeight);
1380 #define IMAGE_EXT ".png" 1384 if (generateMap) t <<
"</map>" <<
endl;
void computeExtremes(uint *labelWidth, uint *xpos)
QCString convertToXML(const char *s)
void move(int dx, int dy)
DiagramRowIterator(const QList< DiagramRow > &d)
void portable_sysTimerStop()
static uint protToColor(Protection p)
ClassDiagram(ClassDef *root)
void fillRect(int x, int y, int width, int height, uchar colIndex, uint mask)
DiagramItem(DiagramItem *p, int number, ClassDef *cd, Protection prot, Specifier virt, const char *ts)
BaseClassList * subClasses() const
void writeFigure(FTextStream &t, const char *path, const char *file) const
void append(const type *d)
static QCString htmlFileExtension
void drawHorzArrow(int y, int xs, int xe, uchar colIndex, uint mask)
static Protection getMinProtectionLevel(DiagramItemList *dil)
void drawHorzLine(int y, int xs, int xe, uchar colIndex, uint mask)
ClassDef * getClassDef() const
friend uint stringLength(const char *s)
Protection protection() const
DiagramRow(TreeDiagram *d, int l)
QCString fileName() const
QCString left(uint len) const
Simplified and optimized version of QTextStream.
QCString displayName(bool includeScope=TRUE) const
void setName(const QString &name)
QCString getReference() const
void insertClass(DiagramItem *parent, ClassDef *cd, bool doBases, Protection prot, Specifier virt, const char *ts)
void writeString(int x, int y, const char *s, uchar fg)
void portable_sysTimerStart()
DiagramItem * parentItem()
const uint labelHorMargin
static void writeBitmapBox(DiagramItem *di, Image *image, int x, int y, int w, int h, bool firstRow, bool hasDocs, bool children=FALSE)
static QCString protToString(Protection p)
const char * data() const
void drawConnectors(FTextStream &t, Image *image, bool doBase, bool bitmap, uint baseRows, uint superRows, uint cellWidth, uint cellheight)
const QCString & name() const
void writeImage(FTextStream &t, const char *path, const char *relPath, const char *file, bool generateMap=TRUE) const
QCString convertToHtml(const char *s, bool keepEntities)
QCString right(uint len) const
void drawRect(int x, int y, int width, int height, uchar colIndex, uint mask)
const uint labelHorSpacing
A bunch of utility functions.
const char * data() const
void addImageFile(const char *name)
Specifier virtualness() const
#define Config_getBool(val)
void err(const char *fmt,...)
DiagramItemList * getChildren()
static void writeMapArea(FTextStream &t, ClassDef *cd, QCString relPath, int x, int y, int w, int h)
The QFile class is an I/O device that operates on files.
QCString & sprintf(const char *format,...)
QCString getOutputFileBase() const
static uint virtToMask(Specifier p)
bool isVisibleInHierarchy()
void drawBoxes(FTextStream &t, Image *image, bool doBase, bool bitmap, uint baseRows, uint superRows, uint cellWidth, uint cellHeight, QCString relPath="", bool generateMap=TRUE)
QCString stripScope(const char *name)
void drawVertArrow(int x, int ys, int ye, uchar colIndex, uint mask)
QCString insertTemplateSpecifierInScope(const QCString &scope, const QCString &templ)
void drawVertLine(int x, int ys, int ye, uchar colIndex, uint mask)
static uint protToMask(Protection p)
TreeDiagram(ClassDef *root, bool doBases)
QCString briefDescriptionAsTooltip() const
static void writeVectorBox(FTextStream &t, DiagramItem *di, float x, float y, bool children=FALSE)
void addChild(DiagramItem *di)
static constexpr double ys
bool layoutTree(DiagramItem *root, int row)
DiagramItemList * children
static ClassSDict * classSDict
QCString externalLinkTarget()
void moveChildren(DiagramItem *root, int dx)
static IndexList * indexList
Portable versions of functions that are platform dependent.
const uint labelVertSpacing
QTextStream & endl(QTextStream &s)
BaseClassList * baseClasses() const
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
int portable_system(const char *command, const char *args, bool commandHasConsole)