3

I'm using the Tikz-Uml package, and I keep getting overlapping dashed lines when multiple classes implement the same interface:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-uml}

\begin{document}

\begin{tikzpicture}
    \umlclass[x=-4, y=0]{First}{}{
        \umlvirt{+execute(): bool}
    }

    \umlclass[x=-4, y=-4, type=abstract]{Second}{}{
        \umlvirt{+execute(): bool}
    }

    \umlclass[x=2, y=-4]{Third}{}{
        +execute(): bool \\
    }

    \umlclass[x=2, y=-6]{Fourth}{}{
        +execute(): bool \\
    }

    \umlclass[x=2, y=-8]{Fifth}{}{
        +execute(): bool \\
    }

    \umlimpl{Third}{Second}
    \umlHVHimpl[anchors=west and east]{Fourth}{Second}
    \umlHVHimpl[anchors=west and east]{Fifth}{Second}
\end{tikzpicture}

\end{document}

results with:

enter image description here

How can I avoid overlapping dashed lines in associacions for the Fourth and the Fifth class?

1
  • This is a problem when using dependency, import and implements relations in tikz-uml. Personally, I did not find how to do it properly and when needed, I do it manually. Sure it is ugly, but it works. Mar 11, 2016 at 11:45

1 Answer 1

2

I think that can be solved manually, playing with the position of UML elements. Maybe this is a ugly way but useful.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-uml}
\begin{document}
    \begin{tikzpicture}
        \umlclass[x=-4, y=0]{First}{}{
            \umlvirt{+execute(): bool}
        }
        \umlclass[x=-4, y=-4, type=abstract]{Second}{}{
            \umlvirt{+execute(): bool}
        }
        \umlclass[x=2, y=-4]{Third}{}{
            +execute(): bool \\
        }
        \umlclass[x=2, y=-6.1]{Fourth}{}{%previous y - 0.1
            +execute(): bool \\
        }
        \umlclass[x=2, y=-8.2]{Fifth}{}{%previous y - 0.2
            +execute(): bool \\
        }
        \umlimpl{Third}{Second}
        \umlHVHimpl[anchors=west and east]{Fourth}{Second}
        \umlHVHimpl[anchors=west and east]{Fifth}{Second}
    \end{tikzpicture}
\end{document}

Result

enter image description here

1
  • Hi, didn't have time to try this until now. I still get an overlap at between Third and Second class...
    – tmaric
    Nov 28, 2013 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.