答案1
我不知道最好的方法是什么positioning
,但通过fit
和一些样式定义,可以直接获得类似的图形。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}[tbox/.style={rectangle,draw,thick,node contents={}},
box/.style args={#1 x #2}{tbox,minimum width=#1,minimum height=#2},
node distance=0.2em,>=stealth]
\begin{scope}[thick,local bounding box=solid]
\path node (A1) [box=1.8cm x 1.2cm]
node (A2) [box=3cm x 2cm,right=of A1]
node (A3) [box=1.4cm x 1.4cm,right=of A2]
node (A4) [box=1.8cm x 2cm,right=1em of A3]
node (A5) [box=2.8cm x 0.4cm,below left=1em and 0pt of A2.south east]
node (A6) [box=2.8cm x 0.4cm,above left=1em and 0pt of A2.north east,draw=none];
\node (F) [fit=(A1) (A4) (A5) (A6),tbox] ;
\path node (A7) [box=5cm x 0.8cm,below=1em of F]
node (A8) [box=5cm x 0.8cm,above=2em of F]
node (A9) [box=2cm x 4cm,left=1em of F,yshift=-1em];
\draw[->] (A9.100) -- ++ (0,1.5em) -| (A1);
\draw[->] (A5) -| (A1.-80);
\draw[->] (A5) -| (A3);
\draw[->] ([xshift=-5em,yshift=-0.5em]A8.south west) -- ([xshift=5em,yshift=-0.5em]A8.south east);
\draw[<-] ([xshift=-5em,yshift=-0.5em]A7.south west) -- ([xshift=5em,yshift=-0.5em]A7.south east);
\end{scope}
\begin{scope}[dashed,local bounding box=dashed]
\path ([yshift=-4em]solid.south) coordinate (aux)
node (B1) [box=3.5cm x 0.8cm,left=2em of aux]
node (B2) [box=3.5cm x 0.8cm,right=2em of aux];
\draw[->] (B1) -| (A9.-100);
\draw[->] (B1.north-|A1.-100) -- (A1.-100);
\draw[->] (A4) |- (B2);
\draw (B1) -- (B2);
\end{scope}
\end{tikzpicture}
\end{document}
如果你能够提出一个更抽象的问题,那么可能会有更有效的方法。