diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-10 22:27:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-10 22:27:19 +0000 |
commit | bb00029ab0d04cfffed940c6bedc7de20b46e8a8 (patch) | |
tree | 2711e56431f4e6c49bfaffe1854334fcbcf8b456 /Master/texmf-dist/tex/latex/smartdiagram | |
parent | db952596f9303b8c5f81d8cabbb87220c06308cc (diff) |
smartdiagram (10mar13)
git-svn-id: svn://tug.org/texlive/trunk@29329 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/smartdiagram')
-rw-r--r-- | Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty | 355 |
1 files changed, 293 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty b/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty index 0efd91a95d9..de6878aedcd 100644 --- a/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty +++ b/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty @@ -13,12 +13,21 @@ %% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{smartdiagram}[2012/10/28 v0.1 Automatic creation of smart diagrams from lists of items.] +\ProvidesPackage{smartdiagram}[2013/03/09 v0.2 Automatic creation of smart diagrams from lists of items.] \RequirePackage{tikz} -\RequirePackage{xparse,etoolbox} -\usetikzlibrary{backgrounds,calc,fadings,shadows,shapes.arrows} +\RequirePackage{etoolbox} +\RequirePackage{xparse} +\RequirePackage{xstring} + +\usetikzlibrary{backgrounds, + calc, + fadings, + shadows, + shapes.arrows, + shapes.symbols +} \pgfdeclarelayer{smart diagram arrow back} \pgfsetlayers{background,smart diagram arrow back,main} \@namedef{color@1}{red!40} @@ -42,6 +51,7 @@ \pgfkeys{/smart diagram/.cd, module minimum width/.initial=2cm, module minimum height/.initial={1cm}, module y sep/.initial={1.65}, + module x sep/.initial={2.75}, descriptive items y sep/.initial={1.75}, text width/.initial={1.5cm}, description title width/.initial={1.5cm}, @@ -57,6 +67,7 @@ module shape/.initial={rnd rectangle}, insert decoration/.initial={}, arrow tip/.initial={stealth}, + arrow color/.initial={gray}, bubble center node size/.initial={4cm}, bubble center node font/.initial={\large}, bubble center node color/.initial={lightgray!60}, @@ -79,16 +90,28 @@ satellite text width/.initial={1.5cm}, distance satellite-connection/.initial={0.075cm}, connection line width/.initial={0.1cm}, + connection color/.initial={gray}, 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}, + sequence item height/.initial={1cm}, + sequence item width/.initial={2cm}, + sequence item border color/.initial={gray}, + sequence item border size/.initial={1.75\pgflinewidth}, + sequence item font size/.initial={\normalfont}, + sequence item fill opacity/.initial={1}, + sequence item text opacity/.initial={1}, + sequence item text width/.initial={1.9cm}, + sequence item text color/.initial={black}, + sequence item uniform color/.initial={gray!60!black}, }% \pgfkeys{/smart diagram/.cd, module minimum width/.get=\modulewidth, module minimum height/.get=\moduleheight, module y sep/.get=\moduleysep, + module x sep/.get=\modulexsep, descriptive items y sep/.get=\descriptiveitemsysep, text width/.get=\moduletextwidth, description title width/.get=\descriptiontitlewidth, @@ -104,6 +127,7 @@ module shape/.get=\moduleshape, insert decoration/.get=\borderdecoration, arrow tip/.get=\arrowtip, + arrow color/.get=\arrowcolor, bubble center node size/.get=\bubblecenternodesize, bubble center node font/.get=\bubblecenternodefont, bubble center node color/.get=\bubblecenternodecolor, @@ -126,13 +150,25 @@ satellite text width/.get=\satellitetextwidth, distance satellite-connection/.get=\satelliteoutersep, connection line width/.get=\connectionlinewidth, + connection color/.get=\connectioncolor, 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, + sequence item height/.get=\seqitemheight, + sequence item width/.get=\seqitemwidth, + sequence item border color/.get=\seqitembordercolor, + sequence item border size/.get=\seqlinewidth, + sequence item font size/.get=\seqitemfont, + sequence item fill opacity/.get=\seqitemfillopacity, + sequence item text opacity/.get=\seqitemtextopacity, + sequence item text width/.get=\seqitemtextwidth, + sequence item text color/.get=\seqitemtextcolor, + sequence item uniform color/.get=\seqitemuniformcol, }% + \pgfkeys{/smart diagram/.cd, set color list/.code={ \foreach \listitem [count=\i] in {#1}{ \global\@namedef{color@\i\expandafter}\expandafter{\listitem} @@ -154,11 +190,20 @@ } } + +\newif\ifbackarrowdisabled +\pgfkeys{/smart diagram/.cd, + back arrow disabled/.is if=backarrowdisabled, + back arrow disabled=false, +} + + \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, + module x sep/.get=\modulexsep, descriptive items y sep/.get=\descriptiveitemsysep, text width/.get=\moduletextwidth, description title width/.get=\descriptiontitlewidth, @@ -174,6 +219,7 @@ module shape/.get=\moduleshape, insert decoration/.get=\borderdecoration, arrow tip/.get=\arrowtip, + arrow color/.get=\arrowcolor, bubble center node size/.get=\bubblecenternodesize, bubble center node font/.get=\bubblecenternodefont, bubble center node color/.get=\bubblecenternodecolor, @@ -196,15 +242,33 @@ satellite text width/.get=\satellitetextwidth, distance satellite-connection/.get=\satelliteoutersep, connection line width/.get=\connectionlinewidth, + connection color/.get=\connectioncolor, 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, + sequence item height/.get=\seqitemheight, + sequence item width/.get=\seqitemwidth, + sequence item border color/.get=\seqitembordercolor, + sequence item border size/.get=\seqlinewidth, + sequence item font size/.get=\seqitemfont, + sequence item fill opacity/.get=\seqitemfillopacity, + sequence item text opacity/.get=\seqitemtextopacity, + sequence item text width/.get=\seqitemtextwidth, + sequence item text color/.get=\seqitemtextcolor, + sequence item uniform color/.get=\seqitemuniformcol, }% }% -\tikzfading[name=priorityarrowfading, bottom color=transparent!5, top color=transparent!80] -\tikzset{priority arrow fill/.style={fill=gray,path fading=priorityarrowfading}} +\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}, @@ -219,9 +283,22 @@ \borderdecoration }, diagram arrow type/.style={ - >=\arrowtip,line width=\arrowlinewidth,\col, + >=\arrowtip,line width=\arrowlinewidth,\col }, } + +\pgfkeys{/smart diagram/.cd,% + uniform arrow color/.is choice,% + uniform arrow color/true/.code={% + \tikzset{diagram arrow type/.append style={ + \arrowcolor + }, + } + },% + uniform arrow color/false/.style={diagram arrow type},% + uniform arrow color/.default=false, +}% + \tikzset{description title/.style={ circle, draw=\bordercolor, @@ -288,12 +365,12 @@ satellite/.style={ minimum size=\satelliteminimumsize, circle, - font=\satellitefont, - fill opacity=\satellitefillopacity, - fill=\col, - text opacity=\satellitetextopacity, - text width=\satellitetextwidth, - outer sep=\satelliteoutersep, + font=\satellitefont, + fill opacity=\satellitefillopacity, + fill=\col, + text opacity=\satellitetextopacity, + text width=\satellitetextwidth, + outer sep=\satelliteoutersep, }, connection planet satellite/.style={ line width=\connectionlinewidth, @@ -301,40 +378,106 @@ \col, } } + +\tikzset{sequence item/.style={ + minimum height=\seqitemheight, + minimum width=\seqitemwidth, + signal, + signal from=west, + signal to=east, + draw=\seqitembordercolor, + line width=\seqlinewidth, + font=\seqitemfont, + fill opacity=\seqitemfillopacity, + fill=\col, + text opacity=\seqitemtextopacity, + text width=\seqitemtextwidth, + text=\seqitemtextcolor, + } +} + +\pgfkeys{/smart diagram/.cd,% + uniform sequence color/.is choice,% + uniform sequence color/true/.code={% + \tikzset{sequence item/.append style={ + fill=\seqitemuniformcol, + }, + } + },% + uniform sequence color/false/.style={sequence item},% + uniform sequence color/.default=false, +}% + +\pgfkeys{/smart diagram/.cd,% + uniform connection color/.is choice,% + uniform connection color/true/.code={% + \tikzset{connection planet satellite/.append style={ + \connectioncolor + }, + } + },% + uniform connection color/false/.style={connection planet satellite},% + uniform connection color/.default=false, +}% \NewDocumentCommand{\smartdiagram}{r[] m}{% + \StrCut{#1}{:}\diagramtype\option \IfNoValueTF{#1}{% true-no value 1 - \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it} + \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 + \IfStrEq{\diagramtype}{}{% + \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it} + {Example: \protect\smartdiagram[flow diagram]} + }{} + \IfStrEq{\diagramtype}{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} + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi} + }{% false-clockwise-circular diagram + \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi} + } \edef\col{\@nameuse{color@\xi}} - \node[module,drop shadow] (module\xi) at (\angle:\circulardistance) {\smitem }; + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \node[module,drop shadow] (module\xi) + at (-\angle:\circulardistance) {\smitem }; + }{% false-clockwise-circular diagram + \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] + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm] + (module\xj) to[bend right] (module\xi); + }{% false-clockwise-circular diagram + \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 + \IfStrEq{\diagramtype}{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}; - + \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram + \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\modulexsep} in + node[module,drop shadow] (module\xi) at +(\n2,0) {\smitem}; + }{% false-horizontal-flow diagram + \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}{% @@ -345,15 +488,32 @@ \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); + % last arrow - not display it in background - check if disabled + \ifbackarrowdisabled + \relax + \else + \ifnum\xi=\maxsmitem + \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram + \tikzset{square arrow/.style={ + to path={-- ++(0,0.5) -| (\tikztotarget)} + } + } + \draw[<-,diagram arrow type, square arrow] + (module\xj.north) to (module\xi.north); + }{% false-horizontal-flow diagram + \tikzset{square arrow/.style={ + to path={-- ++(0.5,0) |- (\tikztotarget)} + } + } + \draw[<-,diagram arrow type,square arrow] + (module\xj.east) to (module\xi); + } + \fi \fi }% \end{tikzpicture} }{}% end-flow diagram - \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram + \IfStrEq{\diagramtype}{descriptive diagram}{% true-descr. diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{% \edef\col{\@nameuse{color@\xi}} @@ -369,8 +529,8 @@ }% }% \end{tikzpicture} - }{}% end-descriptive diagram - \ifstrequal{#1}{bubble diagram}{% true-bubble diagram + }{}% end-descr. diagram + \IfStrEq{\diagramtype}{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} @@ -381,12 +541,13 @@ \pgfmathtruncatemacro{\xj}{\xi-1} \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} \edef\col{\@nameuse{color@\xj}} - \node[bubble node] (module\xi) at (center bubble.\angle) {\smitem }; + \node[bubble node] (module\xi) + at (center bubble.\angle) {\smitem }; }% }% \end{tikzpicture} }{}%end-bubble diagram - \ifstrequal{#1}{constellation diagram}{% true-constellation diagram + \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} @@ -397,13 +558,14 @@ \pgfmathtruncatemacro{\xj}{\xi-1} \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} \edef\col{\@nameuse{color@\xj}} - \node[satellite] (satellite\xi) at (\angle:\distanceplanetsatellite) {\smitem }; + \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 + }{}%end-const diagram + \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} @@ -414,7 +576,8 @@ \pgfmathtruncatemacro{\xj}{\xi-1} \pgfmathtruncatemacro{\angle}{360/\actualnumitem*\xj} \edef\col{\@nameuse{color@\xj}} - \node[satellite] (satellite\xj) at (\angle:\distanceplanetsatellite) {\smitem }; + \node[satellite] (satellite\xj) + at (\angle:\distanceplanetsatellite) {\smitem }; }% }% \foreach \smitem [count=\xi] in {#2}{% @@ -422,12 +585,13 @@ \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); + \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 + \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)} \pgfmathsetmacro\priorityticksize{\pgfmathresult/2} \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2} @@ -437,7 +601,8 @@ \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)-- +\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); @@ -451,6 +616,18 @@ \end{pgfonlayer} \end{tikzpicture} }{}% end-priority descriptive diagram + \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram + \begin{tikzpicture}[every node/.style={align=center}] + \foreach \x[count=\xi, count=\prevx from 0] in {#2}{% + \edef\col{\@nameuse{color@\xi}} +\ifnum\xi=1 + \node[sequence item] (x-\xi) {\x}; +\else + \node[sequence item,anchor=west] (x-\xi) at (x-\prevx.east) {\x}; +\fi + } + \end{tikzpicture} + }{}% end-sequence diagram }% end-no value 1 }% end-command \tikzset{ @@ -462,45 +639,68 @@ } \NewDocumentCommand{\smartdiagramanimated}{r[] m}{% + \StrCut{#1}{:}\diagramtype\option \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 + \IfStrEq{\diagramtype}{}{% + \PackageError{smartdiagram}{Type of the diagram not inserted. Please insert it} + {Example: \protect\smartdiagram[flow diagram]} + }{} + \IfStrEq{\diagramtype}{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} + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \pgfmathtruncatemacro{\angle}{180+360/\maxsmitem*\xi} + }{% false-clockwise-circular diagram + \pgfmathtruncatemacro{\angle}{360/\maxsmitem*\xi} + } \edef\col{\@nameuse{color@\xi}} - \node[module, + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \node[module, drop shadow={smvisible on=<\xi->}, - smvisible on=<\xi->] (module\xi) at (\angle:\circulardistance) {\smitem }; + smvisible on=<\xi->] (module\xi) + at (-\angle:\circulardistance) {\smitem}; + }{% false-clockwise-circular diagram + \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, + \IfStrEq{\option}{clockwise}{% true-clockwise-circular diagram + \draw[<-,diagram arrow type,shorten <=0.3cm,shorten >=0.3cm, + smvisible on=<\adv->] (module\xj) to[bend right] (module\xi); + }{% false-clockwise-circular diagram + \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 + \IfStrEq{\diagramtype}{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->}, + \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram + \path let \n1 = {int(0-\xi)}, \n2={0+\xi*\modulexsep} + in node[module,drop shadow={smvisible on=<\xi->}, + smvisible on=<\xi->] (module\xi) at +(\n2,0) {\smitem}; + }{% false-horizontal-flow diagram + \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}{% @@ -509,18 +709,35 @@ \ifnum\xi<\maxsmitem \begin{pgfonlayer}{smart diagram arrow back} \draw[<-,diagram arrow type,smvisible on=<\xi->] - (module\xj) -- (module\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); + % last arrow - not display it in background - check if disabled + \ifbackarrowdisabled + \relax + \else + \ifnum\xi=\maxsmitem + \IfStrEq{\option}{horizontal}{% true-horizontal-flow diagram + \tikzset{square arrow/.style={ + to path={-- ++(0,0.5) -| (\tikztotarget)} + } + } + \draw[<-,diagram arrow type, square arrow,smvisible on=<\xi->] + (module\xj.north) to (module\xi.north); + }{% false-horizontal-flow diagram + \tikzset{square arrow/.style={ + to path={-- ++(0.5,0) |- (\tikztotarget)} + } + } + \draw[<-,diagram arrow type,square arrow,smvisible on=<\xi->] + (module\xj.east) to (module\xi); + } + \fi \fi }% \end{tikzpicture} }{}% end-flow diagram - \ifstrequal{#1}{descriptive diagram}{% true-descriptive diagram + \IfStrEq{\diagramtype}{descriptive diagram}{% true-descriptive diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{% \edef\col{\@nameuse{color@\xi}} @@ -539,7 +756,7 @@ }% \end{tikzpicture} }{}% end-descriptive diagram - \ifstrequal{#1}{bubble diagram}{% true-bubble diagram + \IfStrEq{\diagramtype}{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} @@ -550,12 +767,13 @@ \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 }; + \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 + \IfStrEq{\diagramtype}{constellation diagram}{% true-const diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} @@ -574,7 +792,7 @@ }% \end{tikzpicture} }{}%end-constellation diagram - \ifstrequal{#1}{connected constellation diagram}{% true-connected constellation diagram + \IfStrEq{\diagramtype}{connected constellation diagram}{% true-conn const diagram \begin{tikzpicture}[every node/.style={align=center}] \foreach \smitem [count=\xi] in {#2}{\global\let\maxsmitem\xi} \pgfmathtruncatemacro\actualnumitem{\maxsmitem-1} @@ -601,7 +819,7 @@ }% \end{tikzpicture} }{}%end-connected constellation diagram - \ifstrequal{#1}{priority descriptive diagram}{% true-priority descriptive diagram + \IfStrEq{\diagramtype}{priority descriptive diagram}{% true-priority descriptive diagram \pgfmathparse{subtract(\priorityarrowwidth,\priorityarrowheadextend)} \pgfmathsetmacro\priorityticksize{\pgfmathresult/2} \pgfmathsetmacro\arrowtickxshift{(\priorityarrowwidth-\priorityticksize)/2} @@ -627,11 +845,24 @@ \end{pgfonlayer} \end{tikzpicture} }{}% end-priority descriptive diagram + \IfStrEq{\diagramtype}{sequence diagram}{% true-sequence diagram + \begin{tikzpicture}[every node/.style={align=center}] + \foreach \x[count=\xi, count=\prevx from 0] in {#2}{% + \edef\col{\@nameuse{color@\xi}} +\ifnum\xi=1 + \node[sequence item,smvisible on=<\xi->] (x-\xi) {\x}; +\else + \node[sequence item,anchor=west,smvisible on=<\xi->] + (x-\xi) at (x-\prevx.east) {\x}; +\fi + } + \end{tikzpicture} + }{}% end-sequence diagram }% end-no value 1 }% end-command %% -%% Copyright (C) 2012 by Claudio Fiandrino <claudio.fiandrino@gmail.com> +%% Copyright (C) 2012-2013 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 |