summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgf-umlsd/pgf-umlsd-demo.tex
blob: 6c807d65e40c6fbe7cc4df20c165d2ff9f352188 (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
% Demonstration of pgf-umlsd.sty, a convenient set of macros for drawing
% UML sequence diagrams. Written by Xu Yuan <xuyuan.cn@gmail.com> from
% Southeast University, China.
% This file is part of pgf-umlsd
% you may get it at
% http://code.google.com/p/pgf-umlsd/

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows,shadows} % for pgf-umlsd
\usepackage[underline=true,rounded corners=false]{pgf-umlsd}

\begin{document}

\begin{figure}
  \centering
  \begin{sequencediagram}
    \newthread{ss}{:SimulationServer}
    \newinst{ctr}{:SimControlNode}
    \newinst{ps}{:PhysicsServer}
    \newinst[1]{sense}{:SenseServer}
    
    \begin{call}{ss}{Initialize()}{sense}{}
    \end{call}
    \begin{sdblock}{Run Loop}{The main loop}
      \begin{call}{ss}{StartCycle()}{ctr}{}
        \begin{call}{ctr}{ActAgent()}{sense}{}
        \end{call}
      \end{call}
      \begin{call}{ss}{Update()}{ps}{}
        \begin{messcall}{ps}{PrePhysicsUpdate()}{sense}{state}
        \end{messcall}
        \begin{sdblock}{Physics Loop}{}
          \begin{callself}{ps}{PhysicsUpdate()}{}
          \end{callself}
        \end{sdblock}
        \begin{call}{ps}{PostPhysicsUpdate()}{sense}{}
        \end{call}
      \end{call}
      \begin{call}{ss}{EndCycle()}{ctr}{}
        \begin{call}{ctr}{SenseAgent()}{sense}{}
        \end{call}
      \end{call}
    \end{sdblock}
  \end{sequencediagram}
  \caption{UML sequence diagram demo. The used style-file is 
    \texttt{pgf-umlsd.sty}, you may get it at
    http://code.google.com/p/pgf-umlsd/}
\end{figure}

\begin{figure}
  \centering
  \begin{sequencediagram}
    \tikzstyle{inststyle}+=[bottom color=yellow] % custom the style
    \newthread[blue]{ss}{:SimulationServer}
    \newinst{ps}{:PhysicsServer}
    \newinst[2]{sense}{:SenseServer}
    \newthread[red]{ctr}{:SimControlNode}
    
    \begin{sdblock}[green!20]{Run Loop}{The main loop}
      \mess{ctr}{StartCycle}{ss}
      \begin{call}{ss}{Update()}{ps}{}
        \prelevel
        \begin{callself}{ctr}{SenseAgent()}{}
          \begin{call}[3]{ctr}{Read}{sense}{}
          \end{call}
        \end{callself}
        \prelevel\prelevel\prelevel\prelevel
        \setthreadbias{west}
        \begin{call}{ps}{PrePhysicsUpdate()}{sense}{}
        \end{call}
        \setthreadbias{center}
        \begin{callself}{ps}{Update()}{}
          \begin{callself}{ps}{\small CollisionDetection()}{}
          \end{callself}
          \begin{callself}{ps}{Dynamics()}{}
          \end{callself}
        \end{callself}
        \begin{call}{ps}{PostPhysicsUpdate()}{sense}{}
        \end{call}
      \end{call}
      \mess{ss}{EndCycle}{ctr}
      \begin{callself}{ctr}{ActAgent()}{}
        \begin{call}{ctr}{Write}{sense}{}
        \end{call}
      \end{callself}
    \end{sdblock}

  \end{sequencediagram}
  \caption{Example of a sequence with parallel activities and the
    customed style. The used style-file is \texttt{pgf-umlsd.sty}, you
    may get it at http://code.google.com/p/pgf-umlsd/}
\end{figure}

\end{document}

%%% Local Variables: 
%%% mode: Tex-PDF
%%% TeX-master: t
%%% End: