我想创建一种显示 UML 中的内部类的箭头,即以符号开头的箭头,\oplus
如下所示:http://myumlnotes.blogspot.com.es/2007/01/inner-class.html使用 Tikz。
有人能帮我定义那个箭头吗?类似的东西\pgfarrowsdeclare{OPLUS arrow}{OPLUS arrow}
可能很完美
答案1
您可以使用箭头的定义o
并添加加号:
\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}}%
该backgrounds
库及其gridded
选项仅用于显示 TikZ 放置箭头的位置。
代码
\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}