diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/pgf-umlcd/pgf-umlcd.sty | 353 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgf-umlcd/tikzlibraryumlcd.code.tex | 402 |
2 files changed, 407 insertions, 348 deletions
diff --git a/Master/texmf-dist/tex/latex/pgf-umlcd/pgf-umlcd.sty b/Master/texmf-dist/tex/latex/pgf-umlcd/pgf-umlcd.sty index 0062909b8d7..3d37e9b69e3 100644 --- a/Master/texmf-dist/tex/latex/pgf-umlcd/pgf-umlcd.sty +++ b/Master/texmf-dist/tex/latex/pgf-umlcd/pgf-umlcd.sty @@ -1,353 +1,10 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Start of pgf-umlcd.sty -% -% Some macros for UML Class Diagrams. -% Home page of project: http://pgf-umlcd.googlecode.com/ -% Author: Xu Yuan <xu@informatik.hu-berlin.de>, Humboldt University, Berlin -% Style from: http://www.ibm.com/developerworks/cn/rational/r-uml/ -% - +% SPDX-License-Identifier: GPL-2.0-only OR LPPL-1.3c \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{pgf-umlcd}[2011/10/01 v0.3dev Some LaTeX macros for -UML Class Diagrams.] +\ProvidesPackage{pgf-umlcd}[2022/05/22 v0.3 Some LaTeX macros for UML Class Diagrams.] \RequirePackage{tikz} +\usetikzlibrary{umlcd} -\usetikzlibrary{arrows,shapes.multipart,backgrounds,fit} -\tikzstyle{help lines}+=[blue!50,very thin,dashed] - -\newcommand{\umltextcolor}{black} -\newcommand{\umldrawcolor}{purple} -\newcommand{\umlfillcolor}{yellow!20} -\tikzstyle{umlcolor}=[color=\umldrawcolor,fill=\umlfillcolor,text=\umltextcolor] -\tikzstyle{umlcd style}=[umlcolor, >=angle 90] - -\tikzstyle{package}=[matrix, column sep=1mm, row sep=1cm, node distance=2cm] -\tikzstyle{packagename}=[rectangle, minimum height=2em] - -\tikzstyle{umlcd style implement line}=[color=\umldrawcolor, open triangle 45-,dashed] -\tikzstyle{objectline}=[color=\umldrawcolor, diamond->] -\tikzstyle{umlcd style inherit line}=[color=\umldrawcolor, open triangle 45-] -\tikzstyle{splitline}=[color=\umldrawcolor, dotted,font=\itshape] - -\tikzstyle{umlcd style class}=[rectangle split, rectangle split parts=3, -every text node part/.style={text centered}, -draw, minimum height=2em, umlcolor, minimum width=2cm, text width=5cm, -minimum height=1cm, node distance=2cm] - - -\tikzstyle{umlcd style dashed line}=[color=\umldrawcolor, >=angle 90,dashed] - -\tikzstyle{umlcd style school}=[] -\newif\ifschool\schoolfalse -\DeclareOption{school}{\tikzstyle{umlcd style school}=[rounded corners] \schooltrue} -\newif\ifsimplified\simplifiedfalse -\DeclareOption{simplified}{\simplifiedtrue} +\DeclareOption{school}{\tikzset{umlcd style school/.style={rounded corners}}\pgfumlcd@schooltrue} +\DeclareOption{simplified}{\pgfumlcd@simplifiedtrue} \ProcessOptions\relax - - -% declare layers -\pgfdeclarelayer{background} -\pgfdeclarelayer{connectionlayers} -\pgfsetlayers{background,connectionlayers,main} - -\newcounter{umlcdClassAttributesNum} -\newcounter{umlcdClassOperationsNum} -\newcounter{umlcdClassAbstractClassNum} -\newcounter{umlcdClassInterfaceNum} -\newcounter{umlcdClassSplitPartNum} - -\def\umlcdPackageFit{} - -\newenvironment{class}[3][]% -{ -\begin{classAndInterfaceCommon}{#1}{#2}{#3} -}% -{\calcuateNumberOfParts{} -\node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) - {\textbf{\umlcdClassName} -\insertAttributesAndOperations{} -}; - -\end{classAndInterfaceCommon} -} - -\newenvironment{interface}[3][]% -{ -\begin{classAndInterfaceCommon}{#1}{#2}{#3} -}% -{\calcuateNumberOfParts{} -\node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) - {$<<$interface$>>$ \\ \textbf{\umlcdClassName} -\insertAttributesAndOperations{} -}; - -\end{classAndInterfaceCommon} -} - -\newenvironment{abstractclass}[3][]% -{ -\begin{classAndInterfaceCommon}{#1}{#2}{#3} -}% -{\calcuateNumberOfParts{} -\node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) - {$<<$abstract$>>$ \\ \textbf{\umlcdClassName} -\insertAttributesAndOperations{} -}; - -\end{classAndInterfaceCommon} -} - -% TODO: here the name of \umlcdClassName and \umlObjectName should be -% switched, it is only for reusing \classAndInterfaceCommon at the -% moment. -\newenvironment{object}[3][]% -{ -\begin{classAndInterfaceCommon}{#1}{#2}{#3} -\def\@instanceOf{} -\def\@@instanceOf{} -}% -{ - % customized - \ifsimplified - \calcuateNumberOfParts{} - \else - \ifnum\c@umlcdClassOperationsNum>0 - \setcounter{umlcdClassSplitPartNum}{3} - \protected@xdef\umlcdSplitPart{3} - \else - \setcounter{umlcdClassSplitPartNum}{2} - \protected@xdef\umlcdSplitPart{2} - \fi - \fi - - \ifx\@instanceOf\@@instanceOf - \def\umldObjectName{\umlcdClassName} - \else - \def\umldObjectName{\umlcdClassName : \@instanceOf} - \fi - -\node[this umlcd style, anchor=north, umlcd style school] (\umlcdClassName) at (\umlcdClassPos) - { \ifschool - \textbf{\umldObjectName} - \else - \underline{\textbf{\umldObjectName}} - \fi - \insertAttributesAndOperations{} -}; - -\end{classAndInterfaceCommon} -} - -\newcommand*{\insertAttributesAndOperations} -{ - \ifnum\c@umlcdClassSplitPartNum>1 - \nodepart{second} - \fi - \umlcdClassAttributes - \ifnum\c@umlcdClassSplitPartNum>2 - \nodepart{third} - \fi - \umlcdClassOperations -} - -\newcommand*{\calcuateNumberOfParts} -{ - % calcuate the number of parts - \ifsimplified - \setcounter{umlcdClassSplitPartNum}{1} - \ifnum\c@umlcdClassAttributesNum>0 - \stepcounter{umlcdClassSplitPartNum} - \fi - \ifnum\c@umlcdClassOperationsNum>0 - \stepcounter{umlcdClassSplitPartNum} - \fi - \else - \setcounter{umlcdClassSplitPartNum}{3}% three parts by default - \fi - - \protected@xdef\umlcdSplitPart{3} - \ifnum\c@umlcdClassSplitPartNum=1 - \protected@xdef\umlcdSplitPart{1} - \fi - \ifnum\c@umlcdClassSplitPartNum=2 - \protected@xdef\umlcdSplitPart{2} - \fi -} - -\newenvironment*{classAndInterfaceCommon}[3] -{ -\def\umlcdClassName{#2}% -\def\umlcdClassPos{#3} -\def\umlcdClassAttributes{}% -\def\umlcdClassOperations{}% -\def\umlcdClassAbstractClass{}% -\def\umlcdClassInterface{}% -\setcounter{umlcdClassAttributesNum}{0}% -\setcounter{umlcdClassOperationsNum}{0}% -\setcounter{umlcdClassAbstractClassNum}{0}% -\setcounter{umlcdClassInterfaceNum}{0}% -\tikzstyle{this umlcd style}=[umlcd style class, rectangle split - parts=\umlcdSplitPart, #1] -}% -{ -%% connections -\begin{pgfonlayer}{connectionlayers} -\ifnum\c@umlcdClassAbstractClassNum>0 -\foreach \c in {\umlcdClassAbstractClass}{ - \draw [umlcd style inherit line] (\c) -- (\umlcdClassName); -} -\fi - -\ifnum\c@umlcdClassInterfaceNum>0 -\foreach \c in {\umlcdClassInterface}{ - \draw [umlcd style implement line] (\c) -- (\umlcdClassName); -} -\fi -\end{pgfonlayer} - -%% add to fit -\let\umlcdPackageFitOld\umlcdPackageFit -\protected@xdef\umlcdPackageFit{\umlcdPackageFitOld (\umlcdClassName)} -} - -\newcommand{\attribute}[1]{% -\ifnum\c@umlcdClassAttributesNum=0 -\protected@xdef\umlcdClassAttributes{#1} -\else -\let\umlcdClassAttributesOld\umlcdClassAttributes -\protected@xdef\umlcdClassAttributes{\umlcdClassAttributesOld \ \newline - #1} -\fi -\stepcounter{umlcdClassAttributesNum} -} - -\newcommand{\operation}[2][1]{% -\stepcounter{umlcdClassOperationsNum} - -\def\virtualoperation{#2} -\ifnum0=#1 -\def\virtualoperation{\textit{#2}} -\fi - -\ifnum\c@umlcdClassOperationsNum=1 -\protected@xdef\umlcdClassOperations{\virtualoperation} -\else -\let\umlcdClassOperationsOld\umlcdClassOperations -\protected@xdef\umlcdClassOperations{\umlcdClassOperationsOld \ \newline - \virtualoperation} -\fi -} - -\newcommand{\inherit}[1] -{ -\stepcounter{umlcdClassAbstractClassNum} -\ifnum\c@umlcdClassAbstractClassNum=1 -\protected@xdef\umlcdClassAbstractClass{#1} -\else -\let\umlcdClassAbstractClassOld\umlcdClassAbstractClass -\protected@xdef\umlcdClassAbstractClass{\umlcdClassAbstractClassOld, - #1} -\fi -} - -\newcommand{\implement}[1] -{ -\stepcounter{umlcdClassInterfaceNum} -\ifnum\c@umlcdClassInterfaceNum=1 -\protected@xdef\umlcdClassInterface{#1} -\else -\let\umlcdClassInterfaceOld\umlcdClassInterface -\protected@xdef\umlcdClassInterface{\umlcdClassInterfaceOld, - #1} -\fi -} - -\newcommand{\instanceOf}[1]{\def\@instanceOf{#1}} - -\newcommand{\association}[6]{ -\draw [umlcd style] (#1) -- (#4) -node[near start, above]{#2} -node[near start, below]{#3} -node[near end, above]{#5} -node[near end, below]{#6}; -} - -\newcommand{\unidirectionalAssociation}[4]{ -\draw [umlcd style, ->] (#1) -- (#4) -node[near end, above]{#2} -node[near end, below]{#3}; -} - -\newcommand{\aggregation}[4] -{ -\draw[umlcd style, open diamond->] (#1) -- (#4) -node[near end, above]{#2} -node[near end, below]{#3}; -} - -\newcommand{\composition}[4] -{ -\draw[umlcd style, fill=\umldrawcolor, diamond->] (#1) -- (#4) -node[near end, above]{#2} -node[near end, below]{#3}; -} - -\newenvironment{package}[1]{ -\def\umlcdPackageFit{} -\def\umlcdPackageName{#1} -}{ - \begin{pgfonlayer}{background} - \node[umlcd style, draw, inner sep=0.5cm, fit = \umlcdPackageFit] (\umlcdPackageName) {}; - \node[umlcd style, draw, outer ysep=-0.5, anchor=south west] (\umlcdPackageName caption) at - (\umlcdPackageName.north west) {\umlcdPackageName}; - \end{pgfonlayer} -} - -\newcommand{\switchUmlcdSchool}{ - \ifschool - \tikzstyle{umlcd style school}=[] - \schoolfalse - \else - \tikzstyle{umlcd style school}=[rounded corners] - \schooltrue - \fi -} - -\pgfdeclareshape{umlcdnote}{ -\inheritsavedanchors[from=rectangle] % this is nearly a rectangle -\inheritanchorborder[from=rectangle] -\inheritanchor[from=rectangle]{center} -\inheritanchor[from=rectangle]{north} -\inheritanchor[from=rectangle]{south} -\inheritanchor[from=rectangle]{west} -\inheritanchor[from=rectangle]{east} -% ... and possibly more -\backgroundpath{% this is new -% store lower right in xa/ya and upper right in xb/yb -\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y -\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y -% compute corner of flipped page -\pgf@xc=\pgf@xb \advance\pgf@xc by-10pt % this should be a parameter -\pgf@yc=\pgf@yb \advance\pgf@yc by-10pt -% construct main path -\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} -\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} -\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}} -\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}} -\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} -\pgfpathclose -% add little corner -\pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}} -\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}} -\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}} -\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}} -} -} - -\newcommand{\umlnote}[1][]{ - \node[umlcd style, anchor=north, draw,shape=umlcdnote, text width=4cm, #1] -} - -%%% End of pgf-umlcd.sty -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/pgf-umlcd/tikzlibraryumlcd.code.tex b/Master/texmf-dist/tex/latex/pgf-umlcd/tikzlibraryumlcd.code.tex new file mode 100644 index 00000000000..63b05580f7e --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf-umlcd/tikzlibraryumlcd.code.tex @@ -0,0 +1,402 @@ +% SPDX-License-Identifier: GPL-2.0-only OR LPPL-1.3c + +\usetikzlibrary{arrows,shapes.multipart,backgrounds,fit} + +% +% Utilities +% + +\def\pgfumlcd@ifx#1#2{% + \ifx#1#2% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfumlcd@ifdim#1#2#3{% + \ifdim\dimexpr#1\relax#2\dimexpr#3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfumlcd@ifnum#1#2#3{% + \ifnum\numexpr#1\relax#2\numexpr#3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfumlcd@newif#1{% + \csname newif\expandafter\endcsname\csname ifpgfumlcd@#1\endcsname + \expandafter\def\csname pgfumlcd@if#1\expandafter\endcsname\expandafter{% + \csname ifpgfumlcd@#1\endcsname + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi}% +} + +\expandafter\let\expandafter\pgfumlcd@xdef\csname\ifcsname protected@xdef\endcsname protected@\fi xdef\endcsname + +\def\umltextcolor{black} +\def\umldrawcolor{purple} +\def\umlfillcolor{yellow!20} + +\tikzset{% + help lines/.append style = {blue!50,very thin,dashed}, + umlcolor/.style = {color=\umldrawcolor,fill=\umlfillcolor,text=\umltextcolor}, + umlcd style/.style = {umlcolor, >=angle 90}, + package/.style = {matrix, column sep=1mm, row sep=1cm, node distance=2cm}, + packagename/.style = {rectangle, minimum height=2em}, + umlcd style implement line/.style = {color=\umldrawcolor, open triangle 45-,dashed}, + objectline/.style = {color=\umldrawcolor, diamond->}, + umlcd style inherit line/.style = {color=\umldrawcolor, open triangle 45-}, + splitline/.style = {color=\umldrawcolor, dotted,font=\pgfutil@font@itshape}, + umlcd style class/.style = {rectangle split, rectangle split parts=3, + every text node part/.style={text centered}, + draw, minimum height=2em, umlcolor, minimum width=2cm, text width=5cm, + minimum height=1cm, node distance=2cm}, + umlcd style dashed line/.style = {color=\umldrawcolor, >=angle 90,dashed}, + umlcd style school/.style = {}, +} + +\pgfumlcd@newif{school} +\pgfumlcd@newif{simplified} + +% declare layers +\pgfdeclarelayer{background} +\pgfdeclarelayer{connectionlayers} +\pgfsetlayers{background,connectionlayers,main} + +\newcount\pgfumlcd@ClassAttributesNum +\newcount\pgfumlcd@ClassOperationsNum +\newcount\pgfumlcd@ClassAbstractClassNum +\newcount\pgfumlcd@ClassInterfaceNum +\newcount\pgfumlcd@ClassSplitPartNum + +\def\pgfumlcd@PackageFit{} + +\def\pgfumlcd@class{\pgfutil@ifnextchar[{\pgfumlcd@class@}{\pgfumlcd@class@[]}} +\def\pgfumlcd@class@[#1]#2#3{% + \pgfumlcd@classAndInterfaceCommon{#1}{#2}{#3}% +} +\def\endpgfumlcd@class{% + \pgfumlcd@calcuateNumberOfParts{}% + \node[anchor=north,this umlcd style] (\pgfumlcd@ClassName) at (\pgfumlcd@ClassPos) {% + {\pgfutil@font@bfseries\pgfumlcd@ClassName} % <-- explicit space + \pgfumlcd@insertAttributesAndOperations{}% + };% + \endpgfumlcd@classAndInterfaceCommon +} + +\def\pgfumlcd@interface{\pgfutil@ifnextchar[{\pgfumlcd@interface@}{\pgfumlcd@interface@[]}} +\def\pgfumlcd@interface@[#1]#2#3{% + \pgfumlcd@classAndInterfaceCommon{#1}{#2}{#3}% +} +\def\endpgfumlcd@interface{% + \pgfumlcd@calcuateNumberOfParts{}% + \node[anchor=north,this umlcd style] (\pgfumlcd@ClassName) at (\pgfumlcd@ClassPos) {% + $<<$interface$>>$\break + {\pgfutil@font@bfseries\pgfumlcd@ClassName} % <-- explicit space + \pgfumlcd@insertAttributesAndOperations{}% + };% + \endpgfumlcd@classAndInterfaceCommon +} + +\def\pgfumlcd@abstractclass{\pgfutil@ifnextchar[{\pgfumlcd@abstractclass@}{\pgfumlcd@abstractclass@[]}} +\def\pgfumlcd@abstractclass@[#1]#2#3{% + \pgfumlcd@classAndInterfaceCommon{#1}{#2}{#3}% +} +\def\endpgfumlcd@abstractclass{% + \pgfumlcd@calcuateNumberOfParts{} + \node[anchor=north,this umlcd style] (\pgfumlcd@ClassName) at (\pgfumlcd@ClassPos) {% + $<<$abstract$>>$\break + {\pgfutil@font@bfseries\pgfumlcd@ClassName} % <-- explicit space + \pgfumlcd@insertAttributesAndOperations{}% + };% + \endpgfumlcd@classAndInterfaceCommon +} + +\def\pgfumlcd@staticclass{\pgfutil@ifnextchar[{\pgfumlcd@staticclass@}{\pgfumlcd@staticclass@[]}} +\def\pgfumlcd@staticclass@[#1]#2#3{% + \pgfumlcd@classAndInterfaceCommon{#1}{#2}{#3}% +} +\def\endpgfumlcd@staticclass{% + \pgfumlcd@calcuateNumberOfParts{} + \node[anchor=north,this umlcd style] (\pgfumlcd@ClassName) at (\pgfumlcd@ClassPos) {% + $<<$static$>>$\break + {\pgfutil@font@bfseries\pgfumlcd@ClassName} % <-- explicit space + \pgfumlcd@insertAttributesAndOperations{}% + };% + \endpgfumlcd@classAndInterfaceCommon +} + +% TODO: here the name of \pgfumlcd@ClassName and \umlObjectName should be +% switched, it is only for reusing \classAndInterfaceCommon at the +% moment. +\def\pgfumlcd@object{\pgfutil@ifnextchar[{\pgfumlcd@object@}{\pgfumlcd@object@[]}} +\def\pgfumlcd@object@[#1]#2#3{% + \pgfumlcd@classAndInterfaceCommon{#1}{#2}{#3}% + \def\pgfumlcd@@instanceOf{} +} +\def\endpgfumlcd@object{% + % customized + \pgfumlcd@ifsimplified{% + \pgfumlcd@calcuateNumberOfParts{}% + }{% + \pgfumlcd@ifnum{\pgfumlcd@ClassOperationsNum}{>}{0}{% + \pgfumlcd@ClassSplitPartNum=3 + \pgfumlcd@xdef\pgfumlcd@SplitPart{3}% + }{% + \pgfumlcd@ClassSplitPartNum=2 + \pgfumlcd@xdef\pgfumlcd@SplitPart{2}% + }% + }% + \pgfumlcd@ifx{\pgfumlcd@@instanceOf}{\pgfutil@empty}{% + \def\pgfumlcd@ObjectName{\pgfumlcd@ClassName}% + }{% + \def\pgfumlcd@ObjectName{\pgfumlcd@ClassName : \pgfumlcd@@instanceOf}% + }% + \node[anchor=north,this umlcd style,umlcd style school] (\pgfumlcd@ClassName) at (\pgfumlcd@ClassPos) {% + \pgfumlcd@ifschool{% + {\pgfutil@font@bfseries\pgfumlcd@ObjectName}% + }{% + \underline{\pgfutil@font@bfseries\pgfumlcd@ObjectName}% + } % <-- explicit space + \pgfumlcd@insertAttributesAndOperations{}% + };% + \endpgfumlcd@classAndInterfaceCommon +} + +\def\pgfumlcd@insertAttributesAndOperations{% + \pgfumlcd@ifnum{\pgfumlcd@ClassSplitPartNum}{>}{1}{% + \nodepart{second}% + }{}% + \pgfumlcd@ClassAttributes + \pgfumlcd@ifnum{\pgfumlcd@ClassSplitPartNum}{>}{2}{% + \nodepart{third}% + }{}% + \pgfumlcd@ClassOperations +} + +\def\pgfumlcd@calcuateNumberOfParts{% + % calcuate the number of parts + \pgfumlcd@ifsimplified{% + \pgfumlcd@ClassSplitPartNum=1 + \pgfumlcd@ifnum{\pgfumlcd@ClassAttributesNum}{>}{0}{% + \advance\pgfumlcd@ClassSplitPartNum by 1 + }{}% + \pgfumlcd@ifnum{\pgfumlcd@ClassOperationsNum}{>}{0}{% + \advance\pgfumlcd@ClassSplitPartNum by 1 + }{}% + }{% + \pgfumlcd@ClassSplitPartNum=3 % three parts by default + }% + \pgfumlcd@xdef\pgfumlcd@SplitPart{3} + \pgfumlcd@ifnum{\pgfumlcd@ClassSplitPartNum}{=}{1}{% + \pgfumlcd@xdef\pgfumlcd@SplitPart{1}% + }{}% + \pgfumlcd@ifnum{\pgfumlcd@ClassSplitPartNum}{=}{2}{% + \pgfumlcd@xdef\pgfumlcd@SplitPart{2}% + }{}% +} + +\def\pgfumlcd@classAndInterfaceCommon#1#2#3{% + \def\pgfumlcd@ClassName{#2}% + \def\pgfumlcd@ClassPos{#3} + \def\pgfumlcd@ClassAttributes{}% + \def\pgfumlcd@ClassOperations{}% + \def\pgfumlcd@ClassAbstractClass{}% + \def\pgfumlcd@ClassInterface{}% + \pgfumlcd@ClassAttributesNum=0 + \pgfumlcd@ClassOperationsNum=0 + \pgfumlcd@ClassAbstractClassNum=0 + \pgfumlcd@ClassInterfaceNum=0 + \tikzset{% + this umlcd style/.style={% + umlcd style class,% + rectangle split parts=\pgfumlcd@SplitPart,% + #1}% + } +}% +\def\endpgfumlcd@classAndInterfaceCommon{% + %% connections + \pgfonlayer{connectionlayers}% + \pgfumlcd@ifnum{\pgfumlcd@ClassAbstractClassNum}{>}{0}{% + \foreach \c in \pgfumlcd@ClassAbstractClass {% + \draw [umlcd style inherit line] (\c) -- (\pgfumlcd@ClassName);% + }% + }{}% + \pgfumlcd@ifnum{\pgfumlcd@ClassInterfaceNum}{>}{0}{% + \foreach \c in \pgfumlcd@ClassInterface {% + \draw [umlcd style implement line] (\c) -- (\pgfumlcd@ClassName);% + }% + }{}% + \endpgfonlayer + %% add to fit + \let\pgfumlcd@PackageFitOld\pgfumlcd@PackageFit + \pgfumlcd@xdef\pgfumlcd@PackageFit{\pgfumlcd@PackageFitOld (\pgfumlcd@ClassName)}% +} + +\def\pgfumlcd@attribute#1{% + \pgfumlcd@ifnum{\pgfumlcd@ClassAttributesNum}{=}{0}{% + \pgfumlcd@xdef\pgfumlcd@ClassAttributes{#1}% + }{% + \let\pgfumlcd@ClassAttributesOld\pgfumlcd@ClassAttributes + \pgfumlcd@xdef\pgfumlcd@ClassAttributes{\pgfumlcd@ClassAttributesOld\break#1}% + }% + \advance\pgfumlcd@ClassAttributesNum by 1 +} + +\def\pgfumlcd@operation{\pgfutil@ifnextchar[{\pgfumlcd@operation@}{\pgfumlcd@operation@[1]}} +\def\pgfumlcd@operation@[#1]#2{% + \advance\pgfumlcd@ClassOperationsNum by 1 + \def\pgfumlcd@virtualoperation{#2} + \pgfumlcd@ifnum{0}{=}{#1}{% + \def\pgfumlcd@virtualoperation{{\pgfutil@font@itshape#2}}% + }{}% + \pgfumlcd@ifnum{\pgfumlcd@ClassOperationsNum}{=}{1}{% + \pgfumlcd@xdef\pgfumlcd@ClassOperations{\pgfumlcd@virtualoperation}% + }{% + \let\pgfumlcd@ClassOperationsOld\pgfumlcd@ClassOperations + \pgfumlcd@xdef\pgfumlcd@ClassOperations{\pgfumlcd@ClassOperationsOld\break\pgfumlcd@virtualoperation}% + }% +} + +\def\pgfumlcd@inherit#1{% + \advance\pgfumlcd@ClassAbstractClassNum by 1 + \pgfumlcd@ifnum{\pgfumlcd@ClassAbstractClassNum}{=}{1}{% + \pgfumlcd@xdef\pgfumlcd@ClassAbstractClass{#1}% + }{% + \let\pgfumlcd@ClassAbstractClassOld\pgfumlcd@ClassAbstractClass + \pgfumlcd@xdef\pgfumlcd@ClassAbstractClass{\pgfumlcd@ClassAbstractClassOld, #1}% + }% +} + +\def\pgfumlcd@implement#1{% + \advance\pgfumlcd@ClassInterfaceNum by 1 + \pgfumlcd@ifnum{\pgfumlcd@ClassInterfaceNum}{=}{1}{% + \pgfumlcd@xdef\pgfumlcd@ClassInterface{#1} + }{% + \let\pgfumlcd@ClassInterfaceOld\pgfumlcd@ClassInterface + \pgfumlcd@xdef\pgfumlcd@ClassInterface{\pgfumlcd@ClassInterfaceOld, #1} + }% +} + +\def\pgfumlcd@instanceOf#1{\def\pgfumlcd@@instanceOf{#1}} + +\def\pgfumlcd@association{\pgfutil@ifnextchar[{\pgfumlcd@association@}{\pgfumlcd@association@[]}} +\def\pgfumlcd@association@[#1]#2#3#4#5#6#7{% + \draw [umlcd style,#1] (#2) -- (#5) + node[near start, auto]{#3} + node[near start, auto, swap]{#4} + node[near end, auto]{#6} + node[near end, auto, swap]{#7};% +} + +\def\pgfumlcd@unidirectionalAssociation{% + \pgfutil@ifnextchar[{\pgfumlcd@unidirectionalAssociation@}{\pgfumlcd@unidirectionalAssociation@[]}} +\def\pgfumlcd@unidirectionalAssociation@[#1]#2#3#4#5{% + \draw [umlcd style,->,#1] (#2) -- (#5) + node[near end, auto]{#3} + node[near end, auto, swap]{#4};% +} + +\def\pgfumlcd@aggregation{\pgfutil@ifnextchar[{\pgfumlcd@aggregation@}{\pgfumlcd@aggregation@[]}} +\def\pgfumlcd@aggregation@[#1]#2#3#4#5{% + \draw[umlcd style,open diamond->,#1] (#2) -- (#5) + node[near end, auto]{#3} + node[near end, auto, swap]{#4};% +} + +\def\pgfumlcd@composition{\pgfutil@ifnextchar[{\pgfumlcd@composition@}{\pgfumlcd@composition@[]}} +\def\pgfumlcd@composition@[#1]#2#3#4#5{% + \draw[umlcd style,fill=\umldrawcolor,diamond->,#1] (#2) -- (#5) + node[near end, auto]{#3} + node[near end, auto, swap]{#4};% +} + +\def\pgfumlcd@package#1{% + \def\pgfumlcd@PackageFit{}% + \def\pgfumlcd@PackageName{#1}% +} +\def\endpgfumlcd@package{% + \pgfonlayer{background}% + \node[umlcd style,draw,inner sep=0.5cm,fit=\pgfumlcd@PackageFit] (\pgfumlcd@PackageName) {};% + \node[umlcd style,draw,outer ysep=-0.5,anchor=south west] (\pgfumlcd@PackageName caption) at + (\pgfumlcd@PackageName.north west) {\pgfumlcd@PackageName};% + \endpgfonlayer +} + +\def\switchUmlcdSchool{% + \pgfumlcd@ifschool{% + \tikzset{umlcd style school/.style={}}% + \pgfumlcd@schoolfalse + }{% + \tikzset{umlcd style school/.style = {rounded corners}}% + \pgfumlcd@schooltrue + }% +} + +\pgfdeclareshape{umlcdnote}{% + \inheritsavedanchors[from=rectangle]% this is nearly a rectangle + \inheritanchorborder[from=rectangle]% + \inheritanchor[from=rectangle]{center}% + \inheritanchor[from=rectangle]{north}% + \inheritanchor[from=rectangle]{south}% + \inheritanchor[from=rectangle]{west}% + \inheritanchor[from=rectangle]{east}% + % ... and possibly more + \backgroundpath{% this is new + % store lower right in xa/ya and upper right in xb/yb + \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y + \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y + % compute corner of flipped page + \pgf@xc=\pgf@xb \advance\pgf@xc by-10pt % this should be a parameter + \pgf@yc=\pgf@yb \advance\pgf@yc by-10pt + % construct main path + \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}% + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}% + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}% + \pgfpathclose + % add little corner + \pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}% + \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}% + \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}% + \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}% + }% +} + +\def\pgfumlcd@umlnote{\pgfutil@ifnextchar[{\pgfumlcd@umlnote@}{\pgfumlcd@umlnote@[]}} +\def\pgfumlcd@umlnote@[#1]{% + \node[anchor=north,draw,shape=umlcdnote,text width=4cm,umlcd style,#1]% +} + +\tikzaddtikzonlycommandshortcutlet{\class}{\pgfumlcd@class} +\tikzaddtikzonlycommandshortcutlet{\endclass}{\endpgfumlcd@class} +\tikzaddtikzonlycommandshortcutlet{\interface}{\pgfumlcd@interface} +\tikzaddtikzonlycommandshortcutlet{\endinterface}{\endpgfumlcd@interface} +\tikzaddtikzonlycommandshortcutlet{\abstractclass}{\pgfumlcd@abstractclass} +\tikzaddtikzonlycommandshortcutlet{\endabstractclass}{\endpgfumlcd@abstractclass} +\tikzaddtikzonlycommandshortcutlet{\staticclass}{\pgfumlcd@staticclass} +\tikzaddtikzonlycommandshortcutlet{\endstaticclass}{\endpgfumlcd@staticclass} +\tikzaddtikzonlycommandshortcutlet{\object}{\pgfumlcd@object} +\tikzaddtikzonlycommandshortcutlet{\endobject}{\endpgfumlcd@object} +\tikzaddtikzonlycommandshortcutlet{\classAndInterfaceCommon}{\pgfumlcd@classAndInterfaceCommon} +\tikzaddtikzonlycommandshortcutlet{\endclassAndInterfaceCommon}{\endpgfumlcd@classAndInterfaceCommon} +\tikzaddtikzonlycommandshortcutlet{\package}{\pgfumlcd@package} +\tikzaddtikzonlycommandshortcutlet{\endpackage}{\endpgfumlcd@package} + +\tikzaddtikzonlycommandshortcutlet{\attribute}{\pgfumlcd@attribute} +\tikzaddtikzonlycommandshortcutlet{\operation}{\pgfumlcd@operation} +\tikzaddtikzonlycommandshortcutlet{\inherit}{\pgfumlcd@inherit} +\tikzaddtikzonlycommandshortcutlet{\implement}{\pgfumlcd@implement} +\tikzaddtikzonlycommandshortcutlet{\instanceOf}{\pgfumlcd@instanceOf} +\tikzaddtikzonlycommandshortcutlet{\association}{\pgfumlcd@association} +\tikzaddtikzonlycommandshortcutlet{\unidirectionalAssociation}{\pgfumlcd@unidirectionalAssociation} +\tikzaddtikzonlycommandshortcutlet{\aggregation}{\pgfumlcd@aggregation} +\tikzaddtikzonlycommandshortcutlet{\composition}{\pgfumlcd@composition} +\tikzaddtikzonlycommandshortcutlet{\umlnote}{\pgfumlcd@umlnote} |