diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-06-23 09:46:45 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-06-23 09:46:45 (GMT) |
commit | c454a5400393a54586d81517c42f7419b43b3f23 (patch) | |
tree | c485ad24b61429cd10455b2d438236483a47c189 /src/dot.cpp | |
parent | 784e2b65dc675f89c8f21b3c7b306f5fb1bfa4ca (diff) | |
download | Doxygen-c454a5400393a54586d81517c42f7419b43b3f23.zip Doxygen-c454a5400393a54586d81517c42f7419b43b3f23.tar.gz Doxygen-c454a5400393a54586d81517c42f7419b43b3f23.tar.bz2 |
Release-1.2.16-20020623
Diffstat (limited to 'src/dot.cpp')
-rw-r--r-- | src/dot.cpp | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/src/dot.cpp b/src/dot.cpp index 478de8a..ef0e053 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -1221,66 +1221,67 @@ static void findMaximalDotGraph(DotNode *root, bool backArrows=TRUE ) { - bool lastFit; - int minDistance=1; - int maxDistance=maxDist; - int curDistance=maxDistance; + int minDistance=1; // min distance that shows only direct children. + int curDistance=2; // current distance to try + int maxDistance=maxDist; // max distance that show whole graph int width=0; int height=0; + int maxDotGraphWidth = Config_getInt("MAX_DOT_GRAPH_WIDTH"); + int maxDotGraphHeight = Config_getInt("MAX_DOT_GRAPH_HEIGHT"); // binary search for the maximal inheritance depth that fits in a reasonable // sized image (dimensions: Config_getInt("MAX_DOT_GRAPH_WIDTH"), Config_getInt("MAX_DOT_GRAPH_HEIGHT")) - do + if (maxDistance>1) { - writeDotGraph(root,format,baseName,lrRank,renderParents, - curDistance,backArrows); - - QCString dotArgs(4096); - // create annotated dot file - dotArgs.sprintf("-Tdot \"%s.dot\" -o \"%s_tmp.dot\"",baseName.data(),baseName.data()); - if (iSystem(Config_getString("DOT_PATH")+"dot",dotArgs)!=0) + do { - err("Problems running dot. Check your installation!\n"); - return; - } + writeDotGraph(root,format,baseName,lrRank,renderParents, + curDistance,backArrows); - // extract bounding box from the result - readBoundingBoxDot(baseName+"_tmp.dot",&width,&height); - width = width *96/72; // 96 pixels/inch, 72 points/inch - height = height*96/72; // 96 pixels/inch, 72 points/inch - //printf("Found bounding box (%d,%d) max (%d,%d)\n",width,height, - // Config_getInt("MAX_DOT_GRAPH_WIDTH"),Config_getInt("MAX_DOT_GRAPH_HEIGHT")); - - lastFit=(width<Config_getInt("MAX_DOT_GRAPH_WIDTH") && height<Config_getInt("MAX_DOT_GRAPH_HEIGHT")); - if (lastFit) // image is small enough - { - minDistance=curDistance; - //printf("Image fits [%d-%d]\n",minDistance,maxDistance); - } - else - { - maxDistance=curDistance; - //printf("Image does not fit [%d-%d]\n",minDistance,maxDistance); - } - curDistance=minDistance+(maxDistance-minDistance)/2; - //printf("curDistance=%d\n",curDistance); - - // remove temporary dot file - thisDir.remove(baseName+"_tmp.dot"); - - } while ((maxDistance-minDistance)>1); + QCString dotArgs(4096); + // create annotated dot file + dotArgs.sprintf("-Tdot \"%s.dot\" -o \"%s_tmp.dot\"",baseName.data(),baseName.data()); + if (iSystem(Config_getString("DOT_PATH")+"dot",dotArgs)!=0) + { + err("Problems running dot. Check your installation!\n"); + return; + } - if (!lastFit) - { - writeDotGraph(root, + // extract bounding box from the result + readBoundingBoxDot(baseName+"_tmp.dot",&width,&height); + width = width *96/72; // 96 pixels/inch, 72 points/inch + height = height*96/72; // 96 pixels/inch, 72 points/inch + //printf("Found bounding box (%d,%d) max (%d,%d)\n",width,height, + // Config_getInt("MAX_DOT_GRAPH_WIDTH"),Config_getInt("MAX_DOT_GRAPH_HEIGHT")); + + // remove temporary dot file + thisDir.remove(baseName+"_tmp.dot"); + + bool graphFits=(width<maxDotGraphWidth && height<maxDotGraphHeight); + if (graphFits) // graph is small enough + { + minDistance=curDistance; + //printf("Image fits [%d-%d]\n",minDistance,maxDistance); + } + else // graph does not fit anymore with curDistance + { + //printf("Image does not fit [%d-%d]\n",minDistance,maxDistance); + maxDistance=curDistance; + } + curDistance=minDistance+(maxDistance-curDistance)/2; + //printf("curDistance=%d\n",curDistance); + + } while ((maxDistance-minDistance)>1); + } + + writeDotGraph(root, format, baseName, - lrRank || (curDistance==1 && width>Config_getInt("MAX_DOT_GRAPH_WIDTH")), + lrRank || (minDistance==1 && width>Config_getInt("MAX_DOT_GRAPH_WIDTH")), renderParents, minDistance, backArrows ); - } } QCString DotClassGraph::diskName() const |