[Tex/LaTex] How to redirect associations in the tikz-uml package

tikz-pgftikz-uml

I am using the tikz-uml package to model a class diagram.

The code snippet is placed in the examples sub-directory of the downloaded tikz-uml package.

Here is the code:

\documentclass[a4paper,11pt, svgnames]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{listings}

\usepackage{../tikz-uml}

\textwidth 18.5cm
\textheight 25.5cm
\hoffset=-2.9cm
\voffset=-2.9cm

\sloppy
\hyphenpenalty 10000000

\date{}
\title{}
\author{}

\begin{document}

\begin{tikzpicture}
    \begin{umlpackage}{First}
        \begin{umlpackage}{Second}
            \umlemptyclass[type=abstract]{F}
            \umlemptyclass[y=-3, type=abstract]{M}
            \umlimpl{M}{F}

            \umlemptyclass[y=-3, x = 6]{P}
            \umlemptyclass[y=-6, x = 6]{H}
            \umlimpl{P}{M}
            \umlunicompo[pos1=1.9, pos2=0.2]{P}{M}
            \umlinherit{H}{P}
        \end{umlpackage}
    \end{umlpackage}
\end{tikzpicture}

\end{document}

and it results with the following diagram:

Composition and implementation

The association lines between P and M are overlapping.
I would like to redirect the composition line (black diamond) between P and M, so that the line is parallel to the implementation line (empty arrow), only placed above it. I tried reading the documentation, but whatever I do fails. Any help?

Best Answer

By default, anchors for associations links are placed between entities' centers. But you can change them with anchor options. You can fix anchor1=...andanchor2=...or both with same optionanchors= ... and ...`

What you need is:

\umlunicompo[anchors=150 and 30]{P}{M}

or

\umlunicompo[anchor1=150, anchor2=30]{P}{M}

You'll find more information in section To modify the anchor points of a relation in Tikz-UML documentation

Related Question