-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtikzkit.sty
363 lines (316 loc) · 11.5 KB
/
tikzkit.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
%% Tikz-Styles for Palladio Component Model symbols
%% by Erik Burger
%%
%% version 2010-12-13
%%
%% Problems, bugs and comments to
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{fit}
\usetikzlibrary{petri}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\usetikzlibrary{fit}
\usetikzlibrary{automata}
\usetikzlibrary{shapes}
\usetikzlibrary{shadows}
\usetikzlibrary{calc}
%% Vertikal geteilter Kreis
\pgfdeclareshape{circle vertical split}
{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{north east}
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{mid}
\inheritanchor[from=circle]{mid west}
\inheritanchor[from=circle]{mid east}
\inheritanchor[from=circle]{base}
\inheritanchor[from=circle]{base west}
\inheritanchor[from=circle]{base east}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{south west}
\inheritanchor[from=circle]{south east}
\inheritbackgroundpath[from=circle]
\foregroundpath{
\centerpoint%
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfutil@tempdima=\radius%
\pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
\pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
\ifdim\pgf@xb<\pgf@yb%
\advance\pgfutil@tempdima by-\pgf@yb%
\else%
\advance\pgfutil@tempdima by-\pgf@xb%
\fi%
\advance\pgfutil@tempdima by-.5\pgflinewidth%
\pgfsetshortenstart{0pt}%
\pgfsetshortenend{0pt}%
\pgfsetarrows{-}%
\pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{-1\pgfutil@tempdima}}}%
\pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpoint{0pt}{\pgfutil@tempdima}}}%
\pgfusepath{stroke}%
}
}
\tikzset{
%% Color Shadings
blueshading/.style={shade, top color=white, bottom color=kit-blue30, draw=kit-blue100, thick},
greyshading/.style={shade, top color=white, bottom color=black!30, draw=black!50, thick},
lightgreyshading/.style={shade, top color=white, bottom color=black!15, draw=black!50, thick},
blackshading/.style={shade, top color=black!50, bottom color=black!95, middle color=black!95, draw=black!95, thick},
greenshading/.style={shade, top color=white, bottom color=kit-green30, draw=kit-green100, thick},
redshading/.style={shade, top color=white, bottom color=kit-red30, draw=kit-red100, thick},
yellowshading/.style={shade, top color=white, bottom color=kit-yellow30, draw=kit-orange100, thick},
%% Boxes
roundbox/.style={rectangle, rounded corners=.5ex},
%% PCM Actions
seffaction/.style={rectangle split, rectangle split parts=2, rectangle split part align={center}, text centered, rounded corners},
pcmball/.style={shade, ball color=kit-blue100,circle,fill},
startaction/.style={pcmball,minimum size=1ex},
stopaction/.style={startaction,draw=black,double},
%% Petri net/Queueing Petri net symbols
pnplace/.style={circle, draw, minimum size=2em},
pntrans/.style={rectangle, draw, minimum height=2em},
qpnplace/.style={circle vertical split, draw, minimum size=2em},
subnetplace/.style={qpnplace, double},
}
%% Baseline adaptation for PCM symbols
\tikzstyle{pcm} = [baseline=-.2ex]
%% Ragged left text for boxes
\tikzoption{text badly
raggedleft}[]{\def\tikz@text@action{\raggedleft\relax}}
\tikzoption{text raggedleft}[]%
{\def\tikz@text@action{\raggedleft\rightskip\z@ plus2em
\spaceskip.3333em \xspaceskip.5em\relax}}
%% Layers
\pgfdeclarelayer{l1}
\pgfdeclarelayer{l2}
\pgfdeclarelayer{l3}
\pgfdeclarelayer{l4}
\pgfdeclarelayer{l5}
\pgfdeclarelayer{l6}
\pgfdeclarelayer{l7}
\pgfdeclarelayer{l8}
\pgfdeclarelayer{l9}
\pgfsetlayers{main,l1,l2,l3,l4,l5,l6,l7,l8,l9}
% Internal Action
\newcommand{\pcmintaction}[2][]{
\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {};
\draw[thick] (#2.north) -- ([yshift=.5ex]#2.north);
\draw[thick] (#2.south) -- ([yshift=-.5ex]#2.south);
}
\newcommand{\pcmextaction}[2][]{
\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {};
\draw[thick,<-] (#2.north) -- ([yshift=1ex]#2.north);
\draw[thick,->] (#2.south) -- ([yshift=-.8ex]#2.south);
\draw[ultra thick,->,color=red!70!black] (#2.east) -- ([xshift=1ex]#2.east);
}
\newcommand{\pcmloopaction}[2][]{
\node[pcmball, minimum size=.7ex, text width=0ex, #1] (#2) {}
edge [->, in=30, out=90, looseness=1, distance=2ex, thick] node {} (#2);
}
\newcommand{\pcmiterator}[2][]{
\begin{scope}[decoration={
markings, mark=at position .5 with {\arrow[red, line width=.2ex]{>}}}, #1]
\node[matrix,draw=black!75, row sep=.3ex, inner sep=.3ex] (#2) {
\draw[red,thick] (0,0) -- (.7ex,0);\\
\draw[red,thick] (0,0) -- (.7ex,0);\\
\draw[red,thick] (0,0) -- (.7ex,0);\\ };
\draw [thick,black!75,postaction=decorate]
(#2.south) .. controls (0,-1.5ex) and (1.4ex,-1.5ex) ..
(1.4ex,0) .. controls (1.4ex,1.5ex) and (0,1.5ex) .. (#2.north);
\end{scope}
}
\newcommand{\pcmbranch}[2][]{
{\pgfsetcornersarced{\pgfpointorigin}
\scriptsize
\node[diamond, shade, ball color=kit-blue100, inner sep=.1ex, text width=1.2ex, #1] (#2) {\color{white}\scriptsize\textbf?};
\draw[thick] (#2.north) -- ([yshift=.8ex]#2.north);
\draw[thick] (#2.south west) -- ([xshift=-.7ex,yshift=-.7ex]#2.south west);
\draw[thick] (#2.south east) -- ([xshift=.7ex, yshift=-.7ex]#2.south east);
}
}
\newcommand{\pcmfork}{
\begin{scope}[very thick,black!75]
\draw (0,0) -- (0,.4em) -- (1em,.4em) -- (1em,0em);
\draw (.33em,.4em) -- (.33em,0em);
\draw (.66em,.4em) -- (.66em,0em);
\draw (.5em,1em) -- (.5em,.4em);
\draw (.2em,.75em) -- (.5em,.45em) -- (.8em,.75em);
\end{scope}
}
\newcommand{\pcmnote}{
{\pgfsetcornersarced{\pgfpointorigin}
\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;
\draw[black!75, thick] (2ex,1ex) -- (1.5ex,1ex) -- (1.5ex,1.5ex);
}
}
\newcommand{\pcmstart}[2][]{
\node[startaction, text width=0cm, #1] (#2) {};
}
\newcommand{\pcmstop}[2][]{
\node[stopaction, text width=0cm, #1] (#2) {};
}
\newcommand{\pcmsetvar}[2][]{
\node[rectangle,draw=gray,ultra thick,dashed,#1] (#2) {\$x};
}
\newcommand{\pcmacq}{
\begin{scope}[every token/.style={color=kit-blue100,minimum size=.2ex}]
\node[place, minimum size=1em,shade,
bottom color=kit-blue30,top color=white,shading angle=30] {}
[children are tokens, token distance=.4ex]
child {node [token] {}}
child {node [token] {}}
child {node (inlier) [token] {}}
child {node [token] {}}
child {node [token] {}}
child {node [token] {}}
child {node [token] {}};
\node[token] (outlier) at (.6em,.6em) {};
\draw[->, red, very thick] (inlier) -- (outlier);
\end{scope}
}
\newcommand{\pcmrel}{
\begin{scope}[every token/.style={color=kit-blue100,minimum size=.2ex}]
\node[place, minimum size=1em,shade,
bottom color=kit-blue30,top color=white,shading angle=30] {}
[children are tokens, token distance=.4ex]
child {node [token] {}}
child {node [token] {}}
child {node (inlier) [token] {}}
child {node [token] {}}
child {node [token] {}}
child {node [token] {}}
child {node [token] {}};
\node[token] (outlier) at (.6em,.6em) {};
\draw[<-, red, very thick] (inlier) -- (outlier);
\end{scope}
}
\newcommand{\pcmdice}{
\tikzset{point/.style={circle,fill=black,minimum size=.4ex,inner sep=0pt}}
\begin{scope}[every node/.append style={yslant=-0.5},yslant=-0.5]
\shade[right color=white, left color=kit-blue30, draw=black,
rounded corners=.1ex] (0,0) rectangle +(1em,1em);
\node [point] at (.25em,.25em) {};
\node [point] at (.25em,.75em) {};
\node [point] at (.5em,.5em) {};
\node [point] at (.75em,.25em) {};
\node [point] at (.75em,.75em) {};
\end{scope}
\begin{scope}[every node/.append style={yslant=0.5},yslant=0.5]
\shade[left color=white, right color=kit-blue30, draw=black,
rounded corners=.1ex] (1em,-1em) rectangle +(1em,1em);
\node [point] at (1.25em,-.25em) {};
\node [point] at (1.25em,-.75em) {};
\node [point] at (1.75em,-.25em) {};
\node [point] at (1.75em,-.75em) {};
\end{scope}
\begin{scope}[every node/.append style={
yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
]
\shade[bottom color=white, top color=kit-blue30, draw=black,
rounded corners=.1ex] (2em,1em) rectangle +(-1em,-1em);
\node [point] at (1.25em,.25em) {};
\node [point] at (1.25em,.75em) {};
\node [point] at (1.5em,.25em) {};
\node [point] at (1.5em,.75em) {};
\node [point] at (1.75em,.25em) {};
\node [point] at (1.75em,.75em) {};
\end{scope}
\draw[thick, color=black] (.5em,-.25em) -- +(-.7ex,-.7ex);
\draw[thick, color=black] (1.5em,-.25em) -- +(.7ex,-.7ex);
}
\newcommand{\pcmcertsign}{
\begin{scope}[rotate=30]
\node [draw, red, thick, circle, rotate=30] (certified) at (0,0) {\scriptsize CERTIFIED};
\draw [red, thick] (.67,.2) arc (16.6:163.4:7mm) -- cycle;
\draw [red, thick] (-.67,-.2) arc (196.6:343.4:7mm) -- cycle;
\end{scope}
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Position
\newcommand{\pcmcomponentsymbol}[3]{
\node[rectangle, minimum width=1.2em, minimum height=1.2em, #1]
(#2) #3 {};
\filldraw[#1]
($(#2)+(-1em,.1em)$) rectangle +(.7em,.3em)
($(#2)+(-1em,-.1em)$) rectangle +(.7em,-.3em);
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Text
% #4 = oberer Layer
% #5 = unterer Layer
% #6 = Position
\newcommand{\pcmcomponentbodyonlayers}[6]{
\begin{pgfonlayer}{#4}
\node[minimum width=4em] (#2text) #6 {\small #3};
\pcmcomponentsymbol{fill=white, draw=black}{#2componentsymbol}{at ($(#2text.east)+(-1em,1.5em)$)}
\end{pgfonlayer}
\begin{pgfonlayer}{#5}
\node[draw=black, rectangle, inner sep = .2em, #1] (#2) [fit=(#2text) (#2componentsymbol)] {};
\end{pgfonlayer}
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Text
% #4 = Position
\newcommand{\pcmcomponentbody}[4]{
\pcmcomponentbodyonlayers{#1}{#2}{#3}{l4}{l3}{#4}
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Position
\newcommand{\pcmlolliwest}[3]{
\node[circle, minimum size=1ex, draw, anchor=east, xshift=-1em, #1] (#2) at #3 {};
\draw[#1] #3 -- (#2);
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Position
\newcommand{\pcmarceast}[3]{
\node[xshift=1em] (#2) at #3 {};
\draw[#1] #3 -- (#2.center);
\draw[#1, fill opacity=transparent] ($(#2)+(1.4ex,1.4ex)$) arc (90:270:1.4ex);
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Text
% #4 = oberer Layer
% #5 = unterer Layer
% #6 = Position
\newcommand{\pcmcomponentonlayers}[6]{
\pcmcomponentbodyonlayers{#1}{#2}{#3}{#4}{#5}{#6}
\begin{pgfonlayer}{#5}
\pcmlolliwest{#1}{#2lolli}{(#2.west)}
\pcmarceast{#1}{#2arc}{(#2.east)}
\end{pgfonlayer}
}
% #1 = Formatierung
% #2 = Name des Nodes
% #3 = Text
% #4 = Position
\newcommand{\pcmcomponent}[4]{
\pcmcomponentonlayers{#1}{#2}{#3}{l4}{l3}{#4}
}
% Extrudieren von rechteckigen Shapes
%
% #1 = Name des Nodes
% #2 = Abstand
% #3 = Zeichenoptionen
\newcommand{\pcmextrude}[3]{
\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)$);
}
% Dummy-Bild
\newcommand{\dummypic}[2]{
\tikz \draw[kit-red100] (0,0) -- (#1,0) -- (#1,#2) -- (0,#2) -- (0,0) -- (#1,#2) (0,#2) -- (#1,0);
}