📚 The CoCalc Library - books, templates and other resources
cocalc-examples / martinthoma-latex-examples / presentations / Gute-Frage-Schluesselqualifikation / templates / tikzkit.sty
132934 viewsLicense: OTHER
%% Tikz-Styles for Palladio Component Model symbols1%% by Erik Burger2%%3%% version 2010-12-134%%5%% Problems, bugs and comments to6%% [email protected]78\usepackage{tikz}9\usetikzlibrary{positioning}10\usetikzlibrary{arrows}11\usetikzlibrary{fit}12\usetikzlibrary{petri}13\usetikzlibrary{decorations.markings}14\usetikzlibrary{decorations.pathmorphing}15\usetikzlibrary{decorations.text}16\usetikzlibrary{fit}17\usetikzlibrary{automata}18\usetikzlibrary{shapes}19\usetikzlibrary{shadows}20\usetikzlibrary{calc}2122%% Vertikal geteilter Kreis23\pgfdeclareshape{circle vertical split}24{25\inheritsavedanchors[from=circle]26\inheritanchorborder[from=circle]27\inheritanchor[from=circle]{north}28\inheritanchor[from=circle]{north west}29\inheritanchor[from=circle]{north east}30\inheritanchor[from=circle]{center}31\inheritanchor[from=circle]{west}32\inheritanchor[from=circle]{east}33\inheritanchor[from=circle]{mid}34\inheritanchor[from=circle]{mid west}35\inheritanchor[from=circle]{mid east}36\inheritanchor[from=circle]{base}37\inheritanchor[from=circle]{base west}38\inheritanchor[from=circle]{base east}39\inheritanchor[from=circle]{south}40\inheritanchor[from=circle]{south west}41\inheritanchor[from=circle]{south east}42\inheritbackgroundpath[from=circle]43\foregroundpath{44\centerpoint%45\pgf@xc=\pgf@x%46\pgf@yc=\pgf@y%47\pgfutil@tempdima=\radius%48\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%49\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%50\ifdim\pgf@xb<\pgf@yb%51\advance\pgfutil@tempdima by-\pgf@yb%52\else%53\advance\pgfutil@tempdima by-\pgf@xb%54\fi%55\advance\pgfutil@tempdima by-.5\pgflinewidth%56\pgfsetshortenstart{0pt}%57\pgfsetshortenend{0pt}%58\pgfsetarrows{-}%59\pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-1\pgfutil@tempdima}}}%60\pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}%61\pgfusepath{stroke}%62}63}6465\tikzset{66%% Color Shadings67blueshading/.style={shade, top color=white, bottom color=kit-blue30, draw=kit-blue100, thick},68greyshading/.style={shade, top color=white, bottom color=black!30, draw=black!50, thick},69lightgreyshading/.style={shade, top color=white, bottom color=black!15, draw=black!50, thick},70blackshading/.style={shade, top color=black!50, bottom color=black!95, middle color=black!95, draw=black!95, thick},71greenshading/.style={shade, top color=white, bottom color=kit-green30, draw=kit-green100, thick},72redshading/.style={shade, top color=white, bottom color=kit-red30, draw=kit-red100, thick},73yellowshading/.style={shade, top color=white, bottom color=kit-yellow30, draw=kit-orange100, thick},74%% Boxes75roundbox/.style={rectangle, rounded corners=.5ex},76%% PCM Actions77seffaction/.style={rectangle split, rectangle split parts=2, rectangle split part align={center}, text centered, rounded corners},78pcmball/.style={shade, ball color=kit-blue100,circle,fill},79startaction/.style={pcmball,minimum size=1ex},80stopaction/.style={startaction,draw=black,double},81%% Petri net/Queueing Petri net symbols82pnplace/.style={circle, draw, minimum size=2em},83pntrans/.style={rectangle, draw, minimum height=2em},84qpnplace/.style={circle vertical split, draw, minimum size=2em},85subnetplace/.style={qpnplace, double},86}8788%% Baseline adaptation for PCM symbols89\tikzstyle{pcm} = [baseline=-.2ex]9091%% Ragged left text for boxes92\tikzoption{text badly93raggedleft}[]{\def\tikz@text@action{\raggedleft\relax}}94\tikzoption{text raggedleft}[]%95{\def\tikz@text@action{\raggedleft\rightskip\z@ plus2em96\spaceskip.3333em \xspaceskip.5em\relax}}979899%% Layers100\pgfdeclarelayer{l1}101\pgfdeclarelayer{l2}102\pgfdeclarelayer{l3}103\pgfdeclarelayer{l4}104\pgfdeclarelayer{l5}105\pgfdeclarelayer{l6}106\pgfdeclarelayer{l7}107\pgfdeclarelayer{l8}108\pgfdeclarelayer{l9}109\pgfsetlayers{main,l1,l2,l3,l4,l5,l6,l7,l8,l9}110111% Internal Action112113\newcommand{\pcmintaction}[2][]{114\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {};115\draw[thick] (#2.north) -- ([yshift=.5ex]#2.north);116\draw[thick] (#2.south) -- ([yshift=-.5ex]#2.south);117}118119\newcommand{\pcmextaction}[2][]{120\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {};121\draw[thick,<-] (#2.north) -- ([yshift=1ex]#2.north);122\draw[thick,->] (#2.south) -- ([yshift=-.8ex]#2.south);123\draw[ultra thick,->,color=red!70!black] (#2.east) -- ([xshift=1ex]#2.east);124}125126127\newcommand{\pcmloopaction}[2][]{128\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {}129edge [->, in=30, out=90, looseness=1, distance=2ex, thick] node {} (#2);130}131132\newcommand{\pcmiterator}[2][]{133\begin{scope}[decoration={134markings, mark=at position .5 with {\arrow[red, line width=.2ex]{>}}}, #1]135\node[matrix,draw=black!75, row sep=.3ex, inner sep=.3ex] (#2) {136\draw[red,thick] (0,0) -- (.7ex,0);\\137\draw[red,thick] (0,0) -- (.7ex,0);\\138\draw[red,thick] (0,0) -- (.7ex,0);\\ };139\draw [thick,black!75,postaction=decorate]140(#2.south) .. controls (0,-1.5ex) and (1.4ex,-1.5ex) ..141(1.4ex,0) .. controls (1.4ex,1.5ex) and (0,1.5ex) .. (#2.north);142\end{scope}143}144145\newcommand{\pcmbranch}[2][]{146{\pgfsetcornersarced{\pgfpointorigin}147\scriptsize148\node[diamond, shade, ball color=kit-blue100, inner sep=.1ex, text width=1.2ex, #1] (#2) {\color{white}\scriptsize\textbf?};149\draw[thick] (#2.north) -- ([yshift=.8ex]#2.north);150\draw[thick] (#2.south west) -- ([xshift=-.7ex,yshift=-.7ex]#2.south west);151\draw[thick] (#2.south east) -- ([xshift=.7ex, yshift=-.7ex]#2.south east);152}153}154155\newcommand{\pcmfork}{156\begin{scope}[very thick,black!75]157\draw (0,0) -- (0,.4em) -- (1em,.4em) -- (1em,0em);158\draw (.33em,.4em) -- (.33em,0em);159\draw (.66em,.4em) -- (.66em,0em);160\draw (.5em,1em) -- (.5em,.4em);161\draw (.2em,.75em) -- (.5em,.45em) -- (.8em,.75em);162\end{scope}163}164165\newcommand{\pcmnote}{166{\pgfsetcornersarced{\pgfpointorigin}167\path[draw, black!75, thick, shade, top color=white, bottom color=yellow] (0,0) -- (2ex,0) -- (2ex,1ex) -- (1.5ex,1.5ex) -- (0,1.5ex) -- cycle;168\draw[black!75, thick] (2ex,1ex) -- (1.5ex,1ex) -- (1.5ex,1.5ex);169}170}171172\newcommand{\pcmstart}[2][]{173\node[startaction, text width=0cm, #1] (#2) {};174}175176\newcommand{\pcmstop}[2][]{177\node[stopaction, text width=0cm, #1] (#2) {};178}179180\newcommand{\pcmsetvar}[2][]{181\node[rectangle,draw=gray,ultra thick,dashed,#1] (#2) {\$x};182}183184\newcommand{\pcmacq}{185\begin{scope}[every token/.style={color=kit-blue100,minimum size=.2ex}]186\node[place, minimum size=1em,shade,187bottom color=kit-blue30,top color=white,shading angle=30] {}188[children are tokens, token distance=.4ex]189child {node [token] {}}190child {node [token] {}}191child {node (inlier) [token] {}}192child {node [token] {}}193child {node [token] {}}194child {node [token] {}}195child {node [token] {}};196\node[token] (outlier) at (.6em,.6em) {};197\draw[->, red, very thick] (inlier) -- (outlier);198\end{scope}199}200201\newcommand{\pcmrel}{202\begin{scope}[every token/.style={color=kit-blue100,minimum size=.2ex}]203\node[place, minimum size=1em,shade,204bottom color=kit-blue30,top color=white,shading angle=30] {}205[children are tokens, token distance=.4ex]206child {node [token] {}}207child {node [token] {}}208child {node (inlier) [token] {}}209child {node [token] {}}210child {node [token] {}}211child {node [token] {}}212child {node [token] {}};213\node[token] (outlier) at (.6em,.6em) {};214\draw[<-, red, very thick] (inlier) -- (outlier);215\end{scope}216}217218\newcommand{\pcmdice}{219\tikzset{point/.style={circle,fill=black,minimum size=.4ex,inner sep=0pt}}220\begin{scope}[every node/.append style={yslant=-0.5},yslant=-0.5]221\shade[right color=white, left color=kit-blue30, draw=black,222rounded corners=.1ex] (0,0) rectangle +(1em,1em);223\node [point] at (.25em,.25em) {};224\node [point] at (.25em,.75em) {};225\node [point] at (.5em,.5em) {};226\node [point] at (.75em,.25em) {};227\node [point] at (.75em,.75em) {};228\end{scope}229230\begin{scope}[every node/.append style={yslant=0.5},yslant=0.5]231\shade[left color=white, right color=kit-blue30, draw=black,232rounded corners=.1ex] (1em,-1em) rectangle +(1em,1em);233\node [point] at (1.25em,-.25em) {};234\node [point] at (1.25em,-.75em) {};235\node [point] at (1.75em,-.25em) {};236\node [point] at (1.75em,-.75em) {};237\end{scope}238239240\begin{scope}[every node/.append style={241yslant=0.5,xslant=-1},yslant=0.5,xslant=-1242]243\shade[bottom color=white, top color=kit-blue30, draw=black,244rounded corners=.1ex] (2em,1em) rectangle +(-1em,-1em);245\node [point] at (1.25em,.25em) {};246\node [point] at (1.25em,.75em) {};247\node [point] at (1.5em,.25em) {};248\node [point] at (1.5em,.75em) {};249\node [point] at (1.75em,.25em) {};250\node [point] at (1.75em,.75em) {};251\end{scope}252253\draw[thick, color=black] (.5em,-.25em) -- +(-.7ex,-.7ex);254\draw[thick, color=black] (1.5em,-.25em) -- +(.7ex,-.7ex);255256}257258\newcommand{\pcmcertsign}{259\begin{scope}[rotate=30]260\node [draw, red, thick, circle, rotate=30] (certified) at (0,0) {\scriptsize CERTIFIED};261\draw [red, thick] (.67,.2) arc (16.6:163.4:7mm) -- cycle;262\draw [red, thick] (-.67,-.2) arc (196.6:343.4:7mm) -- cycle;263\end{scope}264}265266% #1 = Formatierung267% #2 = Name des Nodes268% #3 = Position269270\newcommand{\pcmcomponentsymbol}[3]{271\node[rectangle, minimum width=1.2em, minimum height=1.2em, #1]272(#2) #3 {};273\filldraw[#1]274($(#2)+(-1em,.1em)$) rectangle +(.7em,.3em)275($(#2)+(-1em,-.1em)$) rectangle +(.7em,-.3em);276}277278% #1 = Formatierung279% #2 = Name des Nodes280% #3 = Text281% #4 = oberer Layer282% #5 = unterer Layer283% #6 = Position284285\newcommand{\pcmcomponentbodyonlayers}[6]{286\begin{pgfonlayer}{#4}287\node[minimum width=4em] (#2text) #6 {\small #3};288\pcmcomponentsymbol{fill=white, draw=black}{#2componentsymbol}{at ($(#2text.east)+(-1em,1.5em)$)}289\end{pgfonlayer}290\begin{pgfonlayer}{#5}291\node[draw=black, rectangle, inner sep = .2em, #1] (#2) [fit=(#2text) (#2componentsymbol)] {};292\end{pgfonlayer}293}294295% #1 = Formatierung296% #2 = Name des Nodes297% #3 = Text298% #4 = Position299\newcommand{\pcmcomponentbody}[4]{300\pcmcomponentbodyonlayers{#1}{#2}{#3}{l4}{l3}{#4}301}302303% #1 = Formatierung304% #2 = Name des Nodes305% #3 = Position306307\newcommand{\pcmlolliwest}[3]{308\node[circle, minimum size=1ex, draw, anchor=east, xshift=-1em, #1] (#2) at #3 {};309\draw[#1] #3 -- (#2);310}311312% #1 = Formatierung313% #2 = Name des Nodes314% #3 = Position315316\newcommand{\pcmarceast}[3]{317\node[xshift=1em] (#2) at #3 {};318\draw[#1] #3 -- (#2.center);319\draw[#1, fill opacity=transparent] ($(#2)+(1.4ex,1.4ex)$) arc (90:270:1.4ex);320321}322323% #1 = Formatierung324% #2 = Name des Nodes325% #3 = Text326% #4 = oberer Layer327% #5 = unterer Layer328% #6 = Position329330\newcommand{\pcmcomponentonlayers}[6]{331\pcmcomponentbodyonlayers{#1}{#2}{#3}{#4}{#5}{#6}332333\begin{pgfonlayer}{#5}334\pcmlolliwest{#1}{#2lolli}{(#2.west)}335\pcmarceast{#1}{#2arc}{(#2.east)}336\end{pgfonlayer}337}338339% #1 = Formatierung340% #2 = Name des Nodes341% #3 = Text342% #4 = Position343\newcommand{\pcmcomponent}[4]{344\pcmcomponentonlayers{#1}{#2}{#3}{l4}{l3}{#4}345}346347348% Extrudieren von rechteckigen Shapes349%350% #1 = Name des Nodes351% #2 = Abstand352% #3 = Zeichenoptionen353354\newcommand{\pcmextrude}[3]{355\path[#3] (#1.north west) -- (#1.north east) -- (#1.south east) -- (#1.south west) -- (#1.north west) -- ++(#2,#2) -- ($(#1.north east)+(#2,#2)$) -- ($(#1.south east)+(#2,#2)$) -- (#1.south east) (#1.north east) -- ($(#1.north east)+(#2,#2)$);356}357358359% Dummy-Bild360\newcommand{\dummypic}[2]{361\tikz \draw[kit-red100] (0,0) -- (#1,0) -- (#1,#2) -- (0,#2) -- (0,0) -- (#1,#2) (0,#2) -- (#1,0);362}363364365