Add -nodesep and -ranksep options.

(Trustin Lee).
This commit is contained in:
Diomidis Spinellis 2008-08-16 09:32:18 +00:00
parent d8f18b8206
commit 5da653bbf8
3 changed files with 30 additions and 1 deletions

View File

@ -174,6 +174,10 @@ This table is used to resolved external class names (class names that do not
belong to the current package being processed by UMLGraph). If no file is provided,
external classes will just be mapped to the on-line Java API documentation.
</dd>
<dt>-nodesep</dt><dd>Specify the horizontal separation between the class nodes (0.25
by default). Decreasing this can make a diagram more compact.</dd>
<dt>-ranksep</dt><dd>Specify the vertical separation between the class nodes (0.5
by default). Decreasing this can make a diagram more compact.</dd>
<dt>-noguillemot</dt><dd>Specify that guillemot characters should not
be used to denote special terms like "interface" and stereotype names.
This is used on some platforms to circumvent problems associated

View File

@ -1128,8 +1128,11 @@ class ClassGraph {
"\tnode [fontname=\"" + opt.nodeFontName +
"\",fontsize=10,shape=plaintext];"
);
w.println("\tnodesep=" + opt.nodeSep + ";");
w.println("\tranksep=" + opt.rankSep + ";");
if (opt.horizontal)
w.println("\trankdir=LR;\n\tranksep=1;");
w.println("\trankdir=LR;");
if (opt.bgColor != null)
w.println("\tbgcolor=\"" + opt.bgColor + "\";\n");
}

View File

@ -104,6 +104,8 @@ public class Options implements Cloneable, OptionProvider {
boolean useGuillemot;
boolean findViews;
String viewName;
double nodeSep;
double rankSep;
public String outputDirectory;
/*
* Numeric values are preferable to symbolic here.
@ -180,6 +182,8 @@ public class Options implements Cloneable, OptionProvider {
collPackages = new Vector<Pattern>();
compact = false;
relativeLinksForSourcePackages = false;
nodeSep = 0.25;
rankSep = 0.5;
}
public Object clone() {
@ -262,6 +266,8 @@ public class Options implements Cloneable, OptionProvider {
option.equals("-inferreltype") ||
option.equals("-inferdepvis") ||
option.equals("-collpackages") ||
option.equals("-nodesep") ||
option.equals("-ranksep") ||
option.equals("-link"))
return 2;
else if(option.equals("-contextPattern"))
@ -504,6 +510,22 @@ public class Options implements Cloneable, OptionProvider {
}
} else if (opt[0].equals("-nodesep")) {
try {
nodeSep = Double.parseDouble(opt[1]);
} catch (NumberFormatException e) {
System.err.println("Skipping invalid nodesep " + opt[1]);
}
} else if (opt[0].equals("-!nodesep")) {
nodeSep = 0.25;
} else if (opt[0].equals("-ranksep")) {
try {
rankSep = Double.parseDouble(opt[1]);
} catch (NumberFormatException e) {
System.err.println("Skipping invalid ranksep " + opt[1]);
}
} else if (opt[0].equals("-!ranksep")) {
rankSep = 0.5;
} else
; // Do nothing, javadoc will handle the option or complain, if
// needed.