\documentclass[a4paper,10pt]{article}
\usepackage[left=24mm,right=30mm,bottom=25mm,top=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage[usestackEOL]{stackengine}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{fadings}
\usetikzlibrary{shadows.blur}
\newlength{\borderwidth}
\setlength{\borderwidth}{2mm}
\definecolor{plava.b}{RGB}{91,75,183}
\definecolor{crvena.b}{RGB}{163,32,48}
\definecolor{zelena}{RGB}{149,173,124}
\definecolor{orange.b}{RGB}{245,164,41}
\definecolor{unutra}{RGB}{255,255,225}
\definecolor{s.plava}{RGB}{183,206,225}
\definecolor{purp}{RGB}{129,81,153}
\definecolor{siva}{RGB}{140,138,134}
\tikzstyle{M3} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = plava.b, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{nosilac} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = zelena, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{signal} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = crvena.b, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{BJT} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = orange.b, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{DSO} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = s.plava, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{diodni} = [rectangle, rounded corners ,minimum width=4cm, minimum height=1.5cm,
text centered, border = purp, inner sep=10pt,
blur shadow={shadow blur steps=3},
draw,fill=unutra]
\tikzstyle{kolo} = [rectangle, rounded corners ,minimum width=3cm, minimum height=3cm,
text centered, border = siva, inner sep=10pt,
blur shadow={shadow blur steps=2},
draw,fill=white]
\tikzstyle{arrow} = [normal,->,>=stealth]
\tikzstyle{arrow1} = [normal,-,>=stealth]
\tikzstyle{100}=[rectangle]
\tikzstyle{modularni}=[rectangle,minimum width=3cm,text centered]
\tikzset{
border/.style = {
postaction = {clip, postaction = {draw = #1, solid,
line width = \borderwidth, path fading=,
postaction={draw, path fading = north}},
}
}}
\begin{document}
\begin{tikzpicture}[node distance=3.5cm]
\node (prvi) [M3] {\sffamily\bfseries
\Centerstack{M3 Cortex MCU \\STM32F103}};
\node (drugi) [nosilac,below of=prvi] {\sffamily\bfseries
\Centerstack{NOSILAC\\DSS AD9833}};
\node (treci) [signal,below of=drugi] {\sffamily\bfseries
\Centerstack{SIGNAL PORUKE\\DSS AD9833}};
\node (cetvrti) [100,right of=drugi,xshift=0.3cm] {\sffamily
{0.7V@100kHZ}};
\node (peti) [100,right of=treci,xshift=0.3cm] {\sffamily
{0.7V@5kHZ}};
\node (sesti) [BJT,below of=cetvrti,xshift=1.7cm,yshift=1.8cm] {\sffamily\bfseries
\Centerstack{BJT \\MODULATOR}};
\node (sedmi)[modularni,right of=sesti]{\sffamily\Centerstack{Modulirani\\signal}};
\node (osmi) [kolo,right of=sedmi,xshift=-0.3cm]{};
\node (deveti) [DSO,below of=peti,xshift=1.1cm,yshift=1.5cm]{\sffamily
\Centerstack{\textbf{DSO} \\4x Kanala}};
\node (deseti) [diodni,below of=osmi,yshift=-0.3cm,xshift=-0.1cm] {\sffamily\bfseries
\Centerstack{DIODNI detektor \\sa NF RC filterom}};
\node (jedanaesti)[100,above of=osmi,yshift=-1.7cm]{\sffamily{pojačavačc RF signala}}
\end{tikzpicture}
\end{document}
答案1
答案2
OP 代码的改变。
- 使用
positioning
库 - 已弃用更改
tikzstyle
为tikzset
- 为几乎所有盒装元素定义参数样式,以节省一些输入
- 添加所需的箭头
结果
\documentclass[a4paper,10pt]{article}
\usepackage[left=24mm,right=30mm,bottom=25mm,top=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{fadings, positioning}
\usetikzlibrary{shadows.blur}
\newlength{\borderwidth}
\setlength{\borderwidth}{2mm}
\definecolor{plava.b}{RGB}{91,75,183}
\definecolor{crvena.b}{RGB}{163,32,48}
\definecolor{zelena}{RGB}{149,173,124}
\definecolor{orange.b}{RGB}{245,164,41}
\definecolor{unutra}{RGB}{255,255,225}
\definecolor{s.plava}{RGB}{183,206,225}
\definecolor{purp}{RGB}{129,81,153}
\definecolor{siva}{RGB}{140,138,134}
\tikzset{
anybox/.style={rectangle, rounded corners, minimum width=4cm, minimum height=1.5cm,
text width=3cm, align=center, inner sep=10pt, blur shadow={shadow blur steps=3},
draw, fill=unutra, font=\bfseries\sffamily, border=#1},
M3/.style={anybox=plava.b},
nosilac/.style={anybox=zelena},
signal/.style={anybox=crvena.b},
BJT/.style={anybox=orange.b},
DSO/.style={anybox=s.plava},
diodni/.style={anybox=purp},
kolo/.style={anybox=siva, minimum height=3cm, fill=white},
modularni/.style={minimum width=2cm, text width=1.5cm, align=center},
>=stealth,
}
\tikzset{
border/.style = {
postaction = {clip, postaction = {draw = #1, solid,
line width = \borderwidth, path fading=west,
postaction={draw, path fading = north}},
}
}}
\begin{document}
\begin{tikzpicture}[node distance=2cm, font=\sffamily]
\node (prvi) [M3] {M3 Cortex MCU\\STM32F103};
\node (drugi) [nosilac, below = of prvi] {NOSILAC\\DSS AD9833};
\node (treci) [signal,below = of drugi] {SIGNAL PORUKE\\DSS AD9833};
%\node (cetvrti) [right = 5mm of drugi] {0.7V@100kHZ};
%\node (peti) at (cetvrti|-treci) {0.7V@5kHZ};
\node (sesti) [BJT,below right= 3mm and 1cm of drugi] {BJT \\MODULATOR};
%\node (sedmi) [modularni,right = 1cm of sesti]{Modulirani\\signal};
\node (osmi) [kolo,right =3cm of sesti, label={pojačavačc RF signala}]{};
\node (deveti) [DSO,below = of sesti]{\textbf{DSO} \\4x Kanala};
\node (deseti) [diodni] at (deveti-|osmi) {DIODNI detektor \\sa NF RC filterom};
\draw[->] (prvi.west)--++(180:5mm)|-(drugi) node[pos=.25,above,sloped, rotate=180] {SPI interface};
\draw[->] (prvi.west)--++(180:5mm)|-(treci);
\draw[->] (drugi)-|(sesti) node[pos=.25, fill=white] (cetvrti) {0.7V@100kHZ};
\draw[->] (treci)-|(sesti) node[pos=.25, fill=white] (peti) {0.7V@5kHZ};
\draw[->] (sesti)--(osmi) node[modularni, pos=.5, fill=white] (sedmi) {Modulirani\\signal};
\draw[->] (osmi)--(deseti);
\draw[dashed,->,red] (deveti.north) -- (sedmi.west);
\draw[dashed,->,red] (deveti.north) -- (peti.west);
\draw[dashed,->,red] (deveti.north) -- (cetvrti.west);
\draw[dashed,->,red] (deveti) -- (deseti);
\end{tikzpicture}
\end{document}