Disclaimer
Just after writing this whole answer, I read Alain Matthes' one and realized that the question was about tikz 2.0. I overlooked this requirement so my answer is probably not useful for the OP. But I decided to leave here anyway because it illustrates some techniques which can be useful to other readers.
Original answer
You should use positioning
library in order to get rid of absolute coordinates, and fit
library to draw nodes around other nodes. Let's build your example step by step:
First, nodes a, b, c, and d can be positioned relatively each other the following way:
\documentclass{standalone}
\usetikzlibrary{positioning,fit,shapes.geometric,calc}
\usepackage{tikz}
\begin{document}
\tikzset{
my box/.style = {draw, minimum width = 3em, minimum height=1.5em},
}
\begin{tikzpicture}[node distance=5mm]
\node[my box] (a) {a};
\node[my box, below=of a] (b) {b};
\draw[->] (a) -- (b);
\node[my box, right=1cm of a] (c) {c};
\node[my box, below=of c] (d) {d};
\draw[->] (c) -- (d);
\end{tikzpicture}
\end{document}
Then you can use fit
to draw the rectangles around these:
\node[draw, fit=(a) (b)] (ab) {};
\node[draw, fit=(c) (d)] (cd) {};
Now, you can add the diamond and connections to (ab)
and (cd)
. To position the diamond properly centered, I use an auxiliar coordinate (aux)
interpolated between (ab)
and (cd)
:
\coordinate (aux) at ($(ab.north)!.5!(cd.north)$);
\node[draw, diamond, above=of aux] (diamond) {};
\draw[->] (diamond) -| (ab);
\draw[->] (diamond) -| (cd);
Now, using fit
again, we draw the box around all of this. But there is a problem, since I presume you want that box of the same size than the one which contains e
and f
(to be drawn later). A workaround can be to give it a minimum height
, and use the same amount for both boxes. This minimum height is found by trial and error, and this is why I don't like very much this part...
\node[draw, fit=(diamond) (ab) (cd), minimum height=3.5cm] (left part) {};
Finally, using the same techniques again, you can position nodes e
and f
relative to c
, and fit
a box of a minimum height around them. In order to get a proper alignment of the right box with the left one, I had to insert a "invisible" diamond on top of e
:
\node[my box, right=2cm of c, label=90:hl] (e) {e};
\node[my box, below=of e] (f) {f};
\node[diamond, above=of e] (diamond aux) {};
\node[draw, fit=(diamond aux) (f), minimum height=3.5cm] (right part) {};
Finally, the last diamond is added using the same technique than for the first one:
\coordinate (aux) at ($(left part.south)!.5!(right part.south)$);
\node[draw, diamond, below=of aux] (cross diamond) {};
\draw (cross diamond.north) -- (cross diamond.south)
(cross diamond.west) -- (cross diamond.east);
\draw[->, shorten >=1pt] (left part) |- (cross diamond);
\draw[->, shorten >=1pt] (right part) |- (cross diamond);
This completes the figure (and after it, the complete code):
The code
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,shapes.geometric,calc}
\begin{document}
\tikzset{
my box/.style = {draw, minimum width = 3em, minimum height=1.5em},
}
\begin{tikzpicture}[node distance=5mm]
\node[my box] (a) {a};
\node[my box, below=of a] (b) {b};
\draw[->] (a) -- (b);
\node[my box, right=1cm of a] (c) {c};
\node[my box, below=of c] (d) {d};
\draw[->] (c) -- (d);
\node[draw, fit=(a) (b)] (ab) {};
\node[draw, fit=(c) (d)] (cd) {};
\coordinate (aux) at ($(ab.north)!.5!(cd.north)$);
\node[draw, diamond, above=of aux] (diamond) {};
\draw[->] (diamond) -| (ab);
\draw[->] (diamond) -| (cd);
\node[draw, fit=(diamond) (ab) (cd), minimum height=3.5cm] (left part) {};
\node[my box, right=2cm of c, label=90:hl] (e) {e};
\node[my box, below=of e] (f) {f};
\node[diamond, above=of e] (diamond aux) {};
\node[draw, fit=(diamond aux) (f), minimum height=3.5cm] (right part) {};
\coordinate (aux) at ($(left part.south)!.5!(right part.south)$);
\node[draw, diamond, below=of aux] (cross diamond) {};
\draw (cross diamond.north) -- (cross diamond.south)
(cross diamond.west) -- (cross diamond.east);
\draw[->, shorten >=1pt] (left part) |- (cross diamond);
\draw[->, shorten >=1pt] (right part) |- (cross diamond);
\end{tikzpicture}
\end{document}