My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions | Variables
diagram.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <qlist.h>
#include <qarray.h>
#include "ftextstream.h"
#include <qfile.h>
#include "diagram.h"
#include "image.h"
#include "classdef.h"
#include "config.h"
#include "message.h"
#include "util.h"
#include "doxygen.h"
#include "portable.h"
#include "index.h"
#include "classlist.h"

Go to the source code of this file.

Classes

class  DiagramItem
 
class  DiagramItemList
 
class  DiagramRow
 
class  DiagramRowIterator
 
class  TreeDiagram
 

Macros

#define IMAGE_EXT   ".png"
 

Functions

static uint protToMask (Protection p)
 
static uint protToColor (Protection p)
 
static QCString protToString (Protection p)
 
static uint virtToMask (Specifier p)
 
static Protection getMinProtectionLevel (DiagramItemList *dil)
 
static void writeBitmapBox (DiagramItem *di, Image *image, int x, int y, int w, int h, bool firstRow, bool hasDocs, bool children=FALSE)
 
static void writeVectorBox (FTextStream &t, DiagramItem *di, float x, float y, bool children=FALSE)
 
static void writeMapArea (FTextStream &t, ClassDef *cd, QCString relPath, int x, int y, int w, int h)
 
void clearVisitFlags ()
 

Variables

const uint maxTreeWidth = 8
 
const int gridWidth = 100
 
const int gridHeight = 100
 
const uint labelHorSpacing = 10
 
const uint labelVertSpacing = 32
 
const uint labelHorMargin = 6
 
const uint fontHeight = 12
 

Macro Definition Documentation

#define IMAGE_EXT   ".png"

Function Documentation

void clearVisitFlags ( )

Definition at line 1017 of file diagram.cpp.

References Doxygen::classSDict, SDict< ClassDef >::Iterator, and ClassDef::visited.

Referenced by ClassDiagram::ClassDiagram().

{
ClassDef *cd;
for (;(cd=cli.current());++cli)
{
cd->visited=FALSE;
}
}
static Protection getMinProtectionLevel ( DiagramItemList dil)
static

Definition at line 210 of file diagram.cpp.

References Private, Protected, DiagramItem::protection(), and Public.

Referenced by TreeDiagram::drawConnectors().

{
QListIterator<DiagramItem> it(*dil);
DiagramItem *di=it.current();
Protection result=di->protection();
for (++it;(di=it.current());++it)
{
if (p!=result)
{
if (result==Protected && p==Public) result=p;
else if (result==Private) result=p;
}
}
return result;
}
static uint protToColor ( Protection  p)
static

Definition at line 174 of file diagram.cpp.

References Package, Private, Protected, and Public.

Referenced by TreeDiagram::drawConnectors().

{
switch(p)
{
case Public: return 6;
case Package: // package is not possible!
case Protected: return 5;
case Private: return 4;
}
return 0;
}
static uint protToMask ( Protection  p)
static

Definition at line 162 of file diagram.cpp.

References Package, Private, Protected, and Public.

Referenced by TreeDiagram::drawConnectors().

{
switch(p)
{
case Public: return 0xffffffff;
case Package: // package is not possible!
case Protected: return 0xcccccccc;
case Private: return 0xaaaaaaaa;
}
return 0;
}
static QCString protToString ( Protection  p)
static

Definition at line 186 of file diagram.cpp.

References Package, Private, Protected, and Public.

Referenced by TreeDiagram::drawConnectors().

{
switch(p)
{
case Public: return "solid";
case Package: // package is not possible!
case Protected: return "dashed";
case Private: return "dotted";
}
return 0;
}
static uint virtToMask ( Specifier  p)
static

Definition at line 198 of file diagram.cpp.

References Normal, and Virtual.

Referenced by writeBitmapBox().

{
switch(p)
{
case Normal: return 0xffffffff;
case Virtual: return 0xf0f0f0f0;
default: return 0;
}
return 0;
}
static void writeBitmapBox ( DiagramItem di,
Image image,
int  x,
int  y,
int  w,
int  h,
bool  firstRow,
bool  hasDocs,
bool  children = FALSE 
)
static

Definition at line 227 of file diagram.cpp.

References Image::drawHorzLine(), Image::drawRect(), Image::fillRect(), fontHeight, DiagramItem::label(), Image::stringLength, virtToMask(), DiagramItem::virtualness(), and Image::writeString().

Referenced by TreeDiagram::drawBoxes().

{
int colFill = hasDocs ? (firstRow ? 0 : 2) : 7;
int colBorder = (firstRow || !hasDocs) ? 1 : 3;
int l = Image::stringLength(di->label());
uint mask=virtToMask(di->virtualness());
image->fillRect(x+1,y+1,w-2,h-2,colFill,mask);
image->drawRect(x,y,w,h,colBorder,mask);
image->writeString(x+(w-l)/2, y+(h-fontHeight)/2, di->label(),1);
if (children)
{
int i;
for (i=0;i<5;i++)
image->drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff);
}
}
static void writeMapArea ( FTextStream t,
ClassDef cd,
QCString  relPath,
int  x,
int  y,
int  w,
int  h 
)
static

Definition at line 255 of file diagram.cpp.

References ClassDef::anchor(), Definition::briefDescriptionAsTooltip(), convertToHtml(), convertToXML(), ClassDef::displayName(), endl(), externalLinkTarget(), externalRef(), ClassDef::getOutputFileBase(), ClassDef::getReference(), Doxygen::htmlFileExtension, and ClassDef::isLinkable().

Referenced by TreeDiagram::drawBoxes().

{
if (cd->isLinkable())
{
QCString ref=cd->getReference();
t << "<area ";
if (!ref.isEmpty())
{
t << externalLinkTarget() << externalRef(relPath,ref,FALSE);
}
t << "href=\"";
t << externalRef(relPath,ref,TRUE);
if (!cd->anchor().isEmpty())
{
t << "#" << cd->anchor();
}
t << "\" ";
QCString tooltip = cd->briefDescriptionAsTooltip();
if (!tooltip.isEmpty())
{
t << "title=\"" << convertToHtml(tooltip) << "\" ";
}
t << "alt=\"" << convertToXML(cd->displayName());
t << "\" shape=\"rect\" coords=\"" << x << "," << y << ",";
t << (x+w) << "," << (y+h) << "\"/>" << endl;
}
}
static void writeVectorBox ( FTextStream t,
DiagramItem di,
float  x,
float  y,
bool  children = FALSE 
)
static

Definition at line 246 of file diagram.cpp.

References DiagramItem::label(), Virtual, and DiagramItem::virtualness().

Referenced by TreeDiagram::drawBoxes().

{
if (di->virtualness()==Virtual) t << "dashed\n";
t << " (" << di->label() << ") " << x << " " << y << " box\n";
if (children) t << x << " " << y << " mark\n";
if (di->virtualness()==Virtual) t << "solid\n";
}

Variable Documentation

const uint fontHeight = 12

Definition at line 148 of file diagram.cpp.

Referenced by writeBitmapBox(), and ClassDiagram::writeImage().

const int gridHeight = 100
const int gridWidth = 100
const uint labelHorMargin = 6

Definition at line 147 of file diagram.cpp.

Referenced by ClassDiagram::writeImage().

const uint labelHorSpacing = 10
const uint labelVertSpacing = 32
const uint maxTreeWidth = 8

Definition at line 141 of file diagram.cpp.

Referenced by TreeDiagram::computeLayout().