\synctex=1%
% Compil� avec makeDoc.pl -sujet=doc-uml uml
\documentclass[english]{tb}

\usepackage{pgfextra}
\usepackage{pgfuml}
\usepackage{doc-macros}
\usepackage{varioref}

\title{Documentation of the package \texttt{pgfuml}}

\author{Fabien Dagnat\footnote{\mailtb{fabien.dagnat}}}

\subtitle{}
\type{}
\matiere{}
\numero{}
\code{}
\withAuthors
\withDate

\begin{document}

\selectlanguage{english}

\maketitle

This package contains various macros to make it possible to create pgf
(\texttt{texdoc pgf} for a documentation of pgf) pictures representing
UML diagrams.

\section{Conventions on this documentation}
\label{sec:conv-this-docum}

All portions of code are presented with a light blue background. If
the result of the code portion is included, it has a light orange
background.

Each macro and environment defined in this package is configurable by
options. These options adopt the now classic notation
\texttt{keyval}. That is positioning macro option is done by providing
pairs of a key (the option's name) and a value. Here are two example:
\begin{codeexample}[code only]
\commande[opt1,opt2=unevaleur]{...}

\begin{environnement}[opt1,opt2=unevaleur]
  ...
\end{environnement}
\end{codeexample}

In this document, each option is presented with its name, its type,
its default value and its description. As latex is not a typed
language, the type is only informative about the form of value you can
pass to the option. For boolean, the value is optional and if it is
absent, it is considered as being true.

\section{Classes}
\label{sec:les-classes}

A UML class is created by the macro \macro{umlclass}. This macro must
be called in a \texttt{tikzpicture} environment. This macro has two
arguments: a list of options (optional) and a body. The list of
options (described below) define properties of the class such as its
name, stereotypes\dots{} The body is the text corresponding to the
content of the class (its attributes and methods).

When displayed, the class is separated in parts. There may be from one
to four parts. The first part contains the name of the class and its
stereotypes, the second part consists in the attributes, the third of
the methods and the fourth is an extra part not commonly used in
diagrams. They are respectivelly named \texttt{text},
\texttt{attribute}, \texttt{method} and \texttt{extra}.

Here is a first example:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=The name of the class,label=label](0,0){
      with attributes\\
      a1\\
      a2
      \separator 
      tutu 
    }
\end{tikzpicture}%
\end{codeexample}

In the body of a class, the various parts must be separated by a macro
\macro{separator}. This macro has an optional parameter describing the
part concerned. The default value of this parameter is
\texttt{method}. See figure \vref{fig:parts}, for an example of a
class containing several separators.


The following options are supported by the macro \macro{umlclass}:
\begin{itemize}
\macrooption{name}{string}{empty} The name of the class.

\macrooption{abstract}{boolean}{false} A boolean indicating whether the
class is abstract or not. When true, \macro{itshape} is added to the
font for the name part.

\macrooption{interface}{boolean}{false} A boolean indicating whether the
class is an interface or not. When true, \macro{itshape} is added to
the font for the name part. Furthermore, an interface stereotype is
added in front of the other stereotypes.

\macrooption{stereotype}{text}{empty} The stereotype text for the
class. It can support line break using the \macro{tabularnewline}
command. A macro \macro{stereotype} is provided to add the
<<\,guillemets\,>>.  It is used on anything:
\begin{codeexample}
\stereotype{TUTU}%
\end{codeexample}

\macrooption{param}{string}{empty} The name of the generic parameter.

\macrooption{label}{string}{pgfuml@class} The label used for the
class. It is a usual \texttt{tikz} label and may be used to reference the
class in any command accepting such a label.

\macrooption{parts}{number (1-4)}{1} The number of displayed parts for
the class. If the body is non empty and the parts is not given, parts
is automatically set to 3. For other values, the option is
required. Figure \vref{fig:parts} contains a code that shows how is
displayed a class when one use the parts option.

\macrooption{name font}{macro}{\macro{ttfamily}\macro{bfseries}} The
macro is used as a font specification for the name part of the
class. By default, a typewriter bold font is used to typeset the name
part of the class. Beware, that some font does not support bold
typewriter face and use only typewriter face.

\macrooption{body font}{macro}{\macro{ttfamily}} The macro is used as a
font specification for the body part of the class. By default, a
typewriter font is used to typeset the body part of the class.

\macrooption{fill}{color}{none} If fill is not none and is a colour,
this colour is used to fill the class.

\macrooption{param fill}{color}{white} If fill is not none and is a
colour, this colour is used to fill the generic parameter.

\macrooption{width}{length}{2cm} This length specifies the minimum width
of the class. Beware that you \textbf{must} provide a length (a number
and a unit).

\macrooption{name height}{length}{1.5em} This length specifies the
minimum height of the name part of the class. Beware that you
\textbf{must} provide a length (a number and a unit).

\end{itemize}

A more complex example can be proposed to show the use of the various
options:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=An abstract class,abstract,label=l,fill=green!30,name height=1cm](0,0){
    attribute part 
    \separator
    method part
  }
  \umlclass[name=List,interface,label=its label,param=E,param fill=graphicbackground](6,0){}
  \draw[very thick,<->] (l) -- (its label);
  \umlclass[name=Yet another class,param=T,width=5cm,
            stereotype={\stereotype{A first} \tabularnewline \stereotype{A second}},
            body font=\rm\large,name font=\sf\tiny](12,0){
    attribute part 
    \separator
    method part
  }
\end{tikzpicture}%
\end{codeexample}


\begin{figure}\centering
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \newcommand{\myclass}[2]{ \umlclass[name=Its name,label=its label,parts=#1](#2){ 
      attribute part \separator method part \separator[extra] extra part } 
  } 
  \foreach \parts/\coord in {1/{0,0},2/{4,0},3/{8,0},4/{12,0}} { \myclass{\parts}{\coord} }
\end{tikzpicture}%
\end{codeexample}
  \caption{Use of parts option}
\label{fig:parts}
\end{figure}

\section{Relations}

The second basic macro for UML class diagram is the notion of
relation. It specifies a relation between two classes that is
represented by a line.  In UML, several relations may be used. In the
\texttt{pgfuml} package, a common macro is used to typeset all
relations but this macro is not aimed to be used directly. The user is
invited to use the more specific relations that are defined:
associations, inheritance, \dots

The first subsection introduces the relation macro and its options and
then all specific relations are presented each in its subsection.


\subsection{Relations}

The macro \macro{umlrelation} takes an optional parameter describing
options to use and two mandatory parameters that must be given between
parenthesis. The two arguments may be any \texttt{tikz} coordinate
specification, but are aimed to be the labels of the classes to
relate. The following example demonstrates the basic use of the notion
of relation:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}
  \umlclass[name=M,label=m](3.5,0){}
  \umlclass[name=P,label=p](3.5,2){}
  \umlrelation(m)(n)
  \umlrelation(m)(p)
\end{tikzpicture}%
\end{codeexample}

Relations can be of the 8 following kinds (see figure
\vref{fig:rels}), the 3 firsts are determined automatically while the
5 lasts need an option specification (see below):
\begin{enumerate}
\item \emph{vertical}, \tikz \draw (0,0) -- (0,0.3); if the two linked
  classes have less than 1mm of difference between their x coordinate
  (\texttt{P} and \texttt{M} in the previous example).
\item \emph{horizontal}, \tikz \draw (0,0) -- (0.5,0); if the two
  linked classes have less than 1mm of difference between their y
  coordinate (\texttt{N} and \texttt{M} in the previous example).
\item \emph{L}, \tikz \draw (0,0) |- (0.5,0.3); in other cases classes
  are linked by an L.
\item \emph{O}, is a relation between a class and itself. It may
  appear on any of the four corners of the class.
\item \emph{D}, also known as direct relations corresponds to a
  direct line whatever the coordinates of its extremities.
\item \emph{S}, \tikz \draw (0,0) -| (0.25,0.15) |- (0.5,0.3); classes
  may also be linked by an S going through the middle of the segment
  joining them.
\item \emph{C vertical}, \tikz \draw (0,0) -| (-0.25,0.15) |- (0,0.3);
  classes may be linked by a vertical C going through a point that is at
  distance \texttt{C sep} (see \texttt{C sep} option explanation) of the
  middle of the segment joining them. Notice that the classes
  need not to be aligned.
\item \emph{C horizontal}, \tikz \draw (0,0) |- (0.25,0.3) -| (0.5,0);
  lastlty classes may be linked by an horizontal C going through a
  point that is at distance \texttt{C sep} (see \texttt{C sep} option
  explanation) of the middle of the segment joining them. Notice that
  the classes need not to be aligned.
\end{enumerate}

\begin{figure}
  \centering
\begin{codeexample}
\pgfkeys{/tikz/point/.style={fill=red,circle,inner sep=0pt,minimum size=2pt}}
\newcommand{\drawPoints}[2]{\draw (start) node[point] {}; \draw (middle) node[#1] {#2};
  \draw (middle) node[point] {};\draw (end) node[point] {};}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}    \umlclass[name=O,label=o](0,4){}
  \umlclass[name=M,label=m](5,0){}    \umlclass[name=P,label=p](5,2){}
  \umlclass[name=Q,label=q](10,3){}   \umlclass[name=R,label=r](10,-1){}
  \umlrelation(m)(n)                                 \drawPoints{above}{horizontal}
  \umlrelation(m)(p)                                 \drawPoints{right}{vertical}
  \umlrelation(n)(p)                                 \drawPoints{above right}{L}
  \umlrelation[inv route](m)(q)                      \drawPoints{above left}{L inv route}
  \umlrelation[CV](n)(o)                             \drawPoints{right}{CV}
  \umlrelation[CV,inv route](r)(q)                   \drawPoints{right}{CV inv route}
  \umlrelation[CH,C sep=1.5cm,start shift=2mm](p)(q) \drawPoints{above}{CH}
  \umlrelation[CH,C sep=1cm,inv route](n)(m)         \drawPoints{above}{CH inv route}
  \umlrelation[S](p)(r)                              \drawPoints{right}{S}
  \umlrelation[S,inv route,start shift=-2mm](p)(o)   \drawPoints{above}{S inv route}
  \umlrelation[D](p)(q)                              \drawPoints{}{D}
  \umlrelation[O](o)(o)                              \drawPoints{right}{O}
\end{tikzpicture}%
\end{codeexample}  
  \caption{The various kind of relations}
  \label{fig:rels}
\end{figure}

O relation and shifting options require that the corresponding
parameter reference points must correspond to a rectangular
shape\footnote{In fact, they must have a north east and a south west
  anchor.}. If you do not use shift or O option, you can use any
\texttt{tikz} coordinate as parameters to the \macro{umlrelation}
macro.


The following options are supported by the \macro{umlrelation} macro:
\begin{itemize}
  \macrooption{D}{boolean}{false} A boolean indicating whether the
  relation is a direct line whatever the coordinates of its
  extremities.

  \macrooption{O}{boolean}{false} A boolean indicating whether the
  relation is a self relation. Beware that, this kind of relation is
  build to be used between a class and itself, this means that both
  reference points must be equal and be a class label. In other cases,
  the result is unspecified.

  \macrooption{O anchor}{tikz position}{north east} A tikz position
  indicating the point used to determine the cycle relation position.
  Beware, that the option is meant to be used with the four corners
  (north east, north west, south east and south west). In other cases,
  the result is unspecified.

  \macrooption{O sep}{length}{1cm} The distance the point determining
  the cycle relation is from its anchor. In fact, this point will have
  the coordinate $anchor + (O~sep,O~sep)$.

  \macrooption{S}{boolean}{false} A boolean indicating whether the
  relation has an S form (\tikz \draw (0,0) -| (0.25,0.15) |-
  (0.5,0.3);).

  \macrooption{CV}{boolean}{false} A boolean indicating whether the
  relation has an C vertical form (\tikz \draw (0,0) -| (-0.25,0.15)
  |- (0,0.3);).

  \macrooption{CH}{boolean}{false} A boolean indicating whether the
  relation has an C horizontal form (\tikz \draw (0,0) |- (0.25,0.3)
  -| (0.5,0);).

  \macrooption{C sep}{length}{2cm} For C relation, the distance between
  the middle of the two classes and the middle of the relation (see
  figure \vref{fig:Crelation}).

  \macrooption{inv route}{boolean}{false} This boolean controls the path
  of the relation in case of an L (\tikz \draw (0,0) -| (0.5,0.3);
  instead of \tikz \draw (0,0) |- (0.5,0.3);), a S (\tikz \draw (0,0)
  |- (0.25,0.15) -| (0.5,0.3); instead of \tikz \draw (0,0) -|
  (0.25,0.15) |- (0.5,0.3);) or a C (\tikz \draw (0,0) |- (0.25,-0.3)
  -| (0.5,0); and \tikz \draw (0,0) -| (0.25,0.15) |- (0,0.3); instead
  of \tikz \draw (0,0) |- (0.25,0.3) -| (0.5,0); and \tikz \draw (0,0)
  -| (-0.25,0.15) |- (0,0.3);) kind of relation.

  \macrooption{start shift}{length}{0mm} \macrooption{end
    shift}{length}{0mm} \macrooption{shift}{length}{0mm} Extremities
  shifting specifications respectively for the start, the end and both
  sides. When used the relation start or end point is shifted by the
  given value staying on the shape border. This means that on west and
  east side, the shift is a y shift and on north and south border, it
  is a x shift. The given length may be negative.

  \macrooption{arrow}{tikz arrow}{empty} This option enable to set the
  arrow type of the relation. Any \texttt{tikz} arrow type
  specification may be used and we refer the interested reader to the
  \texttt{tikz} documentation.

  \macrooption{dashed}{boolean}{false} If true the relation is typeset
  dashed.

  \macrooption{name pos}{number between 0 and 1}{0.5} The position of
  the node named \texttt{name} along the segment from start to end of
  the relation. This option is meant mainly to be used indirectly in
  associations and implementations.
\end{itemize}

After the relation macro execution four temporary\footnote{As every
  relation macro uses these points, you should save them if you need
  them. Saving the point \texttt{p} can be done by putting a named
  coordinate node at its position: \texttt{\textbackslash draw (p)
    node[coordinate] (name) \{\};} for example.} points are defined:
\texttt{start}, \texttt{end}, \texttt{middle} and \texttt{name}. They
correspond intuitively to the two extremities and the (logical) middle
and are marked by a red point in the figure \vref{fig:rels}.

\begin{figure}
  \centering
\begin{codeexample}
\pgfkeys{/tikz/point/.style={fill=red,circle,inner sep=0pt,minimum size=2pt}}
\begin{tikzpicture}
  \begin{scope}[thick]
    \umlclass[name=N,label=n](0,0){}
    \umlclass[name=M,label=m](6,0){}
    \umlrelation[CH](m)(n)
  \end{scope}
  \draw (start) node[point] {}; \draw (end) node[point] {};
  \draw (middle) node[point] {};
  \draw[dashed] (m) -- node[coordinate] (middlemn) {} (n);
  \draw[<->] (middle) -- node[right] {\texttt{C sep}} (middlemn);
\end{tikzpicture}%
\end{codeexample}  
  \caption{A CH relation with \texttt{C sep} options explained}
  \label{fig:Crelation}
\end{figure}

\subsection{Associations}

The first relation macro aimed to be used by user for UML class
diagram is the notion of association. It specifies a relation between
two classes that support to be annotated. The possible annotations are
a name and cardinality and naming of the two extremities. Furthermore,
an association may be directed (includes a navigation symbol), a
composition or an aggregation. The macro \macro{umlasso} has the same
form of the relation macro as demonstrated by the following example:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n,width=1.5cm](0,0){}
  \umlclass[name=M,label=m](4,0){}
  \umlclass[name=P,label=p](4,2){}
  \umlasso[arity start=as,arity end=ae,name start=ns,
           name end=ne,nav start](m)(n)
  \umlasso[name=n1,shift=2mm](m)(p)
  \umlasso[name=n2,name anchor=left,shift=-2mm](m)(p)
\end{tikzpicture}%
\end{codeexample}

Associations are relations, in the sense that they will be represented
as relations and therefore have all the options of the relation macro
(except for arrows that are specified using specific options). And, in
fact, one have the 7 kinds of associations.

Similarly, to shifting and O relation, extremity annotations placement
is done automatically using the received arguments as class labels. If
no annotation, no shifting and no O is given one may use any
\texttt{tikz} coordinate as parameters to the \macro{umlasso} macro.

In the specific case of direct associations (option \texttt{D}), it is
not possible to find easily good positioning of the annotations. In
this case, they are not typeset and this has to be done by hands\dots

The following options are supported by the \macro{umlasso} macro:
\begin{itemize}
  \macrooption{name}{string}{empty} The name of the association.

  \macrooption{name pos}{number between 0 and 1}{0.5} The position of
  the name along the segment from start to end of the
  association. Figure \vref{fig:namepos} contains a description of
  some position for two S association and a C horizontal association.

  \macrooption{name anchor}{tikz position}{depends on the association} The
  position of the name of the association with respect to the middle
  (in the logical sense) of the association. The package tries to find
  automatically a good position (\texttt{above} for "horizontal"
  associations, \texttt{right} for vertical one and none for direct
  one).  But if this placement does not match your will, you can set
  it by hand. In figure \vref{fig:rels} the names are placed at the
  position association macro would have placed them (it can serve as
  reference).

\begin{figure}
  \centering
\begin{codeexample}
\pgfkeys{/tikz/point/.style={fill=red,circle,inner sep=0pt,minimum size=2pt}}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}
  \umlclass[name=P,label=p](6,2){}
  \umlasso[name=0.5,S](n)(p) \draw (start) node[point] {}; 
  \draw (name) node[point] {}; \draw (end) node[point] {};
  \umlasso[name=0.25,S,name pos=0.25](n)(p) \draw (name) node[point] {};
  \umlasso[name=0.75,S,name anchor=left,name pos=0.75](n)(p) \draw (name) node[point] {};
  \umlasso[name=0.125,S,name anchor=below,name pos=0.125](n)(p) \draw (name) node[point] {};
  \umlasso[name=0.875,S,name anchor=above,name pos=0.875](n)(p) \draw (name) node[point] {};

  \umlasso[name=0.5,S,inv route](n)(p) \draw (start) node[point] {}; 
  \draw (name) node[point] {}; \draw (end) node[point] {};
  \umlasso[name=0.25,S,inv route,name pos=0.25](n)(p) \draw (name) node[point] {};
  \umlasso[name=0.75,S,inv route,name anchor=below,name pos=0.75](n)(p) 
  \draw (name) node[point] {};
  \umlasso[name=0.125,S,inv route,name anchor=left,name pos=0.125](n)(p) 
  \draw (name) node[point] {};
  \umlasso[name=0.875,S,inv route,name anchor=right,name pos=0.875](n)(p) 
  \draw (name) node[point] {};
\end{tikzpicture}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}
  \umlclass[name=M,label=m](6,0){}
  \umlasso[name=0.5,CH](n)(m) \draw (start) node[point] {}; 
  \draw (name) node[point] {}; \draw (end) node[point] {};
  \umlasso[name=0.25,CH,name pos=0.25](n)(m) \draw (name) node[point] {};
  \umlasso[name=0.75,CH,name pos=0.75](n)(m) \draw (name) node[point] {};
  \umlasso[name=0.125,CH,name anchor=left,name pos=0.125](n)(m) \draw (name) node[point] {};
  \umlasso[name=0.875,CH,name anchor=right,name pos=0.875](n)(m) \draw (name) node[point] {};
\end{tikzpicture}%
\end{codeexample}  
  \caption{\texttt{name pos} option explained}
  \label{fig:namepos}
\end{figure}

  \macrooption{arity start}{string}{empty} \macrooption{arity
    end}{string}{empty} The cardinality of the extremities, either the
  start side or the end side. The package impose no form on the
  cardinality specification. I advise to use
  \macro{textasteriskcentered} (\textasteriskcentered) rather than *
  when specifying cardinalities.

  \macrooption{name start}{string}{empty} \macrooption{name
    end}{string}{empty} The name of the extremities, either the start
  side or the end side. 

  \macrooption{sep}{length}{0mm} The length used to separate the
  extremities from their annotations (see figure
  \vref{fig:sepasso}).
\begin{figure}
  \centering
\begin{codeexample}
\pgfkeys{/tikz/point/.style={fill=red,circle,inner sep=0pt,minimum size=2pt}}
\begin{tikzpicture}
  \begin{scope}[thick]
    \umlclass[name=N,label=n](0,0){}    \umlclass[name=M,label=m](8,0){}
    \umlasso[sep=8mm,arity start=A,name start=B](m)(n)
  \end{scope}
  \draw (start) node[point] {};         \draw ([xshift=-8mm]start) node[point] {};
  \draw ([xshift=-8mm]start) -- +(0,0.3);
  \draw[<->] ([yshift=2mm,xshift=-8mm]start) -- ([yshift=2mm]start)
             node[above,pos=0.5] {\texttt{sep}} ;
\end{tikzpicture}%
\end{codeexample}  
  \caption{An association with \texttt{sep} option explained}
  \label{fig:sepasso}
\end{figure}

  \macrooption{D}{boolean}{false} A boolean indicating whether the
  association is a direct line whatever the coordinates of its
  extremities. Notice that in this case annotations are note
  displayed.

  \macrooption{O}{boolean}{false} A boolean indicating whether the
  relation is a self relation. Beware that, this kind of relation is
  build to be used between a class and itself, this means that both
  reference points must be equal and be a class label. In other cases,
  the result is unspecified.

  \macrooption{O anchor}{tikz position}{north east} A tikz position
  indicating the point used to determine the cycle relation position.
  Beware, that the option is meant to be used with the four corners
  (north east, north west, south east and south west). In other cases,
  the result is unspecified.

  \macrooption{O sep}{length}{1cm} The distance the point determining
  the cycle relation is from its anchor. In fact, this point will have
  the coordinate $anchor + (O~sep,O~sep)$.

  \macrooption{S}{boolean}{false} A boolean indicating whether the
  association has an S form (\tikz \draw (0,0) -| (0.25,0.15) |-
  (0.5,0.3);).

  \macrooption{CV}{boolean}{false} A boolean indicating whether the
  association has an C vertical form (\tikz \draw (0,0) -|
  (-0.25,0.15) |- (0,0.3);).

  \macrooption{CH}{boolean}{false} A boolean indicating whether the
  association has an C horizontal form (\tikz \draw (0,0) |-
  (0.25,0.3) -| (0.5,0);).

  \macrooption{C sep}{length}{2cm} For C association, the distance
  between the middle of the two classes and the middle of the
  association (see figure \vref{fig:Crelation}).

  \macrooption{inv route}{boolean}{false} This boolean controls the path
  of the association in case of an L (\tikz \draw (0,0) -| (0.5,0.3);
  instead of \tikz \draw (0,0) |- (0.5,0.3);), a S (\tikz \draw (0,0)
  |- (0.25,0.15) -| (0.5,0.3); instead of \tikz \draw (0,0) -|
  (0.25,0.15) |- (0.5,0.3);) or a C (\tikz \draw (0,0) |- (0.25,-0.3)
  -| (0.5,0); and \tikz \draw (0,0) -| (0.25,0.15) |- (0,0.3); instead
  of \tikz \draw (0,0) |- (0.25,0.3) -| (0.5,0); and \tikz \draw (0,0)
  -| (-0.25,0.15) |- (0,0.3);) kind of association.

  \macrooption{start shift}{length}{0mm} \macrooption{end
    shift}{length}{0mm} \macrooption{shift}{length}{0mm} Extremities
  shifting specifications respectively for the start, the end and both
  sides. When used the association start or end point is shifted by the
  given value staying on the shape border. This means that on west and
  east side, the shift is a y shift and on north and south border, it
  is a x shift. The given length may be negative.

  \macrooption{dashed}{boolean}{false} If true the relation is typeset
  dashed.

  \macrooption{compo}{boolean}{false} \macrooption{agre}{boolean}{false}
  \macrooption{nav start}{boolean}{false} \macrooption{nav
    end}{boolean}{false} Booleans to specifies the arrow form of the
  relation. They respectively means composition
  (\tikz[baseline=-0.5ex] \draw[diamond-] (0,0) -- (0.5,0);),
  aggregation (\tikz[baseline=-0.5ex] \draw[open diamond-] (0,0) --
  (0.5,0);), navigation at start (\tikz[baseline=-0.5ex] \draw[<-]
  (0,0) -- (0.5,0);) or navigation at end (\tikz[baseline=-0.5ex]
  \draw[->] (0,0) -- (0.5,0);). Composition and aggregation "arrows"
  may only be put at the beginning extremities. Among the three
  beginning arrows, aggregation wins on composition that wins on
  navigation.
\end{itemize}


\subsection{Inheritance}
\label{sec:inheritance}

The second form of relations is the inheritance relation.  The macro
\macro{umlinherit} has the now usual form of the relation macro as
demonstrated by the following example:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}
  \umlclass[name=M,label=m](4,0){}
  \umlclass[name=P,label=p](4,2){}
  \umlinherit(m)(n)   \umlinherit(m)(p)   \umlinherit(n)(p)
\end{tikzpicture}%
\end{codeexample}

Inheritance are relations, in the sense that they will be represented
as relations and therefore have all the options of the relation macro
(except for arrow that is specified automatically). And, in fact, one
have the 7 kinds of inheritance.

The following options are supported by the \macro{umlinherit} macro:
\begin{itemize}
  \macrooption{D}{boolean}{false} A boolean indicating whether the
  inheritance is a direct line whatever the coordinates of its
  extremities. Notice that in this case annotations are note
  displayed.

  \macrooption{S}{boolean}{false} A boolean indicating whether the
  inheritance has an S form (\tikz \draw (0,0) -| (0.25,0.15) |-
  (0.5,0.3);).

  \macrooption{CV}{boolean}{false} A boolean indicating whether the
  inheritance has an C vertical form (\tikz \draw (0,0) -|
  (-0.25,0.15) |- (0,0.3);).

  \macrooption{CH}{boolean}{false} A boolean indicating whether the
  inheritance has an C horizontal form (\tikz \draw (0,0) |-
  (0.25,0.3) -| (0.5,0);).

  \macrooption{C sep}{length}{2cm} For C inheritance, the distance
  between the middle of the two classes and the middle of the
  inheritance (see figure \vref{fig:Crelation}).

  \macrooption{inv route}{boolean}{false} This boolean controls the path
  of the inheritance in case of an L (\tikz \draw (0,0) -| (0.5,0.3);
  instead of \tikz \draw (0,0) |- (0.5,0.3);), a S (\tikz \draw (0,0)
  |- (0.25,0.15) -| (0.5,0.3); instead of \tikz \draw (0,0) -|
  (0.25,0.15) |- (0.5,0.3);) or a C (\tikz \draw (0,0) |- (0.25,-0.3)
  -| (0.5,0); and \tikz \draw (0,0) -| (0.25,0.15) |- (0,0.3); instead
  of \tikz \draw (0,0) |- (0.25,0.3) -| (0.5,0); and \tikz \draw (0,0)
  -| (-0.25,0.15) |- (0,0.3);) kind of inheritance.

  \macrooption{start shift}{length}{0mm} \macrooption{end
    shift}{length}{0mm} \macrooption{shift}{length}{0mm} Extremities
  shifting specifications respectively for the start, the end and both
  sides. When used the inheritance start or end point is shifted by the
  given value staying on the shape border. This means that on west and
  east side, the shift is a y shift and on north and south border, it
  is a x shift. The given length may be negative.

  \macrooption{dashed}{boolean}{false} If true the inheritance is typeset
  dashed.
\end{itemize}

\subsection{Implements}

The last form of relation is the implements relation.  The macro
\macro{umlimplem} has the now usual form of the relation macro as
demonstrated by the following example:
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=N,label=n](0,0){}
  \umlclass[name=M,label=m](4,0){}
  \umlclass[name=P,label=p](4,2){}
  \umlimplem(m)(n)  \umlimplem(m)(p)   \umlimplem(n)(p)
\end{tikzpicture}%
\end{codeexample}

Implements are relations, in the sense that they will be represented
as relations and therefore have all the options of the relation macro
(except for arrow that is specified automatically). And, in fact, one
have the 7 kinds of implements.

The following options are supported by the \macro{umlimplem} macro:
\begin{itemize}
  \macrooption{name pos}{number between 0 and 1}{0.5} The position of
  the name along the segment from start to end of the
  implementation. 

  \macrooption{D}{boolean}{false} A boolean indicating whether the
  implements is a direct line whatever the coordinates of its
  extremities. Notice that in this case annotations are note
  displayed.

  \macrooption{S}{boolean}{false} A boolean indicating whether the
  implements has an S form (\tikz \draw (0,0) -| (0.25,0.15) |-
  (0.5,0.3);).

  \macrooption{CV}{boolean}{false} A boolean indicating whether the
  implements has an C vertical form (\tikz \draw (0,0) -|
  (-0.25,0.15) |- (0,0.3);).

  \macrooption{CH}{boolean}{false} A boolean indicating whether the
  implements has an C horizontal form (\tikz \draw (0,0) |-
  (0.25,0.3) -| (0.5,0);).

  \macrooption{C sep}{length}{2cm} For C implements, the distance
  between the middle of the two classes and the middle of the
  implements (see figure \vref{fig:Crelation}).

  \macrooption{inv route}{boolean}{false} This boolean controls the path
  of the implements in case of an L (\tikz \draw (0,0) -| (0.5,0.3);
  instead of \tikz \draw (0,0) |- (0.5,0.3);), a S (\tikz \draw (0,0)
  |- (0.25,0.15) -| (0.5,0.3); instead of \tikz \draw (0,0) -|
  (0.25,0.15) |- (0.5,0.3);) or a C (\tikz \draw (0,0) |- (0.25,-0.3)
  -| (0.5,0); and \tikz \draw (0,0) -| (0.25,0.15) |- (0,0.3); instead
  of \tikz \draw (0,0) |- (0.25,0.3) -| (0.5,0); and \tikz \draw (0,0)
  -| (-0.25,0.15) |- (0,0.3);) kind of implements.

  \macrooption{start shift}{length}{0mm} \macrooption{end
    shift}{length}{0mm} \macrooption{shift}{length}{0mm} Extremities
  shifting specifications respectively for the start, the end and both
  sides. When used the implements start or end point is shifted by the
  given value staying on the shape border. This means that on west and
  east side, the shift is a y shift and on north and south border, it
  is a x shift. The given length may be negative.

  \macrooption{dashed}{boolean}{true} If true the implements is typeset
  dashed.
\end{itemize}

\subsection{Multiple inheritance or implements}
The last relation macros are \macro{umlinheritmult} and
\macro{umlimplemmult} that connect a set of inheritance
(resp. implements) through a common joining point. They are not
considered as usual relation and therefore no options are
supported. They only take two arguments between parentheses. The first
corresponds to a comma separated list of classes (or any other
rectangular shapes) and the second argument is the mother class (or
any other rectangular shape). The following example illustrate the use
of both macros:
\begin{codeexample}
\begin{tikzpicture}
  \umlclass[name=A,label=a](-1,1){}
  \umlclass[name=qBq,label=b](4,0){}
  \umlclass[name=C,label=c](1,3){}

  \umlclass[name=O1,label=o1](1,5){}
  \umlclass[name=O2,label=o2](7,0){}
  \umlclass[name=O3,label=o3](-5,1.5){}
  \umlclass[name=O4,label=o4](3,-2){}

  \begin{scope}[font=\tiny]
    \umlinheritmult(a,b,c)(o2)
    \umlinheritmult(a,b,c)(o3)
    \umlimplemmult(a,b,c)(o1)
    \umlimplemmult(a,b,c)(o4)    
  \end{scope}
\end{tikzpicture}%
\end{codeexample}

\section{Some class diagram examples}

First, a classical class diagram for the pattern composite.
\begin{codeexample}
\begin{tikzpicture}[font=\footnotesize]
  \umlclass[name=Component,label=Composant,width=2.6cm](4,2.8){}
  \umlclass[name=Container,label=Conteneur,width=2.6cm](6,1){}
  \umlclass[name=RawComponent,label=Interacteur,width=2.6cm](2,1){}
  \umlinherit[S, inv route](Conteneur)(Composant)
  \umlinherit[S, inv route](Interacteur)(Composant)
  \umlasso[agre,start shift=5mm,name end=\textasteriskcentered](Conteneur)(Composant)
\end{tikzpicture}
\end{codeexample}

Another one to give some ideas about how to build complex
diagrams. Notice, that for aesthetic reason, I advocate the use of
thin spaces before and after \texttt{:} and after \texttt{+} and
\texttt{-}. For this, the package offer a macro \macro{feature} that
takes three arguments (1) a visibility, (2) a name and (3) a type, the
first being optional. It may be used for attributes as well as for
methods, as demonstrated above:
\begin{codeexample}
  \ttfamily
  \begin{tabular}{l}
    \feature{name}{type} \\
    \feature{name}{} \\
    \feature[-]{name}{type}\\
    \feature[-]{name}{}\\
    \feature[+]{name(args)}{type}
  \end{tabular}%
\end{codeexample}


\begin{codeexample}
\begin{tikzpicture}[remember picture,font=\small]
  \draw (7,4.5) node[font=\ttfamily] (code) { BankAccount \marknode{var}{anAccount} = new
    \marknode{const}{BankAccount("Fabien","Dagnat",1000);}
  };
  \begin{scope}[line width=0.8pt,color=red]
    \draw ([yshift=-0.1cm]const.south west) -- ([yshift=-0.1cm]const.south east)
    node[coordinate,pos=0.5] (middle) {} ;
  \end{scope}
  \umlclass[name=BankAccount,label=class,parts=3]([yshift=-3.5cm]middle) {
    -\,first\,:\,String\\
    \feature[-]{last}{String}\\
    -\,balance\,:\,float 
    \separator
    \marknode{constr}{+\,BankAccount(String,String,float)}\\
    +\,BankAccount(String,String)\\
    \feature[+]{getBalance()}{float}\\
    \feature[+]{deposit(float)}{}
  }
  \begin{scope}[line width=0.8pt,color=brown]
    \umlclass[name={\,:\,BankAccount},label=obj,parts=2]([xshift=-4cm]class.west) {
      \color{red}"Fabien"\\
      \color{red}"Dagnat"\\
      \color{red}1000
    }
    \draw[-stealth] ([xshift=-2.5cm]const.south) -- ([xshift=-1cm]class.north)
    node[above,pos=0.6] {(1)} ;
    \draw[-stealth] (class.attribute west) -- ([yshift=2mm]obj.east);
    \draw[dashed,-stealth,rounded corners] (obj.south) |- ([yshift=-2cm]class.west) 
    node[below,pos=0.65,font=\footnotesize] {L'objet conserve un lien sur sa classe};
  \end{scope}
  \begin{scope}[line width=0.8pt,color=red]
    \draw (constr) node[draw,ellipse,minimum width=7cm,minimum height=0.8cm] (ellipse) {};
    \draw[stealth-] (ellipse) -- node[right,pos=0.8] {(2)} (middle);
    \draw[line width=0.8pt,-stealth] (ellipse.west) -- ([yshift=-2mm]obj.east);
  \end{scope}
  \begin{scope}[color=green]
    \draw[line width=0.8pt,-stealth] (obj.north) -- node[above left] {(3)} (var.south);
    \draw[dashed,-stealth] ([yshift=-1mm]var.south) to[out=-90,in=0] ([yshift=6mm]obj.east);
  \end{scope}
\end{tikzpicture}%
\end{codeexample}

A non convention UML class diagram also illustrating some advanced
usage of \texttt{tikz}:
\begin{itemize}
\item \emph{styles:} a style is a set of options with values that are
  grouped and named. It is possible to define such style using
  \emph{tikz} (more precisely, the key management package of
  \texttt{pgf}). Such a style is defined by the syntax
  \texttt{key/.style=\{\textit{set of option setting}\}}. It can be
  defined either in the option part of a tikzpicture or more globally
  using \macro{pgfkeys} (for more details see the \texttt{pgfkeys}
  part of the \texttt{pgf} documentation). Notice that to be a style
  for a macro \macro{m} of the package \texttt{pgfuml}, the style has
  to have the path \texttt{/pgfuml/m}.
\item \emph{scopes:} \texttt{tikzpicture}s are composed of drawing
  elements that may be grouped inside scopes. These scopes may have
  graphical options that applies to all elements of the scope. In the
  following example, we furthermore use the \texttt{every node} key of
  a scope to associate a style to each node it contains.
\item \emph{pictures inside pictures:} inside a \TeX{} part of a
  \texttt{tikzpicture}, one may use another \texttt{tikzpicture}. It
  is very useful for associating labels to parts of a \TeX{} text. To
  help, this advanced usage a package \texttt{pgfextra} provides a
  macro \macro{marknode}. This macro has an optional argument
  consisting in graphical option passed to the node that will contain
  the text and two mandatory parameters, first the label and second
  the text itself. It puts the text inside a node of a subpicture. It
  is used in the following diagram to mark methods of classes to be
  able to join them with path.
\item \emph{curved path:} The \texttt{to} path drawing commands enable
  to easily build curved path.
\end{itemize}


\begin{codeexample}
\usetikzlibrary{topaths}
\begin{tikzpicture}[font=\footnotesize,out=30,in=150,remember picture,
  /pgfuml/class/cStyle/.style={parts=2,body font=\scriptsize\ttfamily},
  /pgfuml/class/iStyle/.style={interface,parts=2,body font=\scriptsize\itshape\ttfamily}]
  \umlclass[cStyle,name=ButtonListener,label=bl](-8.9,4.2){
    \feature[+]{ButtonListener(Controller)}{}\\
    \marknode[fill=yellow!60]{ap}{\feature[+]{actionPerformed(ActionEvent)}{}}
  }1
  \umlclass[iStyle,name=Controller,label=c](-5.7,6){
      \marknode{e}{\feature[+]{event(String)}{}}
    }
  \umlclass[cStyle,name=Model,label=m]([xshift=5.3cm]c){
    \feature[+]{addView(View)}{}\\
    \feature[+]{removeView(View)}{}\\
    \marknode{nv}{\feature[\#]{notifyViews()}{}}
  }
  \umlclass[iStyle,name=View,label=v]([xshift=4.8cm]m){
    \marknode{synchro}{\feature[+]{synchro(Model)}{}}
  }
  \umlclass[cStyle,name=ClicController,label=ctlr]([yshift=-5.5cm,xshift=5mm]c){
  \feature[+]{Controleur(ClicModel)}{}\\
  \marknode{ec}{\feature[+]{event(String)}{}}
  }
  \umlclass[cStyle,name=ClicModel,label=cm,parts=3]([yshift=-4cm]m){
    \feature[-]{nbClic}{int}
    \separator%
    \marknode{incr}{\feature[+]{incr()}{}} \\
    \marknode{nbc}{\feature[+]{getNumClics()}{int}}
  }
  \umlclass[cStyle,name=ClicView,label=cv]([xshift=4.8cm]cm){
    \marknode[fill=magenta!60]{synchroC}{\feature[+]{synchro(Model)}{}}
  }
  \begin{scope}[font=\scriptsize]
    \umlasso[arity end=\textasteriskcentered,name end=views](m)(v)
    \umlasso[arity end=1,name end=controller](bl)(c)
    \umlimplem(cv)(v)
    \umlimplem[start shift=-4mm,D](ctlr)(c)
    \umlasso[arity end=1,name end=controlledModel](ctlr)(cm)
  \end{scope}
  \umlinherit(cm)(m)

  \draw ([yshift=-15mm,xshift=-2mm]bl.south) node[text width=3.1cm,fill=yellow!60] (text) 
  {Method in yellow is fired by user action};
  \draw (text.south) node[below,text width=3.1cm,fill=magenta!60] 
  {Method in magenta change the display};

  \begin{scope}[red,->,line width=1pt,
                every node/.style={circle,draw,inner sep=2pt,outer sep=5pt}]
    \draw (ap) to[out=60,in=180] (e) to[out=0,in=90] ([xshift=-8mm]e.south) 
    -- ([xshift=-7mm]ec.north) node[left,pos=0.5] {1} ;
    \draw (ec) to[out=0,in=180] node[below,pos=0.6] {2} (incr);
    \draw (incr) to[out=110,in=-120] node[left] {3} (nv);
    \draw (nv) -- (synchro.west) to[out=0,in=90] ([xshift=-8mm]synchro.south) 
    -- ([xshift=-8mm]synchroC.north) node[left,pos=0.4] {4} ;
    \draw (cv) to[out=210,in=-30] node[below] {5} (nbc);
  \end{scope}
\end{tikzpicture}%
\end{codeexample}

Another example, that illustrates the automatic placement of
informations.

\begin{codeexample}
\newcommand{\aclass}[4]{
  \umlclass[name=#1,label=#2,parts=2,body font=\ttfamily\scriptsize](#3){#4}}
\newcommand{\field}[3]{\aclass{#1}{#2}{#3}{
  \feature[+]{get(Object)}{Object}\\ \feature[+]{set(Object,Object)}{}}
}
\newcommand{\mem}[3]{\aclass{#1}{#2}{#3}{\feature[-]{name}{String}}}
\newcommand{\cst}[3]{\aclass{#1}{#2}{#3}{\feature[+]{invoke(Object,Object[])}{}}}
\begin{tikzpicture}[font=\footnotesize,
  /pgfuml/asso/extremities/.style={font=\scriptsize,arity end=ae,arity start=as,
                                   name end=ne,name start=ns}]
  \umlclass[name=Class,label=class,body font=\ttfamily\scriptsize](2,6.5){
    \feature[-]{name}{String}
    \separator
    \underline{\feature[+]{forName(String)}{Class}}\\
    \feature[+]{get(String)}{Member}\\
    \feature[+]{newInstance()}{Object}\\
    \feature[+]{isInstance(Object)}{boolean}
  }
  \mem{Member}{mem}{8,6.5}      \mem{Member2}{mem2}{-4,6.5}
  \field{Field1}{f}{6.5,3.5}    \field{Field2}{f2}{6.5,9.5}
  \field{Field3}{f3}{-2.5,3.5}  \field{Field4}{f4}{-2.5,9.5}
  \cst{Constructor}{c}{2,2.5}   \cst{Constructor2}{c2}{2,10.5}
  \umlasso[extremities](class)(mem)
  \umlasso[extremities](class)(mem2)
  \umlasso[extremities,inv route](class)(c)
  \umlasso[extremities,inv route](class)(c2)
  \umlasso[extremities,start shift=15mm](class)(f)
  \umlasso[extremities,inv route,start shift=-10mm](class)(f)
  \umlasso[extremities,start shift=15mm](class)(f2)
  \umlasso[extremities,inv route,start shift=10mm](class)(f2)
  \umlasso[extremities,start shift=-15mm](class)(f3)
  \umlasso[extremities,inv route,start shift=-10mm](class)(f3)
  \umlasso[extremities,start shift=-15mm](class)(f4)
  \umlasso[extremities,inv route,start shift=10mm](class)(f4)
\end{tikzpicture}%
\end{codeexample}

And lastly a more usual UML class diagram that includes an inner class.

\begin{codeexample}
\begin{tikzpicture}[remember picture,font=\scriptsize,
  /pgfuml/class/iStyle/.style={interface,param=T,parts=2,param fill=graphicbackground},
  /pgfuml/class/cStyle/.style={param=T,parts=3,param fill=graphicbackground}]
  \umlclass[cStyle,name=MyList,label=myList,width=10cm](5.5,2){
    \feature[-]{content}{T[]}
    \separator
    \feature[+]{iterator()}{Iterator<T>}
    \hspace{1.5cm}
    \begin{tikzpicture}[remember picture,baseline=(itr.north)]
      \umlclass[cStyle,name=Itr,label=itr](0,0){
        \feature[-]{cursor}{int}
        \separator%
        \feature[+]{hasNext()}{boolean}\\
        \feature[+]{next()}{T} \\
        {\color{gray}(\feature[+]{remove()}{})}
      }
    \end{tikzpicture}
  }
  \umlclass[iStyle,name=Iterable,label=iterable]([xshift=-2.4cm,yshift=2.5cm]myList.north){
    \feature[+]{iterator()}{Iterator<T>}
  }
  \umlclass[iStyle,name=Iterator,label=iterator]([yshift=4cm]itr.north){
    \feature[+]{hasNext()}{boolean}\\
    \feature[+]{next()}{T} \\
    {\color{gray}(\feature[+]{remove()}{})}
  }
  \umlimplem[start shift=-2.4cm](myList)(iterable);
  \umlimplem[name pos=0.7](itr)(iterator);
\end{tikzpicture}%
\end{codeexample}





\section{Some other diagrams examples}

\subsection{Les diagrammes de s�quences}

Un premier exemple basique pour l'introduction des commandes.
% \begin{codeexample}[]
% \begin{diagseq}[font=\scriptsize,step=8mm,base=5cm]
%   \umldefclass[name={Client},label=client](2cm)
%   \umldefclass[name={Distributeur de billets},width=4cm,label=dab](8cm)
%   \umlsend(dab)(client){Affiche message d'accueil}
%   \umlsend(client)(dab){Ins�re la carte}
%   \umlsend(dab)(client){Demande le code}
%   \umlsend(client)(dab){Entre le code}
%   \umlsend(dab)(client){Demande la somme}
%   \umlsend(client)(dab){Entre la somme}
%   \umlsend(dab)(client){Distribue l'argent}
%   \umlsend(client)(dab){Prend les billets}
%   \umlsend(dab)(client){Imprime le re�u}
%   \umlsend(dab)(client){�jecte la carte}
%   \umlsend(client)(dab){Prend la carte}
%   \umlsend(dab)(client){Affiche message d'accueil}
%   \umlclassend(client,dab)
% \end{diagseq}
% \end{codeexample}

Un exemple un peu complet qui permet d'illustrer la cr�ation et le
m�me ensuite avec des labels qui permet d'illustrer la cr�ation de
n\oe uds r�utilsable par la suite.
% \begin{codeexample}[]
% \begin{diagseq}[font=\scriptsize,step=8mm,base=5cm]
%   \umlactor[scale=0.3](2,5){utilisateur}
%   \umldefclass[width=1.6cm,name={c\string:Component},label=c](4cm)
%   \umldefclass[width=1.6cm,name={l\string:XXXListener},label=listener](6.6cm)
%   \umldefclass[width=2cm,name={\emph{n'importe quel objet}},label=source](11.6cm)
%   \umlsend(source)(c){addXXXListener(l)}
%   \umlsend(utilisateur)(c){un evt}
%   \umlcreate[width=1.6cm,name={\string:XXXEvent},label=event](c)(9.2cm)
%   \umlsend(c)(listener){evt(e)}
%   \umlclassend(utilisateur,c,listener,event,source)
% \end{diagseq}
% \end{codeexample}

% \begin{codeexample}[]
% \begin{diagseq}[font=\scriptsize,step=8mm,base=5cm]
%   \umlactor[scale=0.3](2,5){utilisateur}
%   \umldefclass[width=1.6cm,name={c\string:Component},label=c](4cm)
%   \umldefclass[width=1.6cm,name={l\string:XXXListener},label=listener](6.6cm)
%   \umldefclass[width=2cm,name={\emph{n'importe quel objet}},label=source](11.6cm)
%   \umlsend[label=addXXX](source)(c){addXXXListener(l)}
%   \umlsend[label=evt](utilisateur)(c){un evt}
%   \umlcreate[width=1.6cm,name={\string:XXXEvent},label=event](c)(9.2cm)
%   \umlsend[label=funevt](c)(listener){evt(e)}
%   \begin{scope}[line width=0.8pt,red]
%     \draw(9.2,5) node (action) {\texttt{Action}};
%     \draw[->](action) -- ([xshift=-4mm]listener.center);
%     \draw[->](action) -- ([xshift=-4mm]event.center);
%     \draw[->](action) -- ([xshift=-4mm]addXXX.center);
%     \draw(5.3,5.5) node (button) {\texttt{JButton}};
%     \draw[->](button) -- (c.center);
%     \draw([yshift=-1cm]evt.center) node (clic) {clic};
%     \draw[->](clic) -- (evt);
%     \draw([xshift=-1cm,yshift=-1cm]funevt.center) node (ap) {\texttt{actionPerformed}};
%     \draw[->](ap) -- ([xshift=-2mm,yshift=1mm]funevt.south);
%   \end{scope}
%   \umlclassend(utilisateur,c,listener,event,source)
% \end{diagseq}
% \end{codeexample}

Un diagramme un peu plus r�aliste.
% \begin{codeexample}[]
% \begin{diagseq}[font=\scriptsize,step=8mm,start=0mm,base=7cm]
%   \umlactor[scale=0.3](2,7){utilisateur}
%   \umldefclass[width=1.6cm,name={pane\string:Container},label=pane](4cm)
%   \umlcreate[width=1.6cm,name={button\string:JButton},label=button](pane)(6.6cm)
%   \umlcreate[width=1.6cm,name={text\string:JLabel},label=text](pane)(11.8cm)
%   \umlcreate[width=1.8cm,name={bl\string:ButtonListener},label=listener](pane)(9.2cm)
%   \umlsend(pane)(button){addActionListener(l)}
%   \umlsend(utilisateur)(button){\textsl{clic sur le bouton}}
%   \umlsend(button)(listener){actionPerformed()}
%   \umlsend(listener)(text){setText()}
%   \umlclassend(utilisateur,pane,button,text,listener)
% \end{diagseq}
% \end{codeexample}

On peut �galement faire des boucles et des alternatives.
% \begin{codeexample}[]
% \begin{diagseq}[font=\scriptsize,step=8mm,start=0mm,base=5cm]
%   \umldefclass[name={Client},label=client](2cm)
%   \umldefclass[name={Distributeur de billets},width=3.5cm,label=dab](9cm)
%   \umlsend(dab)(client){Affiche message d'accueil}
%   \umlsend(client)(dab){Ins�re la carte}
%   \umlloop{code faux et moins de 3 tentatives}(client)(dab){
%     \umlsend(dab)(client){Demande le code}
%     \umlsend(client)(dab){Entre le code}
%   }
%   \umlalt(client)(dab){code correct}{%
%     \umlsend(dab)(client){Demande la somme}
%     \umlsend(client)(dab){Entre la somme}
%     \umlsend(dab)(client){Distribue l'argent}
%     \umlsend(client)(dab){Prend les billets}
%     \umlsend(dab)(client){Imprime le re�u}
%     \umlsend(dab)(client){�jecte la carte}
%     \umlsend(client)(dab){Prend la carte}
%   }{code faux 3 fois}{
%     \umlsend[label=msg](dab)(client){Affiche message carte gard�e}
%   }
%   \umlsend(dab)(client){Affiche message d'accueil}
%   \umlclassend(client,dab)
%   \umlnote[width=5cm,label=lanote](13,-6){La carte est gard�e par le distributeur.}
%   \draw[dashed] (msg) -- (lanote);
% \end{diagseq}
% \end{codeexample}

\subsection{Les diagrammes de cas d'utilisation}

Il est enfin possible de r�aliser des diagrammes de cas
d'utilisation. Attention, vu la technique utilis�e deux compilations
sont nec�ssaires pour que les liens soient corrects.
% \begin{codeexample}[]
% \begin{tikzpicture}[>=stealth,,remember picture=true]
%   \umlactor(1,5.5){client}
%   \umlactor(1,1.5){employ�}
%   \umlinherit(employ�)(client)
%   \umlsyst(10,3.5){\large Distributeur de billets}{
%     \umlfunc[label=virement](0,6.5){Effectuer un virement}
%     \umlfunc[label=retrait](0,5){Retirer de l'argent}
%     \umlfunc[label=consult](0,3.5){Consulter un compte}
%     \umlfunc[label=maint](0,2){Effectuer la maintenance}
%   }
%   \draw (client) -- (virement.west);
%   \draw (client) -- (retrait.west);
%   \draw (client) -- (consult.west);
%   \draw (employ�) -- (maint.west);
% \end{tikzpicture}
% \end{codeexample}

Et pour finir un dernier diagramme de cas d'utilisation un peu plus complexe.
% \begin{codeexample}[]
% \begin{tikzpicture}[>=stealth,remember picture=true]
%   \umlactor(1,5.5){client}
%   \umlactor(1,1.5){employ�}
%   \umlinherit(employ�)(client)
%   \umlsyst(10,3.5){\Large Distributeur de billets}{
%     \umlfunc[label=virement1](-0.2,6.5){Effectuer un virement}
%     \umlfunc[label=retrait1](-0.2,5){Retirer de l'argent}
%     \umlfunc[label=consult1](-0.2,3.5){Consulter un compte}
%     \umlfunc[label=maint1](-0.2,2){Effectuer la maintenance}
%     \umlfunc[label=authen](6.2,5){S'authentifier}
%     \draw[<-] (authen) -- node[pos=0.5,above right] {<<include>>} (virement1.east);
%     \draw[<-] (authen) -- node[pos=0.5,above] {<<include>>} (retrait1.east);
%     \draw[<-] (authen) -- node[pos=0.5,below right] {<<include>>} (consult1.east);
%   }
%   \draw (client) -- (virement1.west);
%   \draw (client) -- (retrait1.west);
%   \draw (client) -- (consult1.west);
%   \draw (employ�) -- (maint1.west);
% \end{tikzpicture}
% \end{codeexample}



\section{Modes et variables}

\subsection{L'environnement \texttt{diagseq}}

L'environnement \texttt{diagseq} peut �tre configur� par les options suivantes:

\begin{tabular}{|l|l|p{5.7cm}|p{6.7cm}|}
  \hline
  Nom & Type & Intention & Valeur(s) par d�faut 
  \\  \hline
  \texttt{step} & longueur & l'�cart entre les messages & 10mm \\ \hline
  \texttt{start} & longueur & l'�cart au d�part & 5mm\\ \hline
  \texttt{base} & longueur & la ligne de base des objets pr�existant & 0mm \\ \hline
  \texttt{font} & cha�ne & font de la figure & \verb+\normalsize+\\ \hline
\end{tabular}


\end{document}

%%% Local Variables: 
%%% mode: latex
%%% ispell-dictionary: "english"
%%% End: 

% LocalWords:  pgfuml dagnat pgf texdoc keyval tikz ttfamily bfseries param
% LocalWords:  graphicbackground
