mirror of https://github.com/dspinellis/UMLGraph
Have relation styles in a single place.
This commit is contained in:
parent
fe2c0c3df1
commit
a4ab6f179a
|
|
@ -80,16 +80,7 @@ class ClassGraph {
|
|||
this.lower = toString().toLowerCase();
|
||||
}
|
||||
};
|
||||
public static Map<RelationType, String> associationMap = new HashMap<RelationType, String>();
|
||||
static {
|
||||
associationMap.put(RelationType.ASSOC, "arrowhead=none");
|
||||
associationMap.put(RelationType.NAVASSOC, "arrowhead=open");
|
||||
associationMap.put(RelationType.HAS, "arrowhead=none, arrowtail=ediamond, dir=both");
|
||||
associationMap.put(RelationType.NAVHAS, "arrowhead=open, arrowtail=ediamond, dir=both");
|
||||
associationMap.put(RelationType.COMPOSED, "arrowhead=none, arrowtail=diamond, dir=both");
|
||||
associationMap.put(RelationType.NAVCOMPOSED, "arrowhead=open, arrowtail=diamond, dir=both");
|
||||
associationMap.put(RelationType.DEPEND, "arrowhead=open, style=dashed");
|
||||
}
|
||||
|
||||
protected Map<String, ClassInfo> classnames = new HashMap<String, ClassInfo>();
|
||||
protected Set<String> rootClasses;
|
||||
protected Map<String, ClassDoc> rootClassdocs = new HashMap<String, ClassDoc>();
|
||||
|
|
@ -558,8 +549,7 @@ class ClassGraph {
|
|||
ClassDoc to, String toName, String tailLabel, String label, String headLabel) {
|
||||
|
||||
// print relation
|
||||
String edgetype = associationMap.get(rt);
|
||||
w.println("\t// " + fromName + " " + rt.toString() + " " + toName);
|
||||
w.println("\t// " + fromName + " " + rt.lower + " " + toName);
|
||||
w.println("\t" + relationNode(from, fromName) + " -> " + relationNode(to, toName) + " [" +
|
||||
"taillabel=\"" + tailLabel + "\", " +
|
||||
((label == null || label.isEmpty()) ? "label=\"\", " : "label=\"" + guillemize(opt, label) + "\", ") +
|
||||
|
|
@ -568,7 +558,7 @@ class ClassGraph {
|
|||
"fontcolor=\"" + opt.edgeFontColor + "\", " +
|
||||
"fontsize=" + opt.edgeFontSize + ", " +
|
||||
"color=\"" + opt.edgeColor + "\", " +
|
||||
edgetype + "];"
|
||||
rt.style + "];"
|
||||
);
|
||||
|
||||
// update relation info
|
||||
|
|
@ -624,7 +614,8 @@ class ClassGraph {
|
|||
!hidden(s.asClassDoc())) {
|
||||
ClassDoc sc = s.asClassDoc();
|
||||
w.println("\t//" + c + " extends " + s + "\n" +
|
||||
"\t" + relationNode(sc) + " -> " + relationNode(c) + " [dir=back,arrowtail=empty];");
|
||||
"\t" + relationNode(sc) + " -> " + relationNode(c) +
|
||||
" [" + RelationType.EXTENDS.style + "];");
|
||||
getClassInfo(className).addRelation(sc.toString(), RelationType.EXTENDS, RelationDirection.OUT);
|
||||
getClassInfo(sc.toString()).addRelation(className, RelationType.EXTENDS, RelationDirection.IN);
|
||||
}
|
||||
|
|
@ -634,7 +625,7 @@ class ClassGraph {
|
|||
if (!hidden(tag.text())) {
|
||||
ClassDoc from = c.findClass(tag.text());
|
||||
w.println("\t//" + c + " extends " + tag.text() + "\n" +
|
||||
"\t" + relationNode(from, tag.text()) + " -> " + relationNode(c) + " [dir=back,arrowtail=empty];");
|
||||
"\t" + relationNode(from, tag.text()) + " -> " + relationNode(c) + " [" + RelationType.EXTENDS.style + "];");
|
||||
getClassInfo(className).addRelation(tag.text(), RelationType.EXTENDS, RelationDirection.OUT);
|
||||
getClassInfo(tag.text()).addRelation(className, RelationType.EXTENDS, RelationDirection.IN);
|
||||
}
|
||||
|
|
@ -642,9 +633,8 @@ class ClassGraph {
|
|||
for (Type iface : c.interfaceTypes()) {
|
||||
ClassDoc ic = iface.asClassDoc();
|
||||
if (!hidden(ic)) {
|
||||
w.println("\t//" + c + " implements " + ic + "\n\t" +
|
||||
relationNode(ic) + " -> " + relationNode(c) + " [dir=back,arrowtail=empty,style=dashed];"
|
||||
);
|
||||
w.println("\t//" + c + " implements " + ic + "\n\t" + relationNode(ic) + " -> " + relationNode(c)
|
||||
+ " [" + RelationType.IMPLEMENTS.style + "];");
|
||||
getClassInfo(className).addRelation(ic.toString(), RelationType.IMPLEMENTS, RelationDirection.OUT);
|
||||
getClassInfo(ic.toString()).addRelation(className, RelationType.IMPLEMENTS, RelationDirection.IN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,26 @@
|
|||
package org.umlgraph.doclet;
|
||||
|
||||
/**
|
||||
* The type of relation that links two entities
|
||||
* @author wolf
|
||||
* The type of relation that links two entities, and the graphviz format
|
||||
*
|
||||
* @author Erich Schubert
|
||||
*/
|
||||
public enum RelationType {
|
||||
ASSOC(), NAVASSOC(), HAS(), NAVHAS(), COMPOSED(), NAVCOMPOSED(), DEPEND(), EXTENDS(), IMPLEMENTS();
|
||||
ASSOC("arrowhead=none"), //
|
||||
NAVASSOC("arrowhead=open"), //
|
||||
HAS("arrowhead=none, arrowtail=ediamond, dir=both"), //
|
||||
NAVHAS("arrowhead=open, arrowtail=ediamond, dir=both"), //
|
||||
COMPOSED("arrowhead=none, arrowtail=diamond, dir=both"), //
|
||||
NAVCOMPOSED("arrowhead=open, arrowtail=diamond, dir=both"), //
|
||||
DEPEND("arrowhead=open, style=dashed"), //
|
||||
EXTENDS("arrowtail=empty, dir=back"), //
|
||||
IMPLEMENTS("arrowtail=empty, dir=back, style=dashed");
|
||||
|
||||
public final String lower;
|
||||
public final String lower, style;
|
||||
|
||||
private RelationType() {
|
||||
/** Enum constructors must be private */
|
||||
private RelationType(String style) {
|
||||
this.lower = toString().toLowerCase();
|
||||
this.style = style;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue