summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/tikzlibrarypetri.code.tex
blob: 80c34c175e1edc1e2aeaffe5b7fb2ad44ad9eac9 (plain)
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
% Copyright 2018 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS{tikzlibrarypetri.code.tex}


% Styles for places:

\tikzset{every place/.style=           {}}%
\tikzset{place/.style=                 {circle,draw,inner sep=0pt,
                                        minimum size=5ex,
                                        every place}}%


% Styles for transition:

\tikzset{every transition/.style=      {}}%
\tikzset{transition/.style=            {rectangle,draw,inner sep=0pt,
                                        minimum size=4mm,
                                        every transition}}%


% Styles for relationship types:

\tikzset{pre/.style=                   {<-,shorten <=1pt}}%
\tikzset{post/.style=                  {->,shorten >=1pt}}%
\tikzset{pre and post/.style=          {<->,shorten >=1pt,shorten <=1pt}}%



% Styles for marks:

\tikzset{every token/.style=           {}}%
\tikzset{token/.style=                 {fill=black,draw=none,circle,
                                        inner sep=0.5pt,minimum size=1ex,
                                        text=white,font=\pgfutil@font@tiny,every token}}%

\tikzoption{token distance}{\def\tikz@token@distance{#1}}%
\def\tikz@token@distance{1.5ex}%

\tikzset{children are tokens/.style=   {growth function=\tikz@grow@tokens,edge from parent path=}}%

\tikzoption{tokens}{%
  \ifnum#1>0\relax%
    \tikzset{append after command={}
     {[children are tokens]child foreach \tikz@dummy in {1,...,#1} {node[token]{}}}}%
  \fi}%

\tikzoption{colored tokens}{%
  \tikzset{append after command={}%
    {[children are tokens]child foreach \tikz@child@color in {#1} {node[token,\tikz@child@color]{}}}}%
  }%

\tikzoption{structured tokens}{%
  \tikzset{append after command={}%
    {[children are tokens]child foreach \tikzpetrichildname in {#1} {node[token]{\tikzpetrichildname}}}}%
  }%


\def\tikz@grow@tokens{%
  \pgfmathsetlength{\pgf@xa}{\tikz@token@distance}%
  \pgfmathsetlength{\pgf@ya}{\tikz@token@distance}%
  \pgf@xc=0pt%
  \pgf@yc=0pt%
  \csname tikz@grow@tokens@placer@\the\tikznumberofchildren @\the\tikznumberofcurrentchild\endcsname%
  \pgftransformshift{\pgfqpoint{\pgf@xc}{\pgf@yc}}%
}%

\def\tikz@def@grow@tokens#1#2#3#4{%
  \expandafter\def\csname tikz@grow@tokens@placer@#1@#2\endcsname{%
    \pgf@xc=#3\pgf@xa%
    \pgf@yc=#4\pgf@ya}%
}%


% Single token
\tikz@def@grow@tokens{1}{1}{0}{0}%

% Two tokens
\tikz@def@grow@tokens{2}{1}{-.5}{0}%
\tikz@def@grow@tokens{2}{2}{.5}{0}%

% Three tokens
\tikz@def@grow@tokens{3}{1}{0} {0.57}%
\tikz@def@grow@tokens{3}{2}{-.5}{-.306025}%
\tikz@def@grow@tokens{3}{3}{.5} {-.306025}%

% Four tokens
\tikz@def@grow@tokens{4}{1}{-.5}{.5}%
\tikz@def@grow@tokens{4}{2}{.5}{.5}%
\tikz@def@grow@tokens{4}{3}{-.5}{-.5}%
\tikz@def@grow@tokens{4}{4}{.5}{-.5}%

% Five tokens
\tikz@def@grow@tokens{5}{1}{0}{.85}%
\tikz@def@grow@tokens{5}{2}{-0.808398}{0.26266}%
\tikz@def@grow@tokens{5}{3}{0.808398}{0.26266}%
\tikz@def@grow@tokens{5}{4}{-0.499617}{-0.687664}%
\tikz@def@grow@tokens{5}{5}{0.499617}{-0.687664}%

% Six tokens
\tikz@def@grow@tokens{6}{1}{-1}{.5}%
\tikz@def@grow@tokens{6}{2}{0}{.5}%
\tikz@def@grow@tokens{6}{3}{1}{.5}%
\tikz@def@grow@tokens{6}{4}{-1}{-.5}%
\tikz@def@grow@tokens{6}{5}{0}{-.5}%
\tikz@def@grow@tokens{6}{6}{1}{-.5}%

% Seven tokens
\tikz@def@grow@tokens{7}{1}{0}{1}%
\tikz@def@grow@tokens{7}{2}{-1}{.5}%
\tikz@def@grow@tokens{7}{3}{0}{0}%
\tikz@def@grow@tokens{7}{4}{1}{.5}%
\tikz@def@grow@tokens{7}{5}{-1}{-.5}%
\tikz@def@grow@tokens{7}{6}{0}{-1}%
\tikz@def@grow@tokens{7}{7}{1}{-.5}%

% Eight tokens
\tikz@def@grow@tokens{8}{1}{-.5}{1}%
\tikz@def@grow@tokens{8}{2}{.5}{1}%
\tikz@def@grow@tokens{8}{3}{-1}{0}%
\tikz@def@grow@tokens{8}{4}{0}{0}%
\tikz@def@grow@tokens{8}{5}{1}{0}%
\tikz@def@grow@tokens{8}{6}{-1}{-1}%
\tikz@def@grow@tokens{8}{7}{0}{-1}%
\tikz@def@grow@tokens{8}{8}{1}{-1}%

% Eight tokens
\tikz@def@grow@tokens{9}{1}{-1}{1}%
\tikz@def@grow@tokens{9}{2}{0}{1}%
\tikz@def@grow@tokens{9}{3}{1}{1}%
\tikz@def@grow@tokens{9}{4}{-1}{0}%
\tikz@def@grow@tokens{9}{5}{0}{0}%
\tikz@def@grow@tokens{9}{6}{1}{0}%
\tikz@def@grow@tokens{9}{7}{-1}{-1}%
\tikz@def@grow@tokens{9}{8}{0}{-1}%
\tikz@def@grow@tokens{9}{9}{1}{-1}%


\endinput