summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/smartdiagram/smartdiagram.sty
blob: 0efd91a95d9e2c3603620e8c5e14aaf79e07c08b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
%%
%% 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'.