3

I'd like to create the kind of arrow that shows inner classes in UML, that is, an arrow that starts with an \oplus symbol as it can be seen here: http://myumlnotes.blogspot.com.es/2007/01/inner-class.html with Tikz.

enter image description here

Anyone could help me define that arrow? Something like \pgfarrowsdeclare{OPLUS arrow}{OPLUS arrow} could be perfect

4

You can use the definition of the o arrows and add the plus with:

  \pgfpathmoveto{\pgfqpoint{0bp}{0bp}}%
  \pgfpathlineto{\pgfqpoint{9\pgfutil@tempdima}{0bp}}%
  \pgfpathmoveto{\pgfqpoint{4.5\pgfutil@tempdima}{4.5\pgfutil@tempdima}}%
  \pgfpathlineto{\pgfqpoint{4.5\pgfutil@tempdima}{-4.5\pgfutil@tempdima}}%

The backgrounds library and its gridded option is only used to show where TikZ places the arrows.

Code

\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{backgrounds}
\makeatletter
\pgfarrowsdeclare{oplus}{oplus}{%
  \pgfarrowsleftextend{+-.5\pgflinewidth}
  \pgfutil@tempdima=0.4pt%
  \advance\pgfutil@tempdima by.2\pgflinewidth%
  \pgfutil@tempdimb=9\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth
  \pgfarrowsrightextend{+\pgfutil@tempdimb}%
}{%
  \pgfutil@tempdima=0.4pt%
  \advance\pgfutil@tempdima by.2\pgflinewidth%
  \pgfsetdash{}{+0pt}%
  \pgfpathcircle{\pgfqpoint{4.5\pgfutil@tempdima}{0bp}}{4.5\pgfutil@tempdima}%
  \pgfpathmoveto{\pgfqpoint{0bp}{0bp}}%
  \pgfpathlineto{\pgfqpoint{9\pgfutil@tempdima}{0bp}}%
  \pgfpathmoveto{\pgfqpoint{4.5\pgfutil@tempdima}{4.5\pgfutil@tempdima}}%
  \pgfpathlineto{\pgfqpoint{4.5\pgfutil@tempdima}{-4.5\pgfutil@tempdima}}%
  \pgfusepathqstroke
}
\makeatother
\begin{document}
\tikz[gridded]\draw[oplus-oplus] (0,0) -- +(right:1) -- +(up:1);
\end{document}

Output

enter image description here

1
  • Thank you so much, that what's exactly what I was looking for :) If I had to do any remark would be to put the \pgfutil@tempdima=0.4pt% to 0.8pt so that in an UML diagram is well seen the oplus, but all in all, thank you
    – Álvaro
    Jul 31 '13 at 10:19

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.