/// <summary> /// Outputs a list of the relations that this class has toward other classes. /// </summary> /// <param name="builder">the stringbuilder to render to</param> /// <returns></returns> public StringBuilder OutputRelations(StringBuilder builder) { foreach (var use in Uses.Where(u => u.Relevant)) { //Do not pretend to be 'using' a type that is equal to the inheriting types. if (Inherits.Any(i => i.TypeName == use.TypeName)) { continue; //don't output if using superclass, this is not a useful notation. } //Todo: any reference to a complex type (i.e. class) tends to get displayed as a compound reference when it is a member in\ //the class; this is not a correct logic; needs to be expanded for example by checking the contents of the 'refid' in question (if it is nested, it //could probably be assumed to be a more than one relationship; i.e. composition) use.Compound = false; string arrowhead; if (use.Compound) { arrowhead = "arrowhead=odiamond"; builder.AppendLine($@"""{ use.TypeName.NoNameSpaces()}""->""{Name.NoNameSpaces()}"" [{arrowhead} {(use.node is InterfaceNode ? "style =dashed" : "")} label=""{use.DeclaredName.NoNameSpaces()}"" ]"); } else { arrowhead = "arrowhead = normal"; builder.AppendLine($@"""{ Name.NoNameSpaces()}""->""{use.TypeName.NoNameSpaces()}"" [{arrowhead} {(use.node is InterfaceNode ? "style =dashed" : "")} label=""{use.DeclaredName.NoNameSpaces()}"" ]"); } //Create the actual arrow from this node to the used one, if the used node is an interface, make the line dashed to indicate dependency } foreach (var inheritee in Inherits) { builder.AppendLine(@" edge [arrowtail = ""empty"" ]"); builder.AppendLine($"\"{inheritee.TypeName.NoNameSpaces()}\"->\"{Name.NoNameSpaces()}\" [{ (inheritee.node is InterfaceNode ? "style=dashed" : "style=solid")} { (inheritee == null ? ", label=\"??\"" : " ") } dir=back ]"); } return(builder); }