Tikz 嵌套框图,其中方框文本位于其他块内

Tikz 嵌套框图,其中方框文本位于其他块内

我想创建一个包含一系列嵌套块并包含文本的图形。

我想要 4 个块,例如:[block1]->[block2]->[block3]<-[block4] 块看起来在哪里(如下),有人可以为我建议更好的方法吗?:

在此处输入图片描述

以下是我当前的代码,

\documentclass[border=1pt, tikz]{standalone}
\usepackage{tikz}

\usetikzlibrary{positioning,calc}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{shapes.geometric,shapes.arrows,decorations.pathmorphing}
\usetikzlibrary{matrix,chains,scopes,positioning,arrows,fit}

\begin{document}
\begin{tikzpicture}
    [mynode/.style = {rectangle, draw, align=center, 
            inner xsep=6mm, inner ysep=3mm, rounded corners},
    -latex,     
    ]

    % nodes
    % \node[mynode, label={[name=lab]Camera \& Infrared Sensor}] (inner1);
    \node[mynode, label={[name=lab]Camera \& Infrared Sensor}] (inner1) {Time Synchronization};
    \node[mynode, below=12mm of inner1] (justbelow) {Resampling};
    \node[fit={(lab) (justbelow)  (inner1)}, draw] (outer2) {};

    \end{tikzpicture}
\end{document}

另一个选择是:

\begin{tikzpicture}[
node distance=1cm,
block/.style = {draw, text width=21mm, align=center, rounded corners}
                ]
\node [block] (a) {Time Synch};
\node [block] (b) [below=of a] {Resampling};
% 
\node [block] (c) [right=of a] {Background modeling};
\node [block] (d) [below=of c] {Estimate Sensor Pixel Threshold};
\node [block] (e) [below=of d] {Estimate Overlap Sensor Parameters: Size and Position};
% 
\node [block] (c3a) [right=of c]  {Determine Foreground};
\node [block] (c3b) [below=of c3a] {Create Obfuscated Image};
\node [block] (c3c) [below=of c3b] {Overlap Foreground of Obfuscated Image};
% 
\node [block] (c4a) [right=of c3a]  {Blur};
\node [block] (c4b) [below=of c4a] {Edge};
\node [block] (c4c) [below=of c4b] {Masked};
%
\node[fit={(a) (b)}, draw] (outer1) {};
\node[fit={(c) (d)  (e)}, draw] (outer2) {};
\node[fit={(c3a) (c3b)  (c3c)}, draw] (outer3) {};
\node[fit={(c4a) (c4b)  (c4c)}, draw] (outer4) {};

\path[->]   (outer1) edge (outer2) 
            (outer2) edge (outer3)
            (outer4) edge (outer3);
\end{tikzpicture}

答案1

嗯,这是基于你最初问题附带的代码。你可能明白,我不会根据你刚刚提交的代码重新做这件事。

\documentclass[border=3.14mm,tikz]{standalone}
\usepackage{tikz}

\usetikzlibrary{calc}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning,fit,backgrounds}

\begin{document}
\begin{tikzpicture}[mynode/.style = {rectangle, draw, align=center,
            text width=4cm,fill=white,
            inner xsep=6mm, inner ysep=3mm, rounded corners},
            my arrow/.style={single arrow, draw,minimum height=1.1cm},
rotate border/.style={shape border uses incircle, shape border rotate=#1},
            font=\sffamily]
    \node[mynode, label={[name=lab]Camera \& Infrared Sensor}] (inner1) {Time Synchronization};
    \node[mynode, below=2mm of inner1] (justbelow1) {Resampling};
    %
    \node[right=1.5cm of inner1, mynode, label={[name=cal]Calibration \& alignment}] (inner2) {};
    \node[mynode, below=2mm of inner2] (justbelow2) {};
    \node[mynode, below=2mm of justbelow2] (justbelow2b) {};
    \node[mynode, below=2mm of justbelow2b] (justbelow2c) {};
    %
    \node[right=1.5cm of inner2, mynode, label={[name=img]Create obfuscated
    images}] (inner3) {};
    \node[mynode, below=2mm of inner3] (justbelow3) {};
    \node[mynode, below=2mm of justbelow3] (justbelow3b) {};
    \node[mynode, below=2mm of justbelow3b] (justbelow3c) {};
    %
    \node[right=1.5cm of inner3, mynode, label={[name=tech]Obfuscation
    techniques}] (inner4) {};
    \node[mynode, below=2mm of inner4] (justbelow4) {};
    \node[mynode, below=2mm of justbelow4] (justbelow4b) {};
    \node[mynode, below=2mm of justbelow4b] (justbelow4c) {};
    \begin{scope}[on background layer]
    \node[fit={(lab) (inner1) (justbelow4c.south-|inner1.south)}, draw,fill=red!20] (outer1) {};
    \node[fit={(cal) (inner2) (justbelow2c)}, draw,fill=red!20] (outer2) {};
    \node[fit={(img) (inner3) (justbelow3c)}, draw,fill=red!20] (outer3) {};
    \node[fit={(tech) (inner4) (justbelow4c)}, draw,fill=red!20] (outer4) {};
    \end{scope}
    \path (outer1) -- (outer2) node[pos=0.45,my arrow]{}
    (outer2) -- (outer3) node[pos=0.45,my arrow]{}
    (outer4) -- (outer3) node[pos=0.45,my arrow,shape border rotate=180]{};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容