diff options
Diffstat (limited to 'graphics/pgf/contrib/pgf-umlsd')
28 files changed, 1470 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/pgf-umlsd/README b/graphics/pgf/contrib/pgf-umlsd/README new file mode 100644 index 0000000000..c6735d5df4 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/README @@ -0,0 +1,3 @@ +Some LaTeX macros for UML Sequence Diagrams. +Home page of project: http://pgf-umlsd.googlecode.com/ +Please read pgf-umlsd-manual.pdf for more information. diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/block.tex b/graphics/pgf/contrib/pgf-umlsd/demo/block.tex new file mode 100644 index 0000000000..deec2c8fa7 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/block.tex @@ -0,0 +1,9 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + \newinst[1]{i}{:Instance} + + \begin{sdblock}{Block}{description} + \begin{call}{t}{function()}{i}{} + \end{call} + \end{sdblock} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/call.tex b/graphics/pgf/contrib/pgf-umlsd/demo/call.tex new file mode 100644 index 0000000000..b67d61e841 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/call.tex @@ -0,0 +1,7 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + \newinst[1]{i}{:Instance} + + \begin{call}{t}{function()}{i}{return value} + \end{call} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/callself.tex b/graphics/pgf/contrib/pgf-umlsd/demo/callself.tex new file mode 100644 index 0000000000..4729758237 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/callself.tex @@ -0,0 +1,6 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + + \begin{call}{t}{function()}{t}{return value} + \end{call} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/customize.log b/graphics/pgf/contrib/pgf-umlsd/demo/customize.log new file mode 100644 index 0000000000..978a646b07 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/customize.log @@ -0,0 +1,237 @@ +This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=latex 2011.5.2) 27 JUL 2011 02:55 +entering extended mode + %&-line parsing enabled. +**\input customize.tex +(./customize.tex + +! LaTeX Error: Environment sequencediagram undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.1 \begin{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +! Undefined control sequence. +l.2 \newthread + [red]{r}{:Red} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.2 \newthread[ + red]{r}{:Red} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no [ in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no R in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no d in font nullfont! +! Undefined control sequence. +l.3 \newthread + [green]{g}{:Green} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no [ in font nullfont! +Missing character: There is no g in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no g in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no G in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no n in font nullfont! +! Undefined control sequence. +l.4 \newthread + [blue]{b}{:Blue} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no [ in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no B in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no e in font nullfont! +! Undefined control sequence. +l.5 \tikzstyle + {inststyle}+=[bottom color=yellow] +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no i in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no y in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no + in font nullfont! +Missing character: There is no = in font nullfont! +Missing character: There is no [ in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no m in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no = in font nullfont! +Missing character: There is no y in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no w in font nullfont! +Missing character: There is no ] in font nullfont! +! Undefined control sequence. +l.6 \newinst + {y}{:Yellow} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no y in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no Y in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no w in font nullfont! +! Undefined control sequence. +l.7 \tikzstyle + {inststyle}+=[rounded corners=3mm] +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no i in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no y in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no + in font nullfont! +Missing character: There is no = in font nullfont! +Missing character: There is no [ in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no = in font nullfont! +Missing character: There is no 3 in font nullfont! +Missing character: There is no m in font nullfont! +Missing character: There is no m in font nullfont! +Missing character: There is no ] in font nullfont! +! Undefined control sequence. +l.8 \newinst + {o}{:Rounded} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no o in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no R in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no d in font nullfont! + +! LaTeX Error: \begin{document} ended by \end{sequencediagram}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.9 \end{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +) +! Emergency stop. +<*> \input customize.tex + +*** (job aborted, no legal \end found) + + +Here is how much of TeX's memory you used: + 7 strings out of 495062 + 174 string characters out of 1182645 + 45108 words of memory out of 3000000 + 3284 multiletter control sequences out of 15000+50000 + 3640 words of font info for 14 fonts, out of 3000000 for 9000 + 28 hyphenation exceptions out of 8191 + 6i,0n,6p,69b,19s stack positions out of 5000i,500n,10000p,200000b,50000s +No pages of output. diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/customize.tex b/graphics/pgf/contrib/pgf-umlsd/demo/customize.tex new file mode 100644 index 0000000000..db4cc01c19 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/customize.tex @@ -0,0 +1,9 @@ +\begin{sequencediagram} + \newthread[red]{r}{:Red} + \newthread[green]{g}{:Green} + \newthread[blue]{b}{:Blue} + \tikzstyle{inststyle}+=[top color=yellow, bottom color=gray] + \newinst{y}{:Yellow} + \tikzstyle{inststyle}+=[bottom color=white, top color=white, rounded corners=3mm] + \newinst{o}{:Rounded} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/distance.tex b/graphics/pgf/contrib/pgf-umlsd/demo/distance.tex new file mode 100644 index 0000000000..f8008770b7 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/distance.tex @@ -0,0 +1,6 @@ +\begin{sequencediagram} + \newthread{a}{:A} + \newinst{b}{:B} + \newinst[1]{c}{:C} + \newinst[2]{d}{:D} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/empty.tex b/graphics/pgf/contrib/pgf-umlsd/demo/empty.tex new file mode 100644 index 0000000000..2b610eade7 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/empty.tex @@ -0,0 +1,2 @@ +\begin{sequencediagram} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/instance.tex b/graphics/pgf/contrib/pgf-umlsd/demo/instance.tex new file mode 100644 index 0000000000..8c5b8339bb --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/instance.tex @@ -0,0 +1,3 @@ +\begin{sequencediagram} + \newinst{name}{:Instance} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/message.tex b/graphics/pgf/contrib/pgf-umlsd/demo/message.tex new file mode 100644 index 0000000000..d5db59320e --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/message.tex @@ -0,0 +1,6 @@ +\begin{sequencediagram} + \newthread{a}{:Thread A} + \newthread[gray]{b}{:Thread B} + + \mess{a}{message}{b} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/messcall.tex b/graphics/pgf/contrib/pgf-umlsd/demo/messcall.tex new file mode 100644 index 0000000000..5b73efa5a3 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/messcall.tex @@ -0,0 +1,7 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + \newinst[1]{i}{:Instance} + + \begin{messcall}{t}{function()}{i} + \end{messcall} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/multi-threads-example.tex b/graphics/pgf/contrib/pgf-umlsd/demo/multi-threads-example.tex new file mode 100644 index 0000000000..5493006112 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/multi-threads-example.tex @@ -0,0 +1,37 @@ +\begin{sequencediagram} + \tikzstyle{inststyle}+=[bottom color=yellow] % custom the style + \newthread[blue]{ss}{:SimulationServer} + \newinst{ps}{:PhysicsServer} + \newinst[2]{sense}{:SenseServer} + \newthread[red]{ctr}{:SimControlNode} + + \begin{sdblock}[green!20]{Run Loop}{The main loop} + \mess{ctr}{StartCycle}{ss} + \begin{call}{ss}{Update()}{ps}{} + \prelevel + \begin{call}{ctr}{SenseAgent()}{ctr}{} + \begin{call}[3]{ctr}{Read}{sense}{} + \end{call} + \end{call} + \prelevel\prelevel\prelevel\prelevel + \setthreadbias{west} + \begin{call}{ps}{PrePhysicsUpdate()}{sense}{} + \end{call} + \setthreadbias{center} + \begin{call}{ps}{Update()}{ps}{} + \begin{call}{ps}{\small CollisionDetection()}{ps}{} + \end{call} + \begin{call}{ps}{Dynamics()}{ps}{} + \end{call} + \end{call} + \begin{call}{ps}{PostPhysicsUpdate()}{sense}{} + \end{call} + \end{call} + \mess{ss}{EndCycle}{ctr} + \begin{call}{ctr}{ActAgent()}{ctr}{} + \begin{call}{ctr}{Write}{sense}{} + \end{call} + \end{call} + \end{sdblock} + +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/nested-call.tex b/graphics/pgf/contrib/pgf-umlsd/demo/nested-call.tex new file mode 100644 index 0000000000..4ca253ed33 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/nested-call.tex @@ -0,0 +1,10 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + \newinst{a}{:A} + \newinst{b}{:B} + + \begin{call}{t}{funcA()}{a}{return} + \begin{call}{a}{funcA()}{b}{return} + \end{call} + \end{call} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/no-thread-example.tex b/graphics/pgf/contrib/pgf-umlsd/demo/no-thread-example.tex new file mode 100644 index 0000000000..cd5bf02803 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/no-thread-example.tex @@ -0,0 +1,33 @@ +\begin{sequencediagram} + \tikzstyle{inststyle}+=[{font=\large}] + \def\unitfactor{.9} + + \newinst{instance 1} + {instance 1} + + \newinst{instance 2} + {instance 2} + + \newinst[4cm]{instance 3} + {instance 3} + + \tikzstyle{instcolordienst}=[fill=black!25] + \tikzstyle{instcolorbuerger}=[fill=black!25] + + \messcall{instance 3}{data 1}{instance 2} + + \begin{call} + {instance 3}{data 2} + {instance 2}{data 2*} + + \begin{callself} + {instance 2}{Nutzerinteraktion}{data 3, data 2} + \end{callself} + + \begin{call} + {instance 2}{data 4, data 2} + {instance 1}{} + \end{call} + \end{call} + +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/non-instantaneous-message.tex b/graphics/pgf/contrib/pgf-umlsd/demo/non-instantaneous-message.tex new file mode 100644 index 0000000000..1efcde133b --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/non-instantaneous-message.tex @@ -0,0 +1,7 @@ +\begin{sequencediagram} + \newthread{a}{:Thread A} + \newthread[gray]{b}{:Thread B} + + \mess[1]{a}{ping}{b} + \mess[1]{b}{pong}{a} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.log b/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.log new file mode 100644 index 0000000000..8fb6b0813d --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.log @@ -0,0 +1,216 @@ +This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=latex 2011.5.2) 15 SEP 2011 06:48 +entering extended mode + %&-line parsing enabled. +**\input postlevel.tex +(./postlevel.tex + +! LaTeX Error: Environment sequencediagram undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.1 \begin{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +! Undefined control sequence. +l.2 \newthread + {t}{:Thread} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.2 \newthread{t + }{:Thread} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no t in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no T in font nullfont! +Missing character: There is no h in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no d in font nullfont! +! Undefined control sequence. +l.3 \newinst + [1]{i}{:Instance} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no [ in font nullfont! +Missing character: There is no 1 in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no I in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no e in font nullfont! + +Overfull \hbox (20.0pt too wide) in paragraph at lines 2--4 +[] + [] + + +! LaTeX Error: Environment sdblock undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.5 \begin{sdblock} + {Block}{description} +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.5 \begin{sdblock}{B + lock}{description} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no B in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no k in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no p in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no n in font nullfont! + +! LaTeX Error: Environment call undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.6 \begin{call} + {t}{function()}{i}{I have a lot of\newline things to do} +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +Missing character: There is no t in font nullfont! +Missing character: There is no f in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no c in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no ( in font nullfont! +Missing character: There is no ) in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no I in font nullfont! +Missing character: There is no h in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no v in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no f in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no h in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no g in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no o in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no o in font nullfont! + +! LaTeX Error: \begin{document} ended by \end{call}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.7 \end{call} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +! LaTeX Error: \begin{document} ended by \end{sdblock}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.8 \end{sdblock} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +! LaTeX Error: \begin{document} ended by \end{sequencediagram}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.9 \end{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +) +! Emergency stop. +<*> \input postlevel.tex + +*** (job aborted, no legal \end found) + + +Here is how much of TeX's memory you used: + 11 strings out of 495062 + 202 string characters out of 1182645 + 45108 words of memory out of 3000000 + 3288 multiletter control sequences out of 15000+50000 + 3640 words of font info for 14 fonts, out of 3000000 for 9000 + 28 hyphenation exceptions out of 8191 + 6i,0n,6p,100b,32s stack positions out of 5000i,500n,10000p,200000b,50000s +No pages of output. diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.tex b/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.tex new file mode 100644 index 0000000000..184d927906 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/postlevel.tex @@ -0,0 +1,8 @@ +\begin{sequencediagram} + \newthread{t}{:Thread} + \newinst[1]{i}{:Instance} + \begin{call}{t}{function()}{i}{\shortstack{return A\\ return B\\ + return C}} + \postlevel + \end{call} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/prelevel.tex b/graphics/pgf/contrib/pgf-umlsd/demo/prelevel.tex new file mode 100644 index 0000000000..84448e47ca --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/prelevel.tex @@ -0,0 +1,12 @@ +\begin{sequencediagram} + \newthread{t1}{:Thread1} + \newthread[gray]{t2}{:Thread2} + + \begin{callself}{t1}{loop}{} + \end{callself} + + \prelevel\prelevel + + \begin{callself}{t2}{loop}{} + \end{callself} +\end{sequencediagram} diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/single-thread-example.tex b/graphics/pgf/contrib/pgf-umlsd/demo/single-thread-example.tex new file mode 100644 index 0000000000..5f3628e479 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/single-thread-example.tex @@ -0,0 +1,29 @@ +\begin{sequencediagram} + \newthread{ss}{:SimulationServer} + \newinst{ctr}{:SimControlNode} + \newinst{ps}{:PhysicsServer} + \newinst[1]{sense}{:SenseServer} + + \begin{call}{ss}{Initialize()}{sense}{} + \end{call} + \begin{sdblock}{Run Loop}{The main loop} + \begin{call}{ss}{StartCycle()}{ctr}{} + \begin{call}{ctr}{ActAgent()}{sense}{} + \end{call} + \end{call} + \begin{call}{ss}{Update()}{ps}{} + \begin{messcall}{ps}{PrePhysicsUpdate()}{sense}{state} + \end{messcall} + \begin{sdblock}{Physics Loop}{} + \begin{call}{ps}{PhysicsUpdate()}{ps}{} + \end{call} + \end{sdblock} + \begin{call}{ps}{PostPhysicsUpdate()}{sense}{} + \end{call} + \end{call} + \begin{call}{ss}{EndCycle()}{ctr}{} + \begin{call}{ctr}{SenseAgent()}{sense}{} + \end{call} + \end{call} + \end{sdblock} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/sync-clock.tex b/graphics/pgf/contrib/pgf-umlsd/demo/sync-clock.tex new file mode 100644 index 0000000000..9c4a70f28c --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/sync-clock.tex @@ -0,0 +1,16 @@ +\begin{sequencediagram} + \newthread{a}{:Machine A} + \newthread[gray]{b}{:Machine B} + + \mess[1]{a}{}{b} + \node[anchor=east] (t0) at (mess from) {$t_0$}; + \node[anchor=west] (t1) at (mess to) {$t_1$}; + \prelevel + \mess[1]{b}{}{a} + \node[anchor=east] (t2) at (mess to) {$t_2$}; + + \path (t0.east) |- coordinate(t12) (t1); + \draw[dashed] (t1) -- (t12); + \node[anchor=south west] at (t12) {$\Delta{}t_1$}; + \node[anchor=north west] at (t12) {$\Delta{}t_2$}; +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/thread.tex b/graphics/pgf/contrib/pgf-umlsd/demo/thread.tex new file mode 100644 index 0000000000..9f1007a948 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/thread.tex @@ -0,0 +1,3 @@ +\begin{sequencediagram} + \newthread{name}{:Thread} +\end{sequencediagram}
\ No newline at end of file diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.log b/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.log new file mode 100644 index 0000000000..1532fefa60 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.log @@ -0,0 +1,266 @@ +This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=latex 2011.5.2) 15 SEP 2011 07:22 +entering extended mode + %&-line parsing enabled. +**\input threadbias.tex +(./threadbias.tex + +! LaTeX Error: Environment sequencediagram undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.1 \begin{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +! Undefined control sequence. +l.2 \newthread + [blue]{s1}{:Server1} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.2 \newthread[ + blue]{s1}{:Server1} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no [ in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no l in font nullfont! +Missing character: There is no u in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no 1 in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no S in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no v in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no 1 in font nullfont! +! Undefined control sequence. +l.3 \newinst + {db}{:Database} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no d in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no D in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no e in font nullfont! +! Undefined control sequence. +l.4 \newthread + [red]{s2}{:Server2} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + +Missing character: There is no [ in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no ] in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no 2 in font nullfont! +Missing character: There is no : in font nullfont! +Missing character: There is no S in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no v in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no 2 in font nullfont! + +Overfull \hbox (20.0pt too wide) in paragraph at lines 2--5 +[] + [] + +! Undefined control sequence. +l.6 \setthreadbias + {west} +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.6 \setthreadbias{w + est} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no w in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no s in font nullfont! +Missing character: There is no t in font nullfont! + +! LaTeX Error: Environment call undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.7 \begin{call} + {s1}{reading}{db}{data} +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +Missing character: There is no s in font nullfont! +Missing character: There is no 1 in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no g in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no a in font nullfont! + +! LaTeX Error: \begin{document} ended by \end{call}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.8 \end{call} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +Overfull \hbox (20.0pt too wide) in paragraph at lines 6--9 +[] + [] + +! Undefined control sequence. +l.10 \prelevel + +The control sequence at the end of the top line +of your error message was never \def'ed. If you have +misspelled it (e.g., `\hobx'), type `I' and the correct +spelling (e.g., `I\hbox'). Otherwise just continue, +and I'll forget about whatever was undefined. + + +! LaTeX Error: Environment call undefined. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.12 \begin{call} + {s2}{reading}{db}{data} +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +! LaTeX Error: Missing \begin{document}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.12 \begin{call}{s + 2}{reading}{db}{data} +You're in trouble here. Try typing <return> to proceed. +If that doesn't work, type X <return> to quit. + +Missing character: There is no s in font nullfont! +Missing character: There is no 2 in font nullfont! +Missing character: There is no r in font nullfont! +Missing character: There is no e in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no i in font nullfont! +Missing character: There is no n in font nullfont! +Missing character: There is no g in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no b in font nullfont! +Missing character: There is no d in font nullfont! +Missing character: There is no a in font nullfont! +Missing character: There is no t in font nullfont! +Missing character: There is no a in font nullfont! + +! LaTeX Error: \begin{document} ended by \end{call}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.13 \end{call} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + + +! LaTeX Error: \begin{document} ended by \end{sequencediagram}. + +See the LaTeX manual or LaTeX Companion for explanation. +Type H <return> for immediate help. + ... + +l.14 \end{sequencediagram} + +Your command was ignored. +Type I <command> <return> to replace it with another command, +or <return> to continue without it. + +) +! Emergency stop. +<*> \input threadbias.tex + +*** (job aborted, no legal \end found) + + +Here is how much of TeX's memory you used: + 9 strings out of 495062 + 189 string characters out of 1182645 + 45108 words of memory out of 3000000 + 3286 multiletter control sequences out of 15000+50000 + 3640 words of font info for 14 fonts, out of 3000000 for 9000 + 28 hyphenation exceptions out of 8191 + 6i,0n,6p,66b,24s stack positions out of 5000i,500n,10000p,200000b,50000s +No pages of output. diff --git a/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.tex b/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.tex new file mode 100644 index 0000000000..f4f8ac7f7f --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/demo/threadbias.tex @@ -0,0 +1,17 @@ +\begin{sequencediagram} + \newthread[blue]{s1}{:Server1} + \newinst{db}{:Database} + \newthread[red]{s2}{:Server2} + + \begin{call}{s1}{reading}{db}{data} + \postlevel + \end{call} + + \prelevel\prelevel + + \setthreadbias{east} + + \begin{call}{s2}{reading}{db}{data} + \postlevel + \end{call} +\end{sequencediagram} diff --git a/graphics/pgf/contrib/pgf-umlsd/diagrams.pdf b/graphics/pgf/contrib/pgf-umlsd/diagrams.pdf Binary files differnew file mode 100644 index 0000000000..5e5269184d --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/diagrams.pdf diff --git a/graphics/pgf/contrib/pgf-umlsd/logo.png b/graphics/pgf/contrib/pgf-umlsd/logo.png Binary files differnew file mode 100644 index 0000000000..6f77296cd2 --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/logo.png diff --git a/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.pdf b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.pdf Binary files differnew file mode 100644 index 0000000000..002c7d4eab --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.pdf diff --git a/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.tex b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.tex new file mode 100644 index 0000000000..8d3bcf39cb --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd-manual.tex @@ -0,0 +1,192 @@ +% Manual of pgf-umlsd.sty, a convenient set of macros for drawing UML +% sequence diagrams. +% Written by Xu Yuan <xuyuan.cn@gmail.com> from +% Southeast University, China. +% This file is part of pgf-umlsd +% you may get it at http://code.google.com/p/pgf-umlsd/ + +\documentclass{article} +\usepackage[margin=12mm]{geometry} +\usepackage{hyperref} + +\usepackage[underline=true,rounded corners=false]{pgf-umlsd} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{listings} +\usepackage{color} +\definecolor{listinggray}{gray}{0.92} +\lstset{ % +language=[LaTeX]TeX, +breaklines=true, +frame=single, +% frameround=tttt, +basicstyle=\footnotesize\ttfamily, +backgroundcolor=\color{listinggray}, +keywordstyle=\color{blue} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\hypersetup{ + colorlinks=true, + linkcolor=blue, + anchorcolor=black, + citecolor=olive, + filecolor=magenta, + menucolor=red, + urlcolor=blue +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\demo}[2][1]{ + \begin{center} + \begin{tabular}{cc} + \begin{minipage}{.49\linewidth} + \centering + \resizebox{#1\linewidth}{!}{ + \input{demo/#2} + } + \end{minipage} + & + \begin{minipage}{.45\linewidth} + \lstinputlisting{demo/#2} + \end{minipage} + \end{tabular} + \end{center} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\example}[2][1]{ + \begin{center} + \resizebox{#1\linewidth}{!}{ + \input{demo/#2} + } + \end{center} + \lstinputlisting{demo/#2} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{document} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\title{Drawing UML Sequence Diagram by using \texttt{pgf-umlsd}} +\author{\href{mailto:xuyuan.cn@gmail.com}{Yuan Xu}} +\date{\today{}~(v0.7)} +\maketitle +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{abstract} + \texttt{pgf-umlsd} is a LaTeX package for drawing UML Sequence + Diagrams. As stated by its name, it is based on a very popular + graphic package \texttt{PGF/TikZ}. This document presents the usage + of \texttt{pgf-umlsd} and collects some UML sequence diagrams as + examples. \texttt{pgf-umlsd} can be downloaded from + \href{http://code.google.com/p/pgf-umlsd/}{http://code.google.com/p/pgf-umlsd/}. +\end{abstract} + +\tableofcontents + +\section{The Essentials} +\subsection{Basic graphics objects} +\subsubsection{empty diagram} +\demo{empty} + +\subsubsection{thread} +\demo[0.3]{thread} + +\subsubsection{instance} +\demo[0.3]{instance} + +\subsubsection{distance between threads and instances} +\demo{distance} + +\subsubsection{customization} +The package has two options for customization: \texttt{underline} and +\texttt{rounded corners}, further customization see the example below: + +\demo{customize} + + +\subsection{Call} +\subsubsection{call} +\demo[0.6]{call} + +\subsubsection{call self} +\demo[0.6]{callself} + +\subsubsection{message call} +\demo[0.6]{messcall} + +\subsubsection{nested call} +\demo[0.6]{nested-call} + +\subsection{Message} +\demo[0.6]{message} + +Sometimes however, it takes a considerable amount of time to reach the +receiver (relatively speaking of course) . For example, a message +across a network. Such a non-instantaneous message is drawn as a +slanted arrow. + +\demo[0.6]{non-instantaneous-message} + +\subsection{Block} +\demo[0.6]{block} + +\section{Manually adjustment} +The idea of \texttt{pgf-umlsd} is users only have to write the logic +of diagram, the program generates figure automatically. However, the +package can not handle all the use case, it still needs to be adjusted +manually. + +\subsection{Level} +If the text on the arrows is more than one line (large function name +for example) it will overlap other things. \texttt{postlevel} can be +used to make the time (level) later. + +\demo[0.6]{postlevel} + +In the situation of multi-threads, some events happen at the same +time. \texttt{prelevel} can make the call earlier. + +\demo[0.6]{prelevel} + +\subsection{Bias of thread line} +In the situation of multi-threads, the instance cen be accessed at the +same time (e.g. two threads reading data at the same time). Currently, +we have to adjust the bias of thread line manually for this. Possible +parameters for \texttt{setthreadbias} are: \texttt{center}, +\texttt{west} and \texttt{east}. + +\demo[0.8]{threadbias} + +\section{Examples} +\subsection{Single thread} +\example[0.8]{single-thread-example} + +\subsection{Multi-threads} +\example[0.8]{multi-threads-example} + +\subsection{Annotation} +\example[0.5]{sync-clock} + +\subsection{Known Issue} +\texttt{pgf-umlsd} confilts with tikz \texttt{backgrounds} library. + +\section{Acknowledgements} +Many people contributed to \texttt{pgf-umlsd} by reporting problems, +suggesting various improvements or submitting code. Here is a list of +these people: +\href{mailto:nobel1984@gmail.com}{Nobel Huang}, +\href{mailto:humbert@uni-wuppertal.de}{Dr. Ludger Humbert}, +\href{mailto:MathStuf@gmail.com}{MathStuf}, +\href{mailto:vlado.handziski@gmail.com}{Vlado Handziski}, +\href{mailto:frankmorgner@gmail.com}{Frank Morgner}, +and \href{mailto:petrautzki@hs-coburg.de}{Dirk Petrautzki}. + +\end{document} +%%% Local Variables: +%%% mode: Tex-PDF +%%% TeX-master: t +%%% End: diff --git a/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd.sty b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd.sty new file mode 100644 index 0000000000..99847db73b --- /dev/null +++ b/graphics/pgf/contrib/pgf-umlsd/pgf-umlsd.sty @@ -0,0 +1,329 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Start of pgf-umlsd.sty +% +% Some macros for UML Sequence Diagrams. +% Home page of project: http://pgf-umlsd.googlecode.com/ +% Author: Xu Yuan <xuyuan.cn@gmail.com>, Southeast University, China +% Contributor: Nobel Huang <nobel1984@gmail.com>, Southeast University, China +% +% History: +% v0.7 2012/03/05 +% - unify interface of call and callself +% - non-instantaneous message +% - bugfix: conflits with tikz library backgrounds +% v0.6 2011/07/27 +% - Fix Issue 6 reported by frankmorgner@gmail.com +% - diagram without a thread +% - allows empty diagram +% - New manual +% v0.5 2009/09/30 Fix Issue 2 reported by vlado.handziski +% - Nested callself is supported +% - Rename sdloop and sdframe to sdblock +% v0.4 2008/12/08 Fix Issue 1 reported by MathStuf: +% Nested sdloop environment hides outer loop +% v0.3 2008/11/10 in Berlin, fix for the PGF cvs version: +% - the list items in \foreach are not evaluated by default now, +% the `evaluate' opinion should be used +% v0.2 2008/03/20 create project at http://pgf-umlsd.googlecode.com/ +% - use `shadows' library +% Thanks for Dr. Ludger Humbert's <humbert@uni-wuppertal.de> feedback! +% - reduce the parameter numbers, the user can write the content +% of instance (such as no colon) +% - the user can redefine the `inststyle' +% - new option: switch underlining of the instance text +% - new option: switch rounded corners +% v0.1 2008/01/25 first release at http://www.fauskes.net/pgftikzexamples/ +% + +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{pgf-umlsd}[2011/07/27 v0.6 Some LaTeX macros for UML +Sequence Diagrams.] + +\RequirePackage{tikz} +\usetikzlibrary{arrows,shadows} + +\RequirePackage{ifthen} + +% Options +% ? the instance name under line ? +\newif\ifpgfumlsdunderline\pgfumlsdunderlinetrue +\DeclareOption{underline}{\pgfumlsdunderlinetrue} +\DeclareOption{underline=true}{\pgfumlsdunderlinetrue} +\DeclareOption{underline=false}{\pgfumlsdunderlinefalse} +% ? the instance box with rounded corners ? +\newif\ifpgfumlsdroundedcorners\pgfumlsdroundedcornersfalse +\DeclareOption{roundedcorners}{\pgfumlsdroundedcornerstrue} +\DeclareOption{roundedcorners=true}{\pgfumlsdroundedcornerstrue} +\DeclareOption{roundedcorners=false}{\pgfumlsdroundedcornersfalse} +\ProcessOptions + +% new counters +\newcounter{preinst} +\newcounter{instnum} +\newcounter{threadnum} +\newcounter{seqlevel} % level +\newcounter{callevel} +\newcounter{callselflevel} +\newcounter{blocklevel} + +% new an instance +% Example: +% \newinst[edge distance]{var}{name:class} +\newcommand{\newinst}[3][0.2]{ + \stepcounter{instnum} + \path (inst\thepreinst.east)+(#1,0) node[inststyle] (inst\theinstnum) + {\ifpgfumlsdunderline + \underline{#3} + \else + #3 + \fi}; + \path (inst\theinstnum)+(0,-0.5*\unitfactor) node (#2) {}; + \tikzstyle{instcolor#2}=[] + \stepcounter{preinst} +} + +% new an instance thread +% Example: +% \newinst[color]{var}{name}{class} +\newcommand{\newthread}[3][gray!30]{ + \newinst{#2}{#3} + \stepcounter{threadnum} + \node[below of=inst\theinstnum,node distance=0.8cm] (thread\thethreadnum) {}; + \tikzstyle{threadcolor\thethreadnum}=[fill=#1] + \tikzstyle{instcolor#2}=[fill=#1] +} + +% draw running (thick) line, should not call directly +\newcommand*{\drawthread}[2]{ + \begin{pgfonlayer}{umlsd@threadlayer} + \draw[threadstyle] (#1.west) -- (#1.east) -- (#2.east) -- (#2.west) -- cycle; + \end{pgfonlayer} +} + +% a function call +% Example: +% \begin{call}[height]{caller}{function}{callee}{return} +% \end{call} +\newenvironment{call}[5][1]{ +\ifthenelse{\equal{#2}{#4}} +{ + \begin{callself}[#1]{#2}{#3}{#5} +} +{ + \begin{callanother}[#1]{#2}{#3}{#4}{#5} +} +} +{ +\ifthenelse{\equal{\f\thecallevel}{\t\thecallevel}} +{ + \end{callself} +} +{ + \end{callanother} +} +} + +% function call to another instance +% interal use only +\newenvironment*{callanother}[5][1]{ + \stepcounter{seqlevel} + \stepcounter{callevel} % push + \path + (#2)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (cf\thecallevel) {} + (#4.\threadbias)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (ct\thecallevel) {}; + + \draw[->,>=triangle 60] ({cf\thecallevel}) -- (ct\thecallevel) + node[midway, above] {#3}; + \def\l\thecallevel{#1} + \def\f\thecallevel{#2} + \def\t\thecallevel{#4} + \def\returnvalue{#5} + \tikzstyle{threadstyle}+=[instcolor#2] +} +{ + \addtocounter{seqlevel}{\l\thecallevel} + \path + (\f\thecallevel)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (rf\thecallevel) {} + (\t\thecallevel.\threadbias)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (rt\thecallevel) {}; + \draw[dashed,->,>=angle 60] ({rt\thecallevel}) -- (rf\thecallevel) + node[midway, above]{\returnvalue}; + \drawthread{ct\thecallevel}{rt\thecallevel} + \addtocounter{callevel}{-1} % pop +} + +% a function do not need call others +% interal use only +% Example: +% \begin{callself}[height]{caller}{function}{return} +% \end{callself} +\newenvironment*{callself}[4][1]{ + \stepcounter{seqlevel} + \stepcounter{callevel} % push + \stepcounter{callselflevel} + + \path + (#2)+(\thecallselflevel*0.1-0.1,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (sc\thecallevel) {} + ({sc\thecallevel}.east)+(0,-0.33*\unitfactor) node (scb\thecallevel) {}; + + \draw[->,>=triangle 60] ({sc\thecallevel}.east) -- ++(0.8,0) + node[near start, above right] {#3} -- ++(0,-0.33*\unitfactor) + -- (scb\thecallevel); + \def\l\thecallevel{#1} + \def\f\thecallevel{#2} + \def\t\thecallevel{#2} + \def\returnvalue{#4} + \tikzstyle{threadstyle}+=[instcolor#2] +}{ + \addtocounter{seqlevel}{\l\thecallevel} + \path (\f\thecallevel)+(\thecallselflevel*0.1-0.1,-\theseqlevel*\unitfactor-0.33*\unitfactor) node + (sct\thecallevel) {}; + + \draw[dashed,->,>=angle 60] ({sct\thecallevel}.east) node + (sce\thecallevel) {} -- ++(0.8,0) -- node[midway, right]{\returnvalue} ++(0,-0.33*\unitfactor) -- ++(-0.8,0); + \drawthread{scb\thecallevel}{sce\thecallevel} + \addtocounter{callevel}{-1} % pop + \addtocounter{callselflevel}{-1} +} + +% message between threads +% Example: +% \mess[delay]{sender}{message content}{receiver} +\newcommand{\mess}[4][0]{ + \stepcounter{seqlevel} + \path + (#2)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (mess from) {}; + \addtocounter{seqlevel}{#1} + \path + (#4)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (mess to) {}; + \draw[->,>=angle 60] (mess from) -- (mess to) node[midway, above] + {#3}; + + \node (#3 from) at (mess from) {}; + \node (#3 to) at (mess to) {}; +} + +\newenvironment{messcall}[4][1]{ + \stepcounter{seqlevel} + \stepcounter{callevel} % push + \path + (#2)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (cf\thecallevel) {} + (#4.\threadbias)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (ct\thecallevel) {}; + + \draw[->,>=angle 60] ({cf\thecallevel}) -- (ct\thecallevel) + node[midway, above] {#3}; + \def\l\thecallevel{#1} + \def\f\thecallevel{#2} + \def\t\thecallevel{#4} + \tikzstyle{threadstyle}+=[instcolor#2] +} +{ + \addtocounter{seqlevel}{\l\thecallevel} + \path + (\f\thecallevel)+(0,-\theseqlevel*\unitfactor-0.7*\unitfactor) node (rf\thecallevel) {} + (\t\thecallevel.\threadbias)+(0,-\theseqlevel*\unitfactor-0.3*\unitfactor) node (rt\thecallevel) {}; + \drawthread{ct\thecallevel}{rt\thecallevel} + \addtocounter{callevel}{-1} % pop +} + +% In the situation of multi-threads, some objects are called at the +% same time. Currently, we have to adjust the bias of thread line +% manually. Possible parameters are: center, west, east +\newcommand{\setthreadbias}[1]{\global\def\threadbias{#1}} + +% This function makes the call earlier. +\newcommand{\prelevel}{\addtocounter{seqlevel}{-1}} + +% This function makes the call later. +\newcommand{\postlevel}{\addtocounter{seqlevel}{+1}} + +% a block box with caption +% \begin{sdblock}[caption background color]{caption}{comments} +% \end{sdblock} +\newenvironment{sdblock}[3][white]{ + \stepcounter{seqlevel} + \stepcounter{blocklevel} % push + \coordinate (blockbeg\theblocklevel) at (0,-\theseqlevel*\unitfactor-\unitfactor); + \stepcounter{seqlevel} + \def\blockcolor\theblocklevel{#1} + \def\blockname\theblocklevel{#2} + \def\blockcomm\theblocklevel{#3} + \begin{pgfinterruptboundingbox} +}{ + \coordinate (blockend) at (0,-\theseqlevel*\unitfactor-2*\unitfactor); + \path (current bounding box.east)+(0.2,0) node (boxeast) {} + (current bounding box.west |- {blockbeg\theblocklevel}) + (-0.2,0) + node (nw) {}; + \path (boxeast |- blockend) node (se) {}; + + % % title + \node[blockstyle] (blocktitle) at (nw) {\blockname\theblocklevel}; + \path (blocktitle.south east) + (0,0.2) node (set) {} + (blocktitle.south east) + (-0.2,0) node (seb) {} + (blocktitle.north east) + (0.2,0) node (comm) {}; + \draw[fill=\blockcolor\theblocklevel] (blocktitle.north west) -- (blocktitle.north east) -- + (set.center) -- (seb.center) -- (blocktitle.south west) -- cycle; + \node[blockstyle] (blocktitle) at (nw) {\blockname\theblocklevel}; + \node[blockcommentstyle] (blockcomment) at (comm) {\blockcomm\theblocklevel}; + + \coordinate (se) at (current bounding box.south east); + \end{pgfinterruptboundingbox} + + \draw (se) rectangle (nw); + + \addtocounter{blocklevel}{-1} % pop + \stepcounter{seqlevel} +} + +% the environment of sequence diagram +\newenvironment{sequencediagram}{ + % declare layers + \pgfdeclarelayer{umlsd@background} + \pgfdeclarelayer{umlsd@threadlayer} + \pgfsetlayers{umlsd@background,umlsd@threadlayer,main} + + \begin{tikzpicture} + \setlength{\unitlength}{1cm} + \tikzstyle{sequence}=[coordinate] + \tikzstyle{inststyle}=[rectangle, draw, anchor=west, minimum + height=0.8cm, minimum width=1.6cm, fill=white, + drop shadow={opacity=1,fill=black}] + \ifpgfumlsdroundedcorners + \tikzstyle{inststyle}+=[rounded corners=3mm] + \fi + \tikzstyle{blockstyle}=[anchor=north west] + \tikzstyle{blockcommentstyle}=[anchor=north west, font=\small] + \tikzstyle{dot}=[inner sep=0pt,fill=black,circle,minimum size=0.2pt] + \global\def\unitfactor{0.6} + \global\def\threadbias{center} + % reset counters + \setcounter{preinst}{0} + \setcounter{instnum}{0} + \setcounter{threadnum}{0} + \setcounter{seqlevel}{0} + \setcounter{callevel}{0} + \setcounter{callselflevel}{0} + \setcounter{blocklevel}{0} + + % origin + \node[coordinate] (inst0) {}; +} +{ + \begin{pgfonlayer}{umlsd@background} + \ifnum\c@instnum > 0 + \foreach \t [evaluate=\t] in {1,...,\theinstnum}{ + \draw[dotted] (inst\t) -- ++(0,-\theseqlevel*\unitfactor-2.2*\unitfactor); + } + \fi + \ifnum\c@threadnum > 0 + \foreach \t [evaluate=\t] in {1,...,\thethreadnum}{ + \path (thread\t)+(0,-\theseqlevel*\unitfactor-0.1*\unitfactor) node (threadend) {}; + \tikzstyle{threadstyle}+=[threadcolor\t] + \drawthread{thread\t}{threadend} + } + \fi + \end{pgfonlayer} +\end{tikzpicture}} + + +%%% End of pgf-umlsd.sty +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ No newline at end of file |