forked from xuyuan/pgf-umlcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start to create all design pattern by using this package
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
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters