Skip to content

Instantly share code, notes, and snippets.

@NIA
Last active October 20, 2021 09:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NIA/99cdca614cb8546d737b to your computer and use it in GitHub Desktop.
Save NIA/99cdca614cb8546d737b to your computer and use it in GitHub Desktop.
A simple class diagram using LaTeX+TikZ+tikz-uml.sty
% tikz-uml.sty is from http://perso.ensta-paristech.fr/~kielbasi/tikzuml
\begin{myfigure}{Диаграмма классов основной программы}{fig:main-classes}
\begin{tikzpicture}[scale=0.8, transform shape]
\begin{umlpackage}[fill=color1bg]{Model}
\umlemptyclass[type=interface]{Protocol}
\umlemptyclass[left=5mm of Protocol.north west, anchor=north east]{FileWriter}
\umlemptyclass[below=1.5cm of FileWriter.south west, anchor=north west]{Settings}
\end{umlpackage}
\begin{umlpackage}[fill=color3bg]{Controller}
\umlemptyclass[right=1cm of Protocol.north east, anchor=north west]{Worker}
\end{umlpackage}
\begin{umlpackage}[fill=color0bg]{Util}
\umlemptyclass[below=1.5cm of Worker]{Logger}
\end{umlpackage}
\begin{umlpackage}[fill=color2bg]{View}
\umlemptyclass[right=1cm of Worker]{MainWindow}
\umlemptyclass[below=1.5cm of MainWindow.south west, anchor=north west]{LogWindow}
\umlemptyclass[right=5mm of MainWindow]{TimePlot}
\umlemptyclass[below=1.5cm of TimePlot.south east, anchor=north east]{StatsBox}
\end{umlpackage}
% связи:
\umldep[geometry=|-]{FileWriter}{Protocol}
\umluniassoc[geometry=|-]{Worker}{Protocol}
\umluniassoc{MainWindow}{Worker}
\umlunicompo{MainWindow}{TimePlot}
\umlunicompo[geometry=|-|]{MainWindow}{LogWindow}
\umlunicompo[geometry=|-|]{MainWindow}{StatsBox}
\umldep{LogWindow}{Logger}
\umldep[geometry=-|-, arm1=-7mm, anchor1=200]{Worker}{Settings}
\end{tikzpicture}
\end{myfigure}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment