summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.tex
blob: 8d3bcf39cba9210dcd64642c3316b703f6e331d2 (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
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
% Manual 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[margin=12mm]{geometry}
\usepackage{hyperref}

\usepackage[underline=true,rounded corners=false]{pgf-umlsd}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\usepackage{color}
\definecolor{listinggray}{gray}{0.92}
\lstset{ %
language=[LaTeX]TeX,
breaklines=true,
frame=single,
% frameround=tttt,
basicstyle=\footnotesize\ttfamily,
backgroundcolor=\color{listinggray},
keywordstyle=\color{blue}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  anchorcolor=black,
  citecolor=olive,
  filecolor=magenta,
  menucolor=red,
  urlcolor=blue
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\demo}[2][1]{
  \begin{center}
  \begin{tabular}{cc}
    \begin{minipage}{.49\linewidth}
      \centering
      \resizebox{#1\linewidth}{!}{
        \input{demo/#2}
      }
    \end{minipage}
    &
    \begin{minipage}{.45\linewidth}
      \lstinputlisting{demo/#2}
    \end{minipage}
  \end{tabular}
  \end{center}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\example}[2][1]{
  \begin{center}  
    \resizebox{#1\linewidth}{!}{
      \input{demo/#2}
    }
  \end{center}
  \lstinputlisting{demo/#2}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{Drawing UML Sequence Diagram by using \texttt{pgf-umlsd}}
\author{\href{mailto:xuyuan.cn@gmail.com}{Yuan Xu}}
\date{\today{}~(v0.7)}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{abstract}
  \texttt{pgf-umlsd} is a LaTeX package for drawing UML Sequence
  Diagrams. As stated by its name, it is based on a very popular
  graphic package \texttt{PGF/TikZ}. This document presents the usage
  of \texttt{pgf-umlsd} and collects some UML sequence diagrams as
  examples. \texttt{pgf-umlsd} can be downloaded from
  \href{http://code.google.com/p/pgf-umlsd/}{http://code.google.com/p/pgf-umlsd/}.
\end{abstract}

\tableofcontents

\section{The Essentials}
\subsection{Basic graphics objects}
\subsubsection{empty diagram}
\demo{empty}

\subsubsection{thread}
\demo[0.3]{thread}

\subsubsection{instance}
\demo[0.3]{instance}

\subsubsection{distance between threads and instances}
\demo{distance}

\subsubsection{customization}
The package has two options for customization: \texttt{underline} and
\texttt{rounded corners}, further customization see the example below:

\demo{customize}


\subsection{Call}
\subsubsection{call}
\demo[0.6]{call}

\subsubsection{call self}
\demo[0.6]{callself}

\subsubsection{message call}
\demo[0.6]{messcall}

\subsubsection{nested call}
\demo[0.6]{nested-call}

\subsection{Message}
\demo[0.6]{message}

Sometimes however, it takes a considerable amount of time to reach the
receiver (relatively speaking of course) . For example, a message
across a network. Such a non-instantaneous message is drawn as a
slanted arrow.

\demo[0.6]{non-instantaneous-message}

\subsection{Block}
\demo[0.6]{block}

\section{Manually adjustment}
The idea of \texttt{pgf-umlsd} is users only have to write the logic
of diagram, the program generates figure automatically. However, the
package can not handle all the use case, it still needs to be adjusted
manually.

\subsection{Level}
If the text on the arrows is more than one line (large function name
for example) it will overlap other things. \texttt{postlevel} can be
used to make the time (level) later.

\demo[0.6]{postlevel}

In the situation of multi-threads, some events happen at the same
time. \texttt{prelevel} can make the call earlier.

\demo[0.6]{prelevel}

\subsection{Bias of thread line}
In the situation of multi-threads, the instance cen be accessed at the
same time (e.g. two threads reading data at the same time). Currently,
we have to adjust the bias of thread line manually for this. Possible
parameters for \texttt{setthreadbias} are: \texttt{center},
\texttt{west} and \texttt{east}.

\demo[0.8]{threadbias}

\section{Examples}
\subsection{Single thread}
\example[0.8]{single-thread-example}

\subsection{Multi-threads}
\example[0.8]{multi-threads-example}

\subsection{Annotation}
\example[0.5]{sync-clock}

\subsection{Known Issue}
\texttt{pgf-umlsd} confilts with tikz \texttt{backgrounds} library.

\section{Acknowledgements}
Many people contributed to \texttt{pgf-umlsd} by reporting problems,
suggesting various improvements or submitting code. Here is a list of
these people:
\href{mailto:nobel1984@gmail.com}{Nobel Huang},
\href{mailto:humbert@uni-wuppertal.de}{Dr. Ludger Humbert},
\href{mailto:MathStuf@gmail.com}{MathStuf},
\href{mailto:vlado.handziski@gmail.com}{Vlado Handziski},
\href{mailto:frankmorgner@gmail.com}{Frank Morgner},
and \href{mailto:petrautzki@hs-coburg.de}{Dirk Petrautzki}.

\end{document}
%%% Local Variables: 
%%% mode: Tex-PDF
%%% TeX-master: t
%%% End: