| 1 |
% Manual of pgf-umlsd.sty, a convenient set of macros for drawing UML |
| 2 |
% sequence diagrams. |
| 3 |
% Written by Xu Yuan <[email protected]> from |
| 4 |
% Southeast University, China. |
| 5 |
% This file is part of pgf-umlsd |
| 6 |
% you may get it at http://code.google.com/p/pgf-umlsd/ |
| 7 |
|
| 8 |
\documentclass{article} |
| 9 |
\usepackage[margin=12mm]{geometry} |
| 10 |
\usepackage{hyperref} |
| 11 |
|
| 12 |
\usepackage[underline=true,rounded corners=false]{pgf-umlsd} |
| 13 |
|
| 14 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 15 |
\usepackage{listings} |
| 16 |
\usepackage{color} |
| 17 |
\definecolor{listinggray}{gray}{0.92} |
| 18 |
\lstset{ % |
| 19 |
language=[LaTeX]TeX, |
| 20 |
breaklines=true, |
| 21 |
frame=single, |
| 22 |
% frameround=tttt, |
| 23 |
basicstyle=\footnotesize\ttfamily, |
| 24 |
backgroundcolor=\color{listinggray}, |
| 25 |
keywordstyle=\color{blue} |
| 26 |
} |
| 27 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 28 |
|
| 29 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 |
\hypersetup{ |
| 31 |
colorlinks=true, |
| 32 |
linkcolor=blue, |
| 33 |
anchorcolor=black, |
| 34 |
citecolor=olive, |
| 35 |
filecolor=magenta, |
| 36 |
menucolor=red, |
| 37 |
urlcolor=blue |
| 38 |
} |
| 39 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 40 |
|
| 41 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 42 |
\newcommand{\demo}[2][1]{ |
| 43 |
\begin{center} |
| 44 |
\begin{tabular}{cc} |
| 45 |
\begin{minipage}{.49\linewidth} |
| 46 |
\centering |
| 47 |
\resizebox{#1\linewidth}{!}{ |
| 48 |
\input{demo/#2} |
| 49 |
} |
| 50 |
\end{minipage} |
| 51 |
& |
| 52 |
\begin{minipage}{.45\linewidth} |
| 53 |
\lstinputlisting{demo/#2} |
| 54 |
\end{minipage} |
| 55 |
\end{tabular} |
| 56 |
\end{center} |
| 57 |
} |
| 58 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 59 |
|
| 60 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 61 |
\newcommand{\example}[2][1]{ |
| 62 |
\begin{center} |
| 63 |
\resizebox{#1\linewidth}{!}{ |
| 64 |
\input{demo/#2} |
| 65 |
} |
| 66 |
\end{center} |
| 67 |
\lstinputlisting{demo/#2} |
| 68 |
} |
| 69 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 70 |
|
| 71 |
\begin{document} |
| 72 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 73 |
\title{Drawing UML Sequence Diagram by using \texttt{pgf-umlsd}} |
| 74 |
\author{\href{mailto:[email protected]}{Yuan Xu}} |
| 75 |
\date{\today{}~(v0.7)} |
| 76 |
\maketitle |
| 77 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 78 |
|
| 79 |
\begin{abstract} |
| 80 |
\texttt{pgf-umlsd} is a LaTeX package for drawing UML Sequence |
| 81 |
Diagrams. As stated by its name, it is based on a very popular |
| 82 |
graphic package \texttt{PGF/TikZ}. This document presents the usage |
| 83 |
of \texttt{pgf-umlsd} and collects some UML sequence diagrams as |
| 84 |
examples. \texttt{pgf-umlsd} can be downloaded from |
| 85 |
\href{http://code.google.com/p/pgf-umlsd/}{http://code.google.com/p/pgf-umlsd/}. |
| 86 |
\end{abstract} |
| 87 |
|
| 88 |
\tableofcontents |
| 89 |
|
| 90 |
\section{The Essentials} |
| 91 |
\subsection{Basic graphics objects} |
| 92 |
\subsubsection{empty diagram} |
| 93 |
\demo{empty} |
| 94 |
|
| 95 |
\subsubsection{thread} |
| 96 |
\demo[0.3]{thread} |
| 97 |
|
| 98 |
\subsubsection{instance} |
| 99 |
\demo[0.3]{instance} |
| 100 |
|
| 101 |
\subsubsection{distance between threads and instances} |
| 102 |
\demo{distance} |
| 103 |
|
| 104 |
\subsubsection{customization} |
| 105 |
The package has two options for customization: \texttt{underline} and |
| 106 |
\texttt{rounded corners}, further customization see the example below: |
| 107 |
|
| 108 |
\demo{customize} |
| 109 |
|
| 110 |
|
| 111 |
\subsection{Call} |
| 112 |
\subsubsection{call} |
| 113 |
\demo[0.6]{call} |
| 114 |
|
| 115 |
\subsubsection{call self} |
| 116 |
\demo[0.6]{callself} |
| 117 |
|
| 118 |
\subsubsection{message call} |
| 119 |
\demo[0.6]{messcall} |
| 120 |
|
| 121 |
\subsubsection{nested call} |
| 122 |
\demo[0.6]{nested-call} |
| 123 |
|
| 124 |
\subsection{Message} |
| 125 |
\demo[0.6]{message} |
| 126 |
|
| 127 |
Sometimes however, it takes a considerable amount of time to reach the |
| 128 |
receiver (relatively speaking of course) . For example, a message |
| 129 |
across a network. Such a non-instantaneous message is drawn as a |
| 130 |
slanted arrow. |
| 131 |
|
| 132 |
\demo[0.6]{non-instantaneous-message} |
| 133 |
|
| 134 |
\subsection{Block} |
| 135 |
\demo[0.6]{block} |
| 136 |
|
| 137 |
\section{Manually adjustment} |
| 138 |
The idea of \texttt{pgf-umlsd} is users only have to write the logic |
| 139 |
of diagram, the program generates figure automatically. However, the |
| 140 |
package can not handle all the use case, it still needs to be adjusted |
| 141 |
manually. |
| 142 |
|
| 143 |
\subsection{Level} |
| 144 |
If the text on the arrows is more than one line (large function name |
| 145 |
for example) it will overlap other things. \texttt{postlevel} can be |
| 146 |
used to make the time (level) later. |
| 147 |
|
| 148 |
\demo[0.6]{postlevel} |
| 149 |
|
| 150 |
In the situation of multi-threads, some events happen at the same |
| 151 |
time. \texttt{prelevel} can make the call earlier. |
| 152 |
|
| 153 |
\demo[0.6]{prelevel} |
| 154 |
|
| 155 |
\subsection{Bias of thread line} |
| 156 |
In the situation of multi-threads, the instance cen be accessed at the |
| 157 |
same time (e.g. two threads reading data at the same time). Currently, |
| 158 |
we have to adjust the bias of thread line manually for this. Possible |
| 159 |
parameters for \texttt{setthreadbias} are: \texttt{center}, |
| 160 |
\texttt{west} and \texttt{east}. |
| 161 |
|
| 162 |
\demo[0.8]{threadbias} |
| 163 |
|
| 164 |
\section{Examples} |
| 165 |
\subsection{Single thread} |
| 166 |
\example[0.8]{single-thread-example} |
| 167 |
|
| 168 |
\subsection{Multi-threads} |
| 169 |
\example[0.8]{multi-threads-example} |
| 170 |
|
| 171 |
\subsection{Annotation} |
| 172 |
\example[0.5]{sync-clock} |
| 173 |
|
| 174 |
\subsection{Known Issue} |
| 175 |
\texttt{pgf-umlsd} confilts with tikz \texttt{backgrounds} library. |
| 176 |
|
| 177 |
\section{Acknowledgements} |
| 178 |
Many people contributed to \texttt{pgf-umlsd} by reporting problems, |
| 179 |
suggesting various improvements or submitting code. Here is a list of |
| 180 |
these people: |
| 181 |
\href{mailto:[email protected]}{Nobel Huang}, |
| 182 |
\href{mailto:[email protected]}{Dr. Ludger Humbert}, |
| 183 |
\href{mailto:[email protected]}{MathStuf}, |
| 184 |
\href{mailto:[email protected]}{Vlado Handziski}, |
| 185 |
\href{mailto:[email protected]}{Frank Morgner}, |
| 186 |
and \href{mailto:[email protected]}{Dirk Petrautzki}. |
| 187 |
|
| 188 |
\end{document} |
| 189 |
%%% Local Variables: |
| 190 |
%%% mode: Tex-PDF |
| 191 |
%%% TeX-master: t |
| 192 |
%%% End: |