1

I am using tikz-uml, but it seems there is not UML nesting relationship. I am not very good with tikz could you help me how I can implement it. You can see how it should look here at the end under title "Nestings".

For example, here is how aggregations is implemented

\tikzstyle{tikzuml aggregation style}=[color=\tikzumldrawcolor, open diamond-]%
\newcommand{\umlaggreg}[3][]{\umlrelation[style={tikzuml aggregation style}, #1]{#2}{#3}}%
3
  • 1
    Please post a complete example of a document - especially crucial with TiKZ questions given all the libraries and such - and explain what you are trying to do. I'm afraid that your question is currently extremely unclear.
    – cfr
    Commented Apr 27, 2015 at 0:08
  • I am sorry but it seems like you don't understand what is the question about. The same I do not understand what is not unclear here. What complete example should I post, if I knew how to do that I would not ask a question? The situation is that there is the UML drawing package based on tikz package, called tikz-uml. In UML drawings there is a type of relationships called nesting. It looks like it on diagram in the provided link in my post. There is no a possibility to draw this relationships in tikz-uml. How can I implement it?
    – user14416
    Commented Apr 27, 2015 at 0:35
  • We do not want to set up the whole problem for you. Give us some code which starts with a \documentclass{ and ends with \end{document}. It does not have to compile (if you do not manage that) but at least save us from typing too much code and from guessing around. And please put more information to your post. What have you tried, where did you get stuck, what exactly would you like to get. Right now, it is just a snippet and two external links I am not willing to klick for safety reasons.
    – LaRiFaRi
    Commented Aug 17, 2015 at 9:30

2 Answers 2

1

I had the same problem with tikz-uml and I used the following approach. The tikzset option was taken over from this answer.

\tikzset{cross/.style={cross out, draw=black,
         minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt},
         %default radius will be 1pt. 
         cross/.default={1pt}}

\begin{tikzpicture}    
  \begin{umlpackage}{Package}
    \umlclass{Class}
    {
    }
    {
      + <<Creator>> Class()
    }        

    \umlclass[y=-3]{InnerClass}
    {
    }
    {
      + <<Creator>> InnerClass()
    }

    \node[circle, scale=0.5, minimum size =2pt,
          draw] (Nested) at (0, -0.7) {};
    \draw (0, -0.7) node[cross=2pt,rotate=45]{};
    \draw (InnerClass.north) -- (Nested.south);
  \end{umlpackage}
\end{tikzpicture}  

This produces the following diagram:

Nested class

1

I will make a new release of tikz-uml soon and add this new relation. It will be called \umlnesting

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .