Skip to content

Commit

Permalink
start to create all design pattern by using this package
Browse files Browse the repository at this point in the history
git-svn-id: https://pgf-umlcd.googlecode.com/svn@4 5c4df12a-c94a-11de-8410-e5b1e99fc78e
  • Loading branch information
xuyuan.cn committed Jul 25, 2011
1 parent f59e211 commit 19ed6fd
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
93 changes: 93 additions & 0 deletions trunk/design_pattern.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.multipart,backgrounds,fit}
\usepackage{pgf-umlcd}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0pt}%

\begin{document}
\pagestyle{empty}
\enlargethispage{100cm}

\begin{figure}
\centering
\begin{tikzpicture}[show background grid]
\begin{interface}{AbstractFactory}{0,0}
\operation[0]{+ CreateProductA()}
\operation[0]{+ CreateProductB()}
\end{interface}

\begin{class}{ConcreteFactory2}{-3,-4}
\implement{AbstractFactory}
\operation{+ CreateProductA()}
\operation{+ CreateProductB()}
\end{class}

\begin{class}{ConcreteFactory1}{3,-4}
\implement{AbstractFactory}
\operation{+ CreateProductA()}
\operation{+ CreateProductB()}
\end{class}

\begin{interface}{AbstractProductA}{15,-2}
\end{interface}

\begin{class}{ProductA1}{12,-5}
\implement{AbstractProductA}
\end{class}

\begin{class}{ProductA2}{18,-5}
\implement{AbstractProductA}
\end{class}

\draw[umlcd style dashed line,->] (ConcreteFactory1) --node[above,
sloped, black]{$<<$instantiate$>>$} (ProductA1);

\draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++
(1,0) -- ++(0,-1) -- node[above, sloped,
black]{$<<$instantiate$>>$} ++(20,0) -| (ProductA2);

\begin{interface}{AbstractProductB}{15,-8}
\end{interface}

\begin{class}{ProductB1}{12,-11}
\implement{AbstractProductB}
\end{class}

\begin{class}{ProductB2}{18,-11}
\implement{AbstractProductB}
\end{class}

\draw[umlcd style dashed line,->] (ConcreteFactory1) |-node[above,
sloped, black]{$<<$instantiate$>>$} (ProductB1);

\draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++
(-1,0) -- ++(0,-7) -- node[above, sloped,
black]{$<<$instantiate$>>$} ++(20,0) -| (ProductB2);

\begin{class}{Client}{22,-0.5}
\end{class}

\draw[umlcd style dashed line,->] (Client) --node[above, sloped,
black]{$<<$import$>>$} (AbstractFactory);

\draw[umlcd style dashed line,->] (Client) |-node[above, sloped,
black]{$<<$import$>>$} (AbstractProductA);

\draw[umlcd style dashed line,->] (Client) |-node[above, sloped,
black]{$<<$import$>>$} (AbstractProductB);
\end{tikzpicture}
\caption{Abstract Factory}
\label{fig:abstract-factory}
\end{figure}


%
\end{document}
%%% Local Variables:
%%% mode: Tex-PDF
%%% TeX-master: t
%%% End:

2 changes: 2 additions & 0 deletions trunk/pgf-umlcd.sty
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ parts=3, draw, minimum height=2em, umlcolor, minimum width=2cm,
minimum height=1cm, node distance=2cm, every text node
part/.style={align=center}, text width=5cm]

\tikzstyle{umlcd style dashed line}=[color=\umldrawcolor, >=angle 90,dashed]

% declare layers
\pgfdeclarelayer{background}
\pgfdeclarelayer{connectionlayers}
Expand Down

0 comments on commit 19ed6fd

Please sign in to comment.