-1

In pgf-umlcd manual the composition and aggregation line are 2 side arrowed. How can I draw one side arrowed that looks like-

association types

These association are described in wikipedia class diagram

Torbjørn T.
  • 206,688
alhelal
  • 2,451

1 Answers1

2

You'll need to redefine the \aggregation and \composition macros. Try adding

\renewcommand{\aggregation}[4]
{
\draw[umlcd style, -open diamond] (#1) -- (#4)
node[near end, above]{#2}
node[near end, below]{#3};
}

\renewcommand{\composition}[4]
{
\draw[umlcd style, fill=\umldrawcolor, -diamond] (#1) -- (#4)
node[near end, above]{#2}
node[near end, below]{#3};
}

to the preamble after loading pgf-umlcd. The default arrow tip specifications are open diamond-> and diamond->, respectively, so a diamond at the start of the line and a standard arrow tip at the end. With the above modification you'll get just a diamond at the end. If you need the diamonds at the start, use open diamond- and diamond-

Torbjørn T.
  • 206,688
  • for curiosity, from where you learn the draw command so that you easily change the default behavior? – alhelal Sep 15 '17 at 09:51
  • 1
    @BandaMuhammadAlHelal Ehm, well. \draw is from TikZ, and that package I've learned mainly from its manual and questions/answers on this site. But the code I showed above is simply copied from pgf-umlcd.sty, and then I changed \newcommand to \renewcommand, in addition to the change of the arrow tip specification. – Torbjørn T. Sep 15 '17 at 09:59