Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

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