%%
%% This is file `smartdiagram.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% smartdiagram.dtx  (with options: `package')
%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
%% smartdiagram --- Automatic creation of smart diagrams from lists of items.
%% E-mail: claudio.fiandrino@gmail.com
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{smartdiagram}[2012/10/28 v0.1 Automatic creation of smart diagrams from lists of items.]

\RequirePackage{tikz}
\RequirePackage{xparse,etoolbox}

\usetikzlibrary{backgrounds,calc,fadings,shadows,shapes.arrows}
\pgfdeclarelayer{smart diagram arrow back}
\pgfsetlayers{background,smart diagram arrow back,main}
\@namedef{color@1}{red!40}
\@namedef{color@2}{cyan!40}
\@namedef{color@3}{blue!40}
\@namedef{color@4}{green!40}
\@namedef{color@5}{orange!40}
\@namedef{color@6}{yellow!40}
\@namedef{color@7}{magenta!40}
\@namedef{color@8}{brown!40}
\@namedef{color@9}{violet!40}
\@namedef{color@10}{teal!40}
\tikzset{rnd rectangle/.style={rectangle,rounded corners}
}

\def\CalcHeight(#1,#2)#3{%
\pgfpointdiff{\pgfpointanchor{#1}{south west}}{\pgfpointanchor{#2}{north west}}
\pgfmathsetmacro{\myheight}{veclen(\pgf@x,\pgf@y)}
\global\expandafter\edef\csname #3\endcsname{\myheight}
}
\pgfkeys{/smart diagram/.cd, module minimum width/.initial=2cm,
   module minimum height/.initial={1cm},
   module y sep/.initial={1.65},
   descriptive items y sep/.initial={1.75},
   text width/.initial={1.5cm},
   description title width/.initial={1.5cm},
   description text width/.initial={5cm},
   description title text width/.initial={1.25cm},
   description title font/.initial={\small},
   description font/.initial={\small},
   description width/.initial={5.5cm},
   font/.initial={\small},
   border color/.initial={gray},
   circular distance/.initial={2.75cm},
   arrow line width/.initial={0.1cm},
   module shape/.initial={rnd rectangle},
   insert decoration/.initial={},
   arrow tip/.initial={stealth},
   bubble center node size/.initial={4cm},
   bubble center node font/.initial={\large},
   bubble center node color/.initial={lightgray!60},
   distance center/other bubbles/.initial=0.8cm,
   distance text center bubble/.initial={0.5cm},
   bubble fill opacity/.initial={0.5},
   bubble node size/.initial={2.5cm},
   bubble text opacity/.initial={0.8},
   bubble node font/.initial={\normalfont},
   planet size/.initial={2.5cm},
   planet color/.initial={lightgray!60},
   planet font/.initial={\large},
   distance planet-connection/.initial={0.1cm},
   distance planet-text/.initial={0.5cm},
   planet text width/.initial={1.75cm},
   satellite size/.initial={1.75cm},
   satellite font/.initial={\normalfont},
   satellite fill opacity/.initial={0.5},
   satellite text opacity/.initial={0.8},
   satellite text width/.initial={1.5cm},
   distance satellite-connection/.initial={0.075cm},
   connection line width/.initial={0.1cm},
   distance planet-satellite/.initial={3.5cm},
   priority arrow width/.initial={1.5cm},
   priority arrow head extend/.initial={0.15cm},
   priority tick size/.initial={5pt},
   priority arrow height advance/.initial={2cm},
}%

\pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth,
   module minimum height/.get=\moduleheight,
   module y sep/.get=\moduleysep,
   descriptive items y sep/.get=\descriptiveitemsysep,
   text width/.get=\moduletextwidth,
   description title width/.get=\descriptiontitlewidth,
   description text width/.get=\descriptiontextwidth,
   description title text width/.get=\descriptiontitletextwidth,
   description title font/.get=\descriptiontitlefontsize,
   description font/.get=\descriptionfontsize,
   description width/.get=\descriptionwidth,
   font/.get=\modulefontsize,
   border color/.get=\bordercolor,
   circular distance/.get=\circulardistance,
   arrow line width/.get=\arrowlinewidth,
   module shape/.get=\moduleshape,
   insert decoration/.get=\borderdecoration,
   arrow tip/.get=\arrowtip,
   bubble center node size/.get=\bubblecenternodesize,
   bubble center node font/.get=\bubblecenternodefont,
   bubble center node color/.get=\bubblecenternodecolor,
   distance center/other bubbles/.get=\distancecenterotherbubbles,
   distance text center bubble/.get=\distancetextcenterbubble,
   bubble fill opacity/.get=\bubblefillopacity,
   bubble node size/.get=\bubblenodesize,
   bubble text opacity/.get=\bubbletextopacity,
   bubble node font/.get=\bubblenodefont,
   planet size/.get=\planetminimumsize,
   planet color/.get=\planetcolor,
   planet font/.get=\planetfont,
   distance planet-connection/.get=\planetoutersep,
   distance planet-text/.get=\planetinnersep,
   planet text width/.get=\planettextwidth,
   satellite size/.get=\satelliteminimumsize,
   satellite font/.get=\satellitefont,
   satellite fill opacity/.get=\satellitefillopacity,
   satellite text opacity/.get=\satellitetextopacity,
   satellite text width/.get=\satellitetextwidth,
   distance satellite-connection/.get=\satelliteoutersep,
   connection line width/.get=\connectionlinewidth,
   distance planet-satellite/.get=\distanceplanetsatellite,
   priority arrow width/.get=\priorityarrowwidth,
   priority arrow head extend/.get=\priorityarrowheadextend,
   priority tick size/.get=\prioritytick,
   priority arrow height advance/.get=\priorityarrowheightadvance,
}%

\pgfkeys{/smart diagram/.cd, set color list/.code={
      \foreach \listitem [count=\i] in {#1}{
         \global\@namedef{color@\i\expandafter}\expandafter{\listitem}
      }
   }
}

\pgfkeys{/smart diagram/.cd, use predefined color list/.code={
      \@namedef{color@1}{red!30}
      \@namedef{color@2}{cyan!30}
      \@namedef{color@3}{blue!30}
      \@namedef{color@4}{green!30}
      \@namedef{color@5}{orange!30}
      \@namedef{color@6}{yellow!30}
      \@namedef{color@7}{magenta!30}
      \@namedef{color@8}{brown!30}
      \@namedef{color@9}{violet!30}
      \@namedef{color@10}{teal!30}
   }
}

\NewDocumentCommand{\smartdiagramset}{m}{%
  \pgfkeys{/smart diagram/.cd,#1}%
  \pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth,
   module minimum height/.get=\moduleheight,
   module y sep/.get=\moduleysep,
   descriptive items y sep/.get=\descriptiveitemsysep,
   text width/.get=\moduletextwidth,
   description title width/.get=\descriptiontitlewidth,
   description text width/.get=\descriptiontextwidth,
   description title text width/.get=\descriptiontitletextwidth,
   description title font/.get=\descriptiontitlefontsize,
   description font/.get=\descriptionfontsize,
   description width/.get=\descriptionwidth,
   font/.get=\modulefontsize,
   border color/.get=\bordercolor,
   circular distance/.get=\circulardistance,
   arrow line width/.get=\arrowlinewidth,
   module shape/.get=\moduleshape,
   insert decoration/.get=\borderdecoration,
   arrow tip/.get=\arrowtip,
   bubble center node size/.get=\bubblecenternodesize,
   bubble center node font/.get=\bubblecenternodefont,
   bubble center node color/.get=\bubblecenternodecolor,
   distance center/other bubbles/.get=\distancecenterotherbubbles,
   distance text center bubble/.get=\distancetextcenterbubble,
   bubble fill opacity/.get=\bubblefillopacity,
   bubble node size/.get=\bubblenodesize,
   bubble text opacity/.get=\bubbletextopacity,
   bubble node font/.get=\bubblenodefont,
   planet size/.get=\planetminimumsize,
   planet color/.get=\planetcolor,
   planet font/.get=\planetfont,
   distance planet-connection/.get=\planetoutersep,
   distance planet-text/.get=\planetinnersep,
   planet text width/.get=\planettextwidth,
   satellite size/.get=\satelliteminimumsize,
   satellite font/.get=\satellitefont,
   satellite fill opacity/.get=\satellitefillopacity,
   satellite text opacity/.get=\satellitetextopacity,
   satellite text width/.get=\satellitetextwidth,
   distance satellite-connection/.get=\satelliteoutersep,
   connection line width/.get=\connectionlinewidth,
   distance planet-satellite/.get=\distanceplanetsatellite,
   priority arrow width/.get=\priorityarrowwidth,
   priority arrow head extend/.get=\priorityarrowheadextend,
   priority tick size/.get=\prioritytick,
   priority arrow height advance/.get=\priorityarrowheightadvance,
  }%
}%
\tikzfading[name=priorityarrowfading, bottom color=transparent!5, top color=transparent!80]
\tikzset{priority arrow fill/.style={fill=gray,path fading=priorityarrowfading}}

\tikzset{module/.style={
      \pgfkeysvalueof{/smart diagram/module shape},
      thick,
      draw=\bordercolor,
      top color=white,
      bottom color=\col,
      text width=\moduletextwidth,
      minimum width=\modulewidth,
      minimum height=\moduleheight,
      font=\modulefontsize,
      \borderdecoration
   },
   diagram arrow type/.style={
      >=\arrowtip,line width=\arrowlinewidth,\col,
   },
}
\tikzset{description title/.style={
      circle,
      draw=\bordercolor,
      minimum width=\descriptiontitlewidth,
      anchor=east,
      bottom color=\col,
      top color=white!80!\col,
      font=\descriptiontitlefontsize,
      text width=\descriptiontitletextwidth,
      \borderdecoration,
   },
   description/.style={
      \pgfkeysvalueof{/smart diagram/module shape},
      text width=\descriptiontextwidth,
      draw=\bordercolor,
      anchor=west,
      minimum height=\moduleheight,
      minimum width=\descriptionwidth,
      bottom color=\col,
      top color=white!80!\col,
      font=\descriptionfontsize,
      \borderdecoration,
   }
}
\tikzset{priority arrow/.style={
      draw=\bordercolor,
      single arrow,
      minimum height=\distancemodules,
      minimum width=\priorityarrowwidth,
      priority arrow fill,
      rotate=90,
      single arrow head extend=\priorityarrowheadextend,
      anchor=west,
   }
}
\tikzset{bubble center node/.style={
      minimum size=\bubblecenternodesize,
      circle,
      fill=\bubblecenternodecolor,
      font=\bubblecenternodefont,
      outer sep=\distancecenterotherbubbles,
      inner sep=\distancetextcenterbubble,
   },
   bubble node/.style={
      minimum size=\bubblenodesize,
      circle,
   ultra thick,
   font=\bubblenodefont,
   draw=white,
   fill opacity=\bubblefillopacity,
   fill=\col,
   text opacity=\bubbletextopacity,
   }
}
\tikzset{planet/.style={
      minimum size=\planetminimumsize,
      circle,
      fill=\planetcolor,
      font=\planetfont,
      outer sep=\planetoutersep,
      inner sep=\planetinnersep,
      text width=\planettextwidth,
   },
   satellite/.style={
      minimum size=\satelliteminimumsize,
      circle,
   font=\satellitefont,
   fill opacity=\satellitefillopacity,
   fill=\col,
   text opacity=\satellitetextopacity,
   text width=\satellitetextwidth,
   outer sep=\satelliteoutersep,
   },
   connection planet satellite/.style={
   line width=\connectionlinewidth,
   >=\arrowtip,
   \col,
   }
}
\NewDocumentCommand{\smartdiagram}{r[] m}{%
   \IfNoValueTF{#1}{% true-no value 1
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}}
   {%false-no value 1
   \ifstrequal{#1}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center}]

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}

   \foreach \smitem [count=\xi] in {#2}{%
   \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   \edef\col{\@nameuse{color@\xi}}
   \node[module,drop shadow] (module\xi) at (\angle:\circulardistance) {\smitem };
   }%

   \foreach \smitem [count=\xi] in {#2}{%
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
   \edef\col{\@nameuse{color@\xj}}
   \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm]
   (module\xj) to[bend left] (module\xi);
   }%
   \end{tikzpicture}
   }{}% end-circular diagram
   \ifstrequal{#1}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center}]

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\moduleysep}
       in node[module,drop shadow] (module\xi) at +(0,\n2) {\smitem};

   }%

   \foreach \smitem [count=\xi] in {#2}{%
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
   \edef\col{\@nameuse{color@\xj}}
   \ifnum\xi<\maxsmitem
   \begin{pgfonlayer}{smart diagram arrow back}
   \draw[<-,diagram arrow type] (module\xj) -- (module\xi);
   \end{pgfonlayer}
   \fi
   % last arrow - not display it in background
   \ifnum\xi=\maxsmitem
   \draw[<-,diagram arrow type] (module\xj.east)--
   ($(module\xj.east)+(1,0)$) |- (module\xi);
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \foreach \subitem [count=\xii] in \smitem{%
   \ifnumequal{\xii}{1}{% true
   \node[description title,drop shadow]
    (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem};
   }{}
   \ifnumequal{\xii}{2}{% true
   \node[description,drop shadow](module\xi)
    at (0,0-\xi*\descriptiveitemsysep) {\subitem};
   }{}
   }%
   }%
   \end{tikzpicture}
   }{}% end-descriptive diagram
   \ifstrequal{#1}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[bubble center node](center bubble){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[bubble node] (module\xi) at (center bubble.\angle) {\smitem };
   }%
   }%
   \end{tikzpicture}
   }{}%end-bubble diagram
   \ifstrequal{#1}{constellation diagram}{% true-constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[planet](planet){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[satellite] (satellite\xi) at (\angle:\distanceplanetsatellite) {\smitem };
   \draw[->,connection planet satellite] (planet) -- (satellite\xi);
   }%
   }%
   \end{tikzpicture}
   }{}%end-constellation diagram
   \ifstrequal{#1}{connected constellation diagram}{% true-connected constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[planet](planet){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[satellite] (satellite\xj) at (\angle:\distanceplanetsatellite) {\smitem };
   }%
   }%
   \foreach \smitem [count=\xi] in {#2}{%
      \ifnumgreater{\xi}{1}{ %true
      \pgfmathtruncatemacro{\xj}{\xi-1}
      \edef\col{\@nameuse{color@\xj}}
      \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
      \path[connection planet satellite] (satellite\xj) edge[bend right] (satellite\xk);
   }{}
   }%
   \end{tikzpicture}
   }{}%end-connected constellation diagram
   \ifstrequal{#1}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)}
   \pgfmathsetmacro\priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
    \node[description,drop shadow](module\xi)
    at (0,0+\xi*\descriptiveitemsysep) {\smitem};
\draw[line width=\prioritytick,\col] ([xshift=-\arrowtickxshift pt]module\xi.base west)--
 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$);
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture}
   }{}% end-priority descriptive diagram
}% end-no value 1
}% end-command
\tikzset{
   sminvisible/.style={opacity=0,text opacity=0},
   smvisible on/.style={smalt=#1{}{sminvisible}},
   smalt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
   },
}

\NewDocumentCommand{\smartdiagramanimated}{r[] m}{%
   \IfNoValueTF{#1}{% true-no value 1
      \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it}
      {Example: \protect\smartdiagram[flow diagram]}}
   {%false-no value 1
   \ifstrequal{#1}{circular diagram}{% true-circular diagram
   \begin{tikzpicture}[every node/.style={align=center}]

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}

   \foreach \smitem [count=\xi] in {#2}{%
   \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi}
   \edef\col{\@nameuse{color@\xi}}
   \node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) at (\angle:\circulardistance) {\smitem };
   }%

   \foreach \smitem [count=\xi] in {#2}
   {%
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
   \pgfmathtruncatemacro{\adv}{\xi + 1)}
   \edef\col{\@nameuse{color@\xi}}
   \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm,
   smvisible on=<\adv->] (module\xj) to[bend left] (module\xi);
   }%
   \end{tikzpicture}
   }{}% end-circular diagram
   \ifstrequal{#1}{flow diagram}{% true-flow diagram
   \begin{tikzpicture}[every node/.style={align=center}]

   \foreach \smitem [count=\xi] in {#2}  {\global\let\maxsmitem\xi}

   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \path let \n1 = {int(0-\xi)}, \n2={0-\xi*\moduleysep}
       in node[module,
        drop shadow={smvisible on=<\xi->},
        smvisible on=<\xi->] (module\xi) at +(0,\n2) {\smitem};

   }%

   \foreach \smitem [count=\xi] in {#2}{%
   \pgfmathtruncatemacro{\xj}{mod(\xi, \maxsmitem) + 1)}
   \edef\col{\@nameuse{color@\xj}}
   \ifnum\xi<\maxsmitem
   \begin{pgfonlayer}{smart diagram arrow back}
   \draw[<-,diagram arrow type,smvisible on=<\xi->]
   (module\xj) -- (module\xi);
   \end{pgfonlayer}
   \fi
   % last arrow - not display it in background
   \ifnum\xi=\maxsmitem
   \draw[<-,diagram arrow type,smvisible on=<\xi->]
   (module\xj.east)--($(module\xj.east)+(1,0)$) |- (module\xi);
   \fi
   }%
   \end{tikzpicture}
   }{}% end-flow diagram
   \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}

   \foreach \subitem [count=\xii] in \smitem{%
      \pgfmathtruncatemacro\subitemvisible{\xi}
   \ifnumequal{\xii}{1}{% true
   \node[description title,drop shadow, smvisible on=<\subitemvisible->]
   (module-title\xi) at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause
   }{}
   \ifnumequal{\xii}{2}{% true
   \node[description,drop shadow,smvisible on=<\subitemvisible->]
   (module\xi)at (0,0-\xi*\descriptiveitemsysep) {\subitem};\pause
   }{}
   }%
   }%
   \end{tikzpicture}
   }{}% end-descriptive diagram
   \ifstrequal{#1}{bubble diagram}{% true-bubble diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[bubble center node, smvisible on=<\xi->](center bubble){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[bubble node, smvisible on=<\xi->](module\xi) at (center bubble.\angle) {\smitem };
   }%
   }%
   \end{tikzpicture}
   }{}%end-bubble diagram
   \ifstrequal{#1}{constellation diagram}{% true-constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[planet, smvisible on=<\xi->](planet){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[satellite, smvisible on=<\xi->] (satellite\xi)
    at (\angle:\distanceplanetsatellite) {\smitem };
   \draw[->,connection planet satellite, smvisible on=<\xi->]
    (planet) -- (satellite\xi);
 }%
   }%
   \end{tikzpicture}
   }{}%end-constellation diagram
   \ifstrequal{#1}{connected constellation diagram}{% true-connected constellation diagram
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1}
   \foreach \smitem [count=\xi] in {#2}{%
   \ifnumequal{\xi}{1}{ %true
   \node[planet,smvisible on=<\xi->](planet){\smitem};
   }{%false
   \pgfmathtruncatemacro{\xj}{\xi-1}
   \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj}
   \edef\col{\@nameuse{color@\xj}}
   \node[satellite,smvisible on=<\xi->] (satellite\xj)
    at (\angle:\distanceplanetsatellite) {\smitem };
   }%
   }%
   \foreach \smitem [count=\xi] in {#2}{%
      \ifnumgreater{\xi}{1}{ %true
      \pgfmathtruncatemacro{\xj}{\xi-1}
      \edef\col{\@nameuse{color@\xj}}
      \pgfmathtruncatemacro{\xk}{mod(\xj,\actualnumitem) +1}
      \pgfmathtruncatemacro{\smvisible}{\xi+1}
      \path[connection planet satellite,smvisible on=<\smvisible->]
       (satellite\xj) edge[bend right] (satellite\xk);
   }{}
   }%
   \end{tikzpicture}
   }{}%end-connected constellation diagram
   \ifstrequal{#1}{priority descriptive diagram}{% true-priority descriptive diagram
   \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)}
   \pgfmathsetmacro\priorityticksize{\pgfmathresult/2}
   \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2}
   \begin{tikzpicture}[every node/.style={align=center}]
   \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi}
   \foreach \smitem [count=\xi] in {#2}{%
   \edef\col{\@nameuse{color@\xi}}
   \pgfmathtruncatemacro\smvisible{\xi+1}
   \node[description,drop shadow={smvisible on=<\smvisible->},smvisible on=<\smvisible->]
    (module\xi) at (0,0+\xi*\descriptiveitemsysep) {\smitem};
\draw[line width=\prioritytick,\col,smvisible on=<\smvisible->]
 ([xshift=-\arrowtickxshift pt]module\xi.base west)--
 ($([xshift=-\arrowtickxshift pt]module\xi.base west)-(\priorityticksize pt,0)$);
   }%
   \coordinate (A) at (module1);
   \coordinate (B) at (module\maxsmitem);
   \CalcHeight(A,B){heightmodules}
   \pgfmathadd{\heightmodules}{\priorityarrowheightadvance}
   \pgfmathsetmacro{\distancemodules}{\pgfmathresult}
   \pgfmathsetmacro\arrowxshift{\priorityarrowwidth/2}
   \begin{pgfonlayer}{background}
   \node[priority arrow] at ([xshift=-\arrowxshift pt]module1.south west){};
   \end{pgfonlayer}
   \end{tikzpicture}
   }{}% end-priority descriptive diagram
   }% end-no value 1
}% end-command

%% 
%% Copyright (C) 2012 by Claudio Fiandrino <claudio.fiandrino@gmail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in the file:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%% Claudio Fiandrino.
%% 
%% This work consists of the file  smartdiagram.dtx
%% and the derived files           smartdiagram.ins,
%%                                 smartdiagram.pdf, and
%%                                 smartdiagram.sty.
%% 
%%
%% End of file `smartdiagram.sty'.
