% Copyright 2006 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[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibrarytikzpetri.code.tex,v 1.5 2007/03/09 17:49:32 tantau Exp $


% Styles for places:

\tikzstyle{every place}=           []
\tikzstyle{place}=                 [circle,draw,inner sep=0pt,
                                    minimum size=5ex,
                                    every place]


% Styles for transition:

\tikzstyle{every transition}=      []
\tikzstyle{transition}=            [rectangle,draw,inner sep=0pt,
                                    minimum size=4mm,
                                    every transition]


% Styles for relationship types:

\tikzstyle{pre}=                   [<-,shorten <=1pt]
\tikzstyle{post}=                  [->,shorten >=1pt]
\tikzstyle{pre and post}=          [<->,shorten >=1pt,shorten <=1pt]



% Styles for marks:

\tikzstyle{every token}=           []
\tikzstyle{token}=                 [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}

\tikzstyle{children are tokens}=   [growth function=\tikz@grow@tokens,edge from parent path=]

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

\tikzoption{colored tokens}{%
  \tikz@add@after@node@path{%
    {[children are tokens]child foreach \tikz@child@color in {#1} {node[token,\tikz@child@color]{}}}}%
  }

\tikzoption{structured tokens}{%
  \tikz@add@after@node@path{%
    {[children are tokens]child foreach \tikz@child@name in {#1} {node[token]{\tikz@child@name}}}}%
  }


\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
