\RequirePackage{tikz}
  \usetikzlibrary{arrows}
  \usetikzlibrary{shapes}
  \usetikzlibrary{calc}
\RequirePackage[T1]{fontenc}% for guillemet
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{relsize}

\tikzstyle{uml class}=[draw,inner sep=0pt]
%\tikzstyle{uml simple class}=[draw,inner sep=0pt,minimum height=8mm]
\newlength\class@width
\newlength\class@height
\newlength\classname@base
\newlength\asso@sep
\newlength\asso@C@sep
\newlength\uml@xtemp
\newlength\uml@ytemp
\newlength\uml@xa
\newlength\uml@xb
\newlength\uml@diff@x
\newlength\uml@diff@y
\newlength\uml@ya
\newlength\uml@yb
\newlength\inherit@min@sep
\newlength\inherit@sep

\newlength\uml@dim@z
\setlength\uml@dim@z{1mm}

\newcommand*{\stereotype}[1]{\guillemotleft #1\guillemotright}
\newcommand{\separator}[1][]{%
  \def\uml@tempa{#1}%
  \ifx\uml@tempa\@empty%
    \\[-0.7em]\hline\\[-0.7em]%
  \else%
    \\[#1]\hline\\[#1]%
  \fi%
  }
\newcommand{\uml@class@body}[2]{%
  \setlength\classname@base{\class@height/2-0.5em}%
  \def\uml@temp{#2}%
  {\ttfamily%
    \begin{tabular}{l}%
      \hfil\normalfont\textbf{%
        \setlength{\tabcolsep}{5pt}%
%        \renewcommand{\arraystretch}{1.5}%
        \begin{tabular}{c}
          #1
        \end{tabular}\lower\classname@base\hbox{\rule{0mm}{\class@height}}%
%        \renewcommand{\arraystretch}{1}%
      }%
      \ifx\uml@temp\@empty%
      \else%
        \\ \hline%
        \\[-0.5em]
        #2\\
        \\[-0.5em]
      \fi%
    \end{tabular}%
  }%
}
\newcounter{classCounter}
\newboolean{pgfuml@fixedwidth}%
\setboolean{pgfuml@fixedwidth}{false}%
\newbox\pgfuml@box@class@name
\define@key[pgfuml]{class}{name}{\def\class@name{#1}}
\define@key[pgfuml]{class}{label}{\def\class@label{#1}}
\define@key[pgfuml]{class}{width}{
%  \ifdim#1>0pt
%    \setboolean{pgfuml@fixedwidth}{true}%
    \setlength\class@width{#1}
%  \else
%    \setboolean{pgfuml@fixedwidth}{false}%
%  \fi
}
\define@key[pgfuml]{class}{height}{\setlength\class@height{#1}}
\define@key[pgfuml]{class}{param}{\def\class@param{#1}}
\define@key[pgfuml]{class}{stereotype}{
  \def\uml@tempa{#1}%
  \ifx\uml@tempa\@empty%
    \def\class@stereotype{}
  \else%
    \def\class@stereotype{#1\\[1mm]}
  \fi%
}
\define@boolkey[pgfuml]{class}{abstract}[true]{}
\define@boolkey[pgfuml]{class}{interface}[true]{}
\presetkeys[pgfuml]{class}{name=,label=,width=2cm,height=1.5em,param=,abstract=false,interface=false,stereotype=}{}
\def\umlclass{\@ifnextchar[\@umlclass{\@umlclass[]}}
\def\@umlclass[#1](#2)#3{%
  \setkeys[pgfuml]{class}{#1}%
  \ifpgfuml@class@interface%
    \def\class@font{\itshape}%
    \let\class@old@stereotype=\class@stereotype
    \def\class@stereotype{\stereotype{interface}\\\class@old@stereotype}%
  \else%
    %\def\class@stereotype{}%
    \ifpgfuml@class@abstract%
      \def\class@font{\itshape}%
    \else%
      \def\class@font{}%      
    \fi%
  \fi%
  \ifx\class@param\@empty%
  \else%
    \ifx\class@label\@empty%
      \stepcounter{classCounter}%
      \edef\class@label{theclass\@arabic\c@classCounter}%
    \else%
    \fi%
  \fi%
%%%% Execution two times cause problems (TODO)
%  \setbox\pgfuml@box@class@name\hbox{\class@font\class@name}
  \draw (#2) node[style=uml class] (\class@label) {
%   \ifdim\class@width>\wd\pgfuml@box@class@name%
      \uml@class@body{\class@font\class@stereotype\makebox[\class@width]{\class@font\class@name}}{#3}%
%    \else%
%      \uml@class@body{\class@font\class@stereotype\class@name}{#3}%
%    \fi%
  };
  \ifx\class@param\@empty%
  \else%
    \draw (\class@label.north east) node[dashed,fill=white,draw=black,opacity=0.8,minimum width=1.2cm,minimum height=8mm] {\texttt{\class@param}};
  \fi%
}

\def\uml@extract#1{
  \pgfextractx{\uml@xtemp}{#1}
  \pgfextracty{\uml@ytemp}{#1}
}

\newboolean{pgfuml@S}%
\newboolean{pgfuml@C}%

% Setting association line style
\def\uml@setlinestyle{
  \ifpgfuml@asso@S%
    \setboolean{pgfuml@S}{true}%
  \else%
    \setboolean{pgfuml@S}{false}%
  \fi%
  \ifpgfuml@asso@C%
    \setboolean{pgfuml@C}{true}%
  \else%
    \setboolean{pgfuml@C}{false}%
  \fi%
  \def\asso@dash{}%
  \ifpgfuml@asso@dashed%
    \def\asso@dash{dashed}%
  \else% 
  \fi%
  \def\asso@arrow{}%
  \ifpgfuml@asso@agre%
    \def\asso@arrow{open diamond-}%
  \else% 
  \fi%
  \ifpgfuml@asso@compo%
    \def\asso@arrow{diamond-}%
  \else%
  \fi%
  \csname ifpgfuml@asso@nav start\endcsname%
    \def\asso@arrow{<-}%
  \else%
  \fi%
  \csname ifpgfuml@asso@nav end\endcsname%
    \ifx\asso@arrow\@empty%
      \def\asso@arrow{->}%
    \else%
      \let\asso@old@arrow=\asso@arrow
      \def\asso@arrow{\asso@old@arrow>}%
    \fi%
  \else%
  \fi%
}
\newcommand{\uml@asso@extremities}[4]{%1->as 2->ae 3->ns 4->ne
  \draw ([yshift=-\asso@sep]temp start) node[#1] {\asso@arity@start};
  \draw ([yshift=\asso@sep]temp end) node[#2] {\asso@arity@end};
  \draw ([yshift=-\asso@sep]temp start) node[#3] {\texttt{\asso@name@start}};
  \draw ([yshift=\asso@sep]temp end) node[#4] {\texttt{\asso@name@end}};
}

\define@key[pgfuml]{asso}{name}{\def\asso@name{#1}}
\define@key[pgfuml]{asso}{name pos}{\def\asso@name@pos{#1}}
\define@key[pgfuml]{asso}{arity start}{\def\asso@arity@start{#1}}
\define@key[pgfuml]{asso}{arity end}{\def\asso@arity@end{#1}}
\define@key[pgfuml]{asso}{name start}{\def\asso@name@start{#1}}
\define@key[pgfuml]{asso}{name end}{\def\asso@name@end{#1}}
\define@key[pgfuml]{asso}{C sep}{\setlength\asso@C@sep{#1}}
\define@key[pgfuml]{asso}{sep}{\setlength\asso@sep{#1}}
\define@boolkey[pgfuml]{asso}{compo}[true]{}
\define@boolkey[pgfuml]{asso}{dashed}[true]{}
\define@boolkey[pgfuml]{asso}{agre}[true]{}
\define@boolkey[pgfuml]{asso}{S}[true]{}
\define@boolkey[pgfuml]{asso}{C}[true]{}
\define@boolkey[pgfuml]{asso}{nav start}[true]{}
\define@boolkey[pgfuml]{asso}{nav end}[true]{}
\define@boolkey[pgfuml]{asso}{inv route}[true]{}

\presetkeys[pgfuml]{asso}{name pos=,name=,arity start=,arity end=,name start=,name end=,nav start=false,nav end=false,compo=false,agre=false,sep=0mm,inv route=false,dashed=false,S=false,C=false,C sep=2cm}{}
\def\umlasso{\@ifnextchar[\@umlasso{\@umlasso[]}}
\def\@umlasso[#1](#2)(#3){%
  \setkeys[pgfuml]{asso}{#1}%
  \tikz@scan@one@point\uml@extract(#2)
  \uml@xa=\uml@xtemp
  \uml@ya=\uml@ytemp
  \tikz@scan@one@point\uml@extract(#3)
  \uml@xb=\uml@xtemp
  \uml@yb=\uml@ytemp
  % setting line style (dashed, arrow heads, ...)
  \uml@setlinestyle
  \ifthenelse{\boolean{pgfuml@S}}{%
    % ASSO en S
    \ifx\asso@name@pos\@empty\relax%
      \def\asso@name@pos{right}%
    \else\fi%
    \draw ($1/2*(#2) + 1/2*(#3)$) node[coordinate] (middle) {};
    \csname ifpgfuml@asso@inv route\endcsname%
      \draw[\asso@arrow,\asso@dash] (#2) |- (middle) node[pos=0,coordinate] (temp start) {}  -| (#3) node[pos=1,coordinate] (temp end) {};
      \uml@asso@extremities{above right}{below right}{above left}{below left}%1->as 2->ae 3->ns 4->ne
    \else%
      \draw[\asso@arrow,\asso@dash] (#2) -| (middle) node[pos=0,coordinate] (temp start) {}  |- (#3) node[pos=1,coordinate] (temp end) {};
      \uml@asso@extremities{above right}{above left}{below right}{below left}%1->as 2->ae 3->ns 4->ne
    \fi%
    % FIN ASSO en S
  }{%
    \ifthenelse{\boolean{pgfuml@C}}{%
      % ASSO en C
      \ifx\asso@name@pos\@empty\relax%
      \def\asso@name@pos{right}%
      \else\fi%
      \csname ifpgfuml@asso@inv route\endcsname%
        \draw ([xshift=\asso@C@sep]$1/2*(#2) + 1/2*(#3)$) node[coordinate] (middle) {};
      \else%
        \draw ([xshift=-\asso@C@sep]$1/2*(#2) + 1/2*(#3)$) node[coordinate] (middle) {};
      \fi%
      \draw[\asso@arrow,\asso@dash] (#2) -| (middle) node[pos=0,coordinate] (temp start) {}  |- (#3) node[pos=1,coordinate] (temp end) {};
      \csname ifpgfuml@asso@inv route\endcsname%
        \uml@asso@extremities{above right}{above right}{below right}{below right}%1->as 2->ae 3->ns 4->ne
      \else%
        \uml@asso@extremities{above left}{above left}{below left}{below left}%1->as 2->ae 3->ns 4->ne
      \fi%
      % FIN ASSO en C
    }{%
      % x distance between the two classes
      \ifthenelse{\lengthtest{\uml@xb < \uml@xa}}{%
        \setlength\uml@diff@x{\uml@xa-\uml@xb}%
      }{%
        \setlength\uml@diff@x{\uml@xb-\uml@xa}%
      }%
      % It seems that sometimes 0 is not 0...
      \ifthenelse{\lengthtest{\uml@diff@x<\uml@dim@z}}{%
        % ASSO VERTICALE
        \ifx\asso@name@pos\@empty\def\asso@name@pos{right}\else\fi%
        \draw[\asso@arrow,\asso@dash] (#2) -- (#3) node[pos=0,coordinate] (temp start) {} node[pos=1,coordinate] (temp end) {} node[pos=0.5,coordinate] (middle) {};
        \ifthenelse{\lengthtest{\uml@yb < \uml@ya}}{
          \uml@asso@extremities{below left}{above left}{below right}{above right}%1->as 2->ae 3->ns 4->ne
        }{
          \uml@asso@extremities{above left}{below left}{above right}{below right}%1->as 2->ae 3->ns 4->ne
        }
      }{% FIN ASSO VERTICALE
        % y distance between the two classes
        \ifthenelse{\lengthtest{\uml@yb < \uml@ya}}{%
          \setlength\uml@diff@y{\uml@ya-\uml@yb}%
        }{%
          \setlength\uml@diff@y{\uml@yb-\uml@ya}%
        }%
        \ifthenelse{\lengthtest{\uml@diff@y<\uml@dim@z}}{%
          % ASSO HORIZONTALE
          \ifx\asso@name@pos\@empty\def\asso@name@pos{above}\else\fi%
          \draw[\asso@arrow,\asso@dash] (#2) -- (#3) node[pos=0,coordinate] (temp start) {} node[pos=1,coordinate] (temp end) {} node[pos=0.5,coordinate] (middle) {};
          \ifthenelse{\lengthtest{\uml@xb > \uml@xa}}{
            \uml@asso@extremities{above right}{above left}{below right}{below left}%1->as 2->ae 3->ns 4->ne
          }{
            \uml@asso@extremities{above left}{above right}{below left}{below right}%1->as 2->ae 3->ns 4->ne
          }
        }{ % FIN ASSO HORIZONTALE
          % ASSO EN L
          \csname ifpgfuml@asso@inv route\endcsname%
            \draw[\asso@arrow,\asso@dash] (#2) -| (#3) node[pos=0,coordinate] (temp start) {} node[pos=1,coordinate] (temp end) {} node[pos=0.5,coordinate] (middle) {};
          \else%
            \draw[\asso@arrow,\asso@dash] (#2) |- (#3) node[pos=0,coordinate] (temp start) {} node[pos=1,coordinate] (temp end) {} node[pos=0.5,coordinate] (middle) {};
            \fi%
            \ifthenelse{\lengthtest{\uml@xb > \uml@xa}}{%
              \csname ifpgfuml@asso@inv route\endcsname%
                \ifx\asso@name@pos\@empty\def\asso@name@pos{above left}\else\fi%
                \ifthenelse{\lengthtest{\uml@yb > \uml@ya}}{
                  \uml@asso@extremities{above right}{below left}{below right}{below right}%1->as 2->ae 3->ns 4->ne
                }{
                  \uml@asso@extremities{above right}{above right}{below right}{above left}%1->as 2->ae 3->ns 4->ne
                }
              \else%
                \ifx\asso@name@pos\@empty\def\asso@name@pos{above right}\else\fi%
                \ifthenelse{\lengthtest{\uml@yb > \uml@ya}}{
                  \uml@asso@extremities{above left}{above left}{above right}{below left}%1->as 2->ae 3->ns 4->ne
                }{
                  \uml@asso@extremities{below left}{below left}{below right}{above left}%1->as 2->ae 3->ns 4->ne
                }
              \fi%
            }{
              \csname ifpgfuml@asso@inv route\endcsname%
                \ifx\asso@name@pos\@empty\def\asso@name@pos{above right}\else\fi%
                \ifthenelse{\lengthtest{\uml@yb > \uml@ya}}{
                  \uml@asso@extremities{below left}{below left}{above left}{below right}%1->as 2->ae 3->ns 4->ne
                }{
                  \uml@asso@extremities{above left}{above left}{below left}{above right}%1->as 2->ae 3->ns 4->ne
                }
              \else%
                \ifx\asso@name@pos\@empty\def\asso@name@pos{above left}\else\fi%
                \ifthenelse{\lengthtest{\uml@yb > \uml@ya}}{
                  \uml@asso@extremities{above right}{above right}{above left}{below right}%1->as 2->ae 3->ns 4->ne
                }{
                  \uml@asso@extremities{below left}{above right}{below right}{below right}%1->as 2->ae 3->ns 4->ne
                }
              \fi%
            }
          }
        }
      }%
    }
  % finally, the name of the asso in the middle
  \draw (middle) node[\asso@name@pos] {\textit{\asso@name}};
}
\def\umlinherit(#1)(#2){\draw[-open triangle 45] (#1) -- (#2);}
\def\umlinheritmult(#1)(#2){
  \pgfextracty{\uml@ya}{\pgfpointanchor{#2}{south}}
  \setlength\inherit@min@sep{30cm}%
  \@for\@aclass:=#1\do{%
    \pgfextracty{\uml@yb}{\pgfpointanchor{\@aclass}{north}}
    \setlength\inherit@sep{\uml@ya - \uml@yb}%
    \setlength\inherit@sep{2\inherit@sep/3}%
    \ifthenelse{\lengthtest{\inherit@min@sep > \inherit@sep}}{
      \setlength\inherit@min@sep{\inherit@sep}%
    }{}
  }
  \draw[-open triangle 45] ([yshift=-\inherit@min@sep]#2.south) -- (#2);
  \@for\@aclass:=#1\do{%
    \draw (\@aclass) |- ([yshift=-\inherit@min@sep]#2.south);
  }
}
\def\umlimplem(#1)(#2){\draw[dashed,-open triangle 45] (#1) -- node {\textit{implements}} (#2);}
\def\umlimplemmult(#1)(#2){
  \pgfextracty{\uml@ya}{\pgfpointanchor{#2}{south}}
  \setlength\inherit@min@sep{30cm}%
  \@for\@aclass:=#1\do{%
    \pgfextracty{\uml@yb}{\pgfpointanchor{\@aclass}{north}}
    \setlength\inherit@sep{\uml@ya - \uml@yb}%
    \setlength\inherit@sep{\inherit@sep/2}%
    \ifthenelse{\lengthtest{\inherit@min@sep > \inherit@sep}}{
      \setlength\inherit@min@sep{\inherit@sep}%
    }{}
  }
  \draw[dashed,-open triangle 45] ([yshift=-\inherit@min@sep]#2.south) -- node {\textit{implements}} (#2);
  \@for\@aclass:=#1\do{%
    \draw[dashed] (\@aclass) |- ([yshift=-\inherit@min@sep]#2.south);
  }
}
\def\umldep(#1)(#2){\draw[dashed,->] (#1) -- (#2);}

\newcommand{\actor}[2][]{%
  {%
    \begin{tabular}[t]{c}%
      \begin{tikzpicture}[#1]
        \draw (0,1.6) circle (0.3cm);%        la tete
        \draw (0,.65) -- (0,1.3);%    le tronc
        \draw (-0.25,0) -- (0,0.65);% jambe gauche
        \draw (0.25,0) -- (0,0.65);%  jambe droite
        \draw (-0.5,1) -- (0.5,1);%       les bras
      \end{tikzpicture}\\
      #2%
    \end{tabular}%
  }%
}

\def\umlactor{\@ifnextchar[\@umlactor{\@umlactor[]}}
\def\@umlactor[#1](#2)#3{%
  \draw (#2) node (#3) {\actor[#1]{#3}};
}
\define@key[pgfuml]{func}{label}{\def\func@label{#1}}
\presetkeys[pgfuml]{func}{label=}{}
\def\umlfunc{\@ifnextchar[\@umlfunc{\@umlfunc[]}}
\def\@umlfunc[#1](#2)#3{%
  \setkeys[pgfuml]{func}{#1}%
  \ifx\func@label\@empty
  \draw (#2) node[ellipse,draw] {#3};
  \else%
  \draw (#2) node[ellipse,draw] (\func@label) {#3};
  \fi%
}
\def\umlsyst{\@ifnextchar[\@umlsyst{\@umlsyst[]}}
\def\@umlsyst[#1](#2)#3#4{
  \draw (#2) node[draw,inner xsep=5mm,inner ysep=3mm,rounded corners,#1] {
    \begin{tikzpicture}[color=black,inner sep=2mm,remember picture=true] 
      #4
      \draw ([yshift=-4mm]current bounding box.south) node[anchor=north] {\emph{#3}}; 
    \end{tikzpicture} 
  };
}
\newlength{\seq@pos}
\newlength{\seq@start}
\newlength{\seq@step}
\newlength{\seq@base}
\define@key[pgfuml]{seq}{step}{\setlength\seq@step{#1}}
\define@key[pgfuml]{seq}{start}{\setlength\seq@start{#1}}
\define@key[pgfuml]{seq}{base}{\setlength\seq@base{#1}}
\define@key[pgfuml]{seq}{font}{\def\seq@font{#1}}
\presetkeys[pgfuml]{seq}{step=10mm,start=5mm,base=0mm,font=\normalsize}{}
\def\diagseq{\@ifnextchar[\@diagseq{\@diagseq[]}}
\def\@diagseq[#1]{%
  \setkeys[pgfuml]{seq}{#1}%
  \setlength{\seq@pos}{\seq@start}
  \begin{tikzpicture}[>=stealth,font=\seq@font]
}
\def\enddiagseq{%
  \end{tikzpicture}
}
\newcommand*{\umlspace}{\addtolength{\seq@pos}{\seq@step}}
\define@key[pgfuml]{selfsend}{label}{\def\selfsend@label{#1}}
\presetkeys[pgfuml]{selfsend}{label=}{}
\def\umlselfsend{\@ifnextchar[\@umlselfsend{\@umlselfsend[]}}
\def\@umlselfsend[#1](#2)#3{
  \setkeys[pgfuml]{selfsend}{#1}%
  \addtolength{\seq@pos}{\seq@step}
  \pgfextractx{\uml@xa}{\pgfpointanchor{#2}{center}}
  \ifx\selfsend@label\@empty\relax
    \draw[-triangle 45,thick] (\uml@xa,\seq@base-\seq@pos) -| ([xshift=5mm]\uml@xa,\seq@base-\seq@pos-0.5\seq@step) node[right] {\smaller\texttt{#3}} |-  (\uml@xa,\seq@base-\seq@pos-\seq@step);
  \else
    \draw[-triangle 45,thick] (\uml@xa,\seq@base-\seq@pos) -| ([xshift=5mm]\uml@xa,\seq@base-\seq@pos-0.5\seq@step) node[right] (\selfsend@label) {\smaller\texttt{#3}} |-  (\uml@xa,\seq@base-\seq@pos-\seq@step);
  \fi
  \addtolength{\seq@pos}{\seq@step}
}
\define@key[pgfuml]{send}{label}{\def\send@label{#1}}
\presetkeys[pgfuml]{send}{label=}{}
\def\umlsend{\@ifnextchar[\@umlsend{\@umlsend[]}}
\def\@umlsend[#1](#2)(#3)#4{
  \setkeys[pgfuml]{send}{#1}%
  \addtolength{\seq@pos}{\seq@step}
  \pgfextractx{\uml@xa}{\pgfpointanchor{#2}{center}}
  \pgfextractx{\uml@xb}{\pgfpointanchor{#3}{center}}
  \ifx\send@label\@empty\relax
    \draw[-triangle 45,thick] (\uml@xa,\seq@base-\seq@pos) -- node[pos=0.5,above] {\smaller\texttt{#4}} (\uml@xb,\seq@base-\seq@pos);
  \else
    \draw[-triangle 45,thick] (\uml@xa,\seq@base-\seq@pos) -- node[pos=0.5,above] (\send@label) {\smaller\texttt{#4}} (\uml@xb,\seq@base-\seq@pos);
  \fi
}
\define@key[pgfuml]{resp}{label}{\def\resp@label{#1}}
\presetkeys[pgfuml]{resp}{label=}{}
\def\umlresp{\@ifnextchar[\@umlresp{\@umlresp[]}}
\def\@umlresp[#1](#2)(#3)#4{
  \setkeys[pgfuml]{resp}{#1}%
  \addtolength{\seq@pos}{\seq@step}
  \pgfextractx{\uml@xa}{\pgfpointanchor{#2}{center}}
  \pgfextractx{\uml@xb}{\pgfpointanchor{#3}{center}}
  \ifx\resp@label\@empty
    \draw[-triangle 45,thick,dashed] (\uml@xa,\seq@base-\seq@pos) -- node[pos=0.5,above] {\smaller\texttt{#4}} (\uml@xb,\seq@base-\seq@pos);
  \else
    \draw[-triangle 45,thick,dashed] (\uml@xa,\seq@base-\seq@pos) -- node[pos=0.5,above] (\resp@label) {\smaller\texttt{#4}} (\uml@xb,\seq@base-\seq@pos);
  \fi
}
\define@key[pgfuml]{create}{label}{\def\create@label{#1}}
\presetkeys[pgfuml]{create}{label=}{}
\def\umlcreate{\@ifnextchar[\@umlcreate{\@umlcreate[]}}
\def\@umlcreate[#1](#2)(#3){
  \setkeys*[pgfuml]{create}{#1}%
  \pgfextracty{\uml@ya}{\pgfpointanchor{#2}{center}}
  \ifx\create@label\@empty%
    \stepcounter{classCounter}%
    \edef\create@label{theclass\@arabic\c@classCounter}%
  \else%
  \fi%
  \addtolength{\seq@pos}{\seq@step}
  \umlclass[#1,label=\create@label](#3,\uml@ya-\seq@pos){}
  \draw[-triangle 45,thick] ([yshift=-\seq@pos]#2.center) -- node[above] {\smaller<<create>>} (\create@label);
}
%\def\umldestroy{\@ifnextchar[\@umldestroy{\@umldestroy[]}}
\def\umldestroy(#1)(#2){
  \addtolength{\seq@pos}{\seq@step}
  \pgfextractx{\uml@xa}{\pgfpointanchor{#1}{center}}
  \pgfextractx{\uml@xb}{\pgfpointanchor{#2}{center}}
  \draw[-triangle 45,thick] (\uml@xa,\seq@base-\seq@pos) -- node[pos=0.5,above] {\smaller<<destroy>>} (\uml@xb,\seq@base-\seq@pos);
  \draw (\uml@xb,\seq@base-\seq@pos-\seq@step/3) node[cross out,draw,line width=0.6pt] (fv) {};
  \draw (#2) -- (fv.center);
}
\def\umldefclass{\@ifnextchar[\@umldefclass{\@umldefclass[]}}
\def\@umldefclass[#1](#2){
  \umlclass[#1](#2,\seq@base-\seq@pos+\seq@start){}
}
\def\umlclassend(#1){
  \addtolength{\seq@pos}{0.5\seq@step}
  \@for\@aclass:=#1\do{%
    \pgfextractx{\uml@xa}{\pgfpointanchor{\@aclass}{center}}
    \draw (\@aclass) -- (\uml@xa,\seq@base-\seq@pos);
  }
}
\newlength{\seq@pos@loop@begin}
\newlength{\seq@pos@loop@end}
\def\umlloop#1(#2)(#3)#4{%
  \setlength{\seq@pos@loop@begin}{\seq@pos}
  \addtolength{\seq@pos@loop@begin}{\seq@step/2}
  \addtolength{\seq@pos}{\seq@step/2}
  #4
  \setlength{\seq@pos@loop@end}{\seq@pos}
  \addtolength{\seq@pos@loop@end}{\seq@step/2}
  \draw ([yshift=-\seq@pos@loop@begin,xshift=-3mm]#2) rectangle ([yshift=-\seq@pos@loop@end,xshift=3mm]#3);
  \draw ([yshift=-\seq@pos@loop@begin,xshift=-3mm]#2) node[draw,anchor=north west] {\bf\smaller loop};
  \draw ([yshift=-\seq@pos@loop@begin,xshift=6mm]#2) node[anchor=north west] {\bf\smaller{} [#1]};
}
\newlength{\seq@pos@alt@begin}
\newlength{\seq@pos@alt@middle}
\newlength{\seq@pos@alt@end}
\def\umlalt(#1)(#2)#3#4#5#6{%
  \setlength{\seq@pos@alt@begin}{\seq@pos}
  \addtolength{\seq@pos@alt@begin}{\seq@step/2}
  \addtolength{\seq@pos}{\seq@step/2}
  #4
  \setlength{\seq@pos@alt@middle}{\seq@pos}
  \addtolength{\seq@pos@alt@middle}{\seq@step/2}
  \addtolength{\seq@pos}{\seq@step/2}
  #6
  \setlength{\seq@pos@alt@end}{\seq@pos}
  \addtolength{\seq@pos@alt@end}{\seq@step/2}
  \draw ([yshift=-\seq@pos@alt@begin,xshift=-3mm]#1) rectangle ([yshift=-\seq@pos@alt@middle,xshift=3mm]#2);
  \draw ([yshift=-\seq@pos@alt@middle,xshift=-3mm]#1) rectangle ([yshift=-\seq@pos@alt@end,xshift=3mm]#2);
  \draw ([yshift=-\seq@pos@alt@begin,xshift=-3mm]#1) node[draw,anchor=north west] {\bf\smaller alt};
  \draw ([yshift=-\seq@pos@alt@begin,xshift=6mm]#1) node[anchor=north west] {\bf\smaller{}[#3]};
  \draw ([yshift=-\seq@pos@alt@middle,xshift=6mm]#1) node[anchor=north west] {\bf\smaller{}[#5]};
}
\newlength\note@width
\define@key[pgfuml]{note}{label}{\def\note@label{#1}}
\define@key[pgfuml]{note}{width}{\setlength\note@width{#1}}
\presetkeys[pgfuml]{note}{label=,width=3cm}{}
\def\umlnote{\@ifnextchar[\@umlnote{\@umlnote[]}}
\def\@umlnote[#1](#2)#3{%
  \setkeys[pgfuml]{note}{#1}%
  \ifx\note@label\@empty
    \draw (#2) node[uml note,draw,inner sep=2mm,text badly centered,text width=\note@width] {#3};
  \else
    \draw (#2) node[uml note,draw,inner sep=2mm,text badly centered,text width=\note@width] (\note@label) {#3};
  \fi
}
\pgfdeclareshape{uml note}
{
  \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north west}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{mid}
  \inheritanchor[from=rectangle]{mid west}
  \inheritanchor[from=rectangle]{mid east}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{base west}
  \inheritanchor[from=rectangle]{base east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{south east}
  \foregroundpath{
    % store lower right in xa/ya and upper right in xb/yb
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfutil@tempdima=\pgf@xb%
    \pgfutil@tempdimb=\pgf@yb%
    \advance\pgfutil@tempdima by-2mm%
    \advance\pgfutil@tempdimb by-2mm%
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgfutil@tempdima}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgfutil@tempdimb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgfutil@tempdimb}}
 }
}

%%AFaire :
% - vérifier la syntaxe des lignes de vie
% - fin de ligne de vie automatique dans diagseq
% - augmenter cas de test sur le placement relatif
