Por favor mire el siguiente código
%%%%%%%%%%%%%%%%%%% MOBILE TOWER %%%%%%%%%%%%%%%%%%%%%
\newcommand{\MBS}[1]{%
\begin{tikzpicture}[]
\node[station] (base) {#1};
%\draw[line join=bevel] (base.110) -- (base.70) -- (base.north west) -- (base.north east) -- cycle;
\draw[line join=bevel] (base.100) -- (base.80) -- (base.110) -- (base.70) -- (base.north west) -- (base.north east);
\draw[line join=bevel] (base.100) -- (base.70) (base.110) -- (base.north east);
% original yshift=.8pt
%\draw[line cap=rect] ([xshift=.5cm,yshift=.3pt] base.north) [antenna=1];
%\draw[line cap=rect] ([yshift=.3pt]ant1 |- base.north) -- node[above,shape=rectangle,inner ysep=+.3333em]{\dots} ([xshift=-.5cm,yshift=.3pt]base.north) [antenna=2];
\draw[line cap=rect] ([xshift=-.1768cm,yshift=.6pt]base.north -| base.right tail) [antenna=1];
\draw[line cap=rect] ([yshift=.6pt]ant1 |- base.north) -- node[above,shape=rectangle,inner ysep=+.3333em]{\dots} ([xshift=.1768cm,yshift=.6pt]base.north -| base.left tail) [antenna=2];
%\draw[line cap=rect] ([yshift=.3pt]ant1 |- base.north) -- ([xshift=-.5cm,yshift=.3pt]base.north) [antenna=2];
%\node at ($(ant1)!0.5!(ant2)$) {\dots};
\end{tikzpicture}
}
Me permite escribir comandos como
\draw (-4,0) node[scale=2]{\MBS{a}} ;
y genere una figura con una etiqueta 'a' en el centro (en comunicaciones inalámbricas, este diagrama se refiere a una torre de telefonía móvil). Ahora el siguiente fragmento de código.
%%%%%%%%%%%%%%%%%%%%%% RELAY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{radiation/.style={{decorate,decoration={expanding waves,angle=90,segment length=4pt}}},
relay/.pic={
code={\tikzset{scale=5/10}
\draw[semithick] (0,0) -- (1,4);% left line
\draw[semithick] (3,0) -- (2,4);% right line
\draw[semithick] (0,0) arc (180:0:1.5 and -0.5);
\node[inner sep=4pt] (circ) at (1.5,5.5) {};
\draw[semithick] (1.5,5.5) circle(8pt);
\draw[semithick] (1.5,5.5cm-8pt) -- (1.5,4);
\draw[semithick] (1.5,4) ellipse (0.5 and 0.166);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm+8pt,5.5) -- +(0:2);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm-8pt,5.5) -- +(180:2);
}}
}
me permite escribir código como
\path (2,-1.2) pic[scale=0.5,color=red] {relay};
lo cual genera una figura sin etiqueta en su centro (Para los curiosos, se le conoce como relé en comunicaciones inalámbricas). ¿Cómo logro ese etiquetado personalizado en el centro similar al primer ejemplo (torre móvil)?
En el siguiente código se proporciona un ejemplo funcional completo.
\documentclass[tikz]{standalone}
\usepackage{ellipsis}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing,decorations.markings,shapes.geometric}
\tikzset{naming/.style={align=center,font=\small}}
\tikzset{antenna/.style={insert path={-- coordinate (ant#1) ++(0,0.25) -- +(135:0.25) + (0,0) -- +(45:0.25)}}}
\tikzset{station/.style={naming,draw,shape=dart,shape border rotate=90, minimum width=10mm, minimum height=10mm,outer sep=0pt,inner sep=3pt}}
%\tikzset{mobile/.style={naming,draw,shape=rectangle,minimum width=15mm,minimum height=7.5mm, outer sep=0pt,inner sep=3pt}}
\tikzset{mobile/.style={naming,draw,shape=rectangle,minimum width=12mm,minimum height=6mm, outer sep=0pt,inner sep=3pt}}
%\tikzset{radiation/.style={{decorate,decoration={expanding waves,angle=90,segment length=4pt}}}}
%%%%%%%%%%%%%%%%%%%%%% RELAY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tikzset{radiation/.style={{decorate,decoration={expanding waves,angle=90,segment length=4pt}}},
relay/.pic={
code={\tikzset{scale=5/10}
\draw[semithick] (0,0) -- (1,4);% left line
\draw[semithick] (3,0) -- (2,4);% right line
\draw[semithick] (0,0) arc (180:0:1.5 and -0.5);
\node[inner sep=4pt] (circ) at (1.5,5.5) {};
\draw[semithick] (1.5,5.5) circle(8pt);
\draw[semithick] (1.5,5.5cm-8pt) -- (1.5,4);
\draw[semithick] (1.5,4) ellipse (0.5 and 0.166);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm+8pt,5.5) -- +(0:2);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm-8pt,5.5) -- +(180:2);
}}
}
%%%%%%%%% MOBILE PHONE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\UE}[1]{%
\begin{tikzpicture}[every node/.append style={rectangle,minimum width=0pt}]
\node[mobile] (box) {#1};
\draw ([xshift=.25cm] box.south west) circle (4pt)
([xshift=-.25cm]box.south east) circle (4pt);
\fill ([xshift=.25cm] box.south west) circle (1pt)
([xshift=-.25cm]box.south east) circle (1pt);
\draw (box.north) [antenna=1];
\end{tikzpicture}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOBILE BASE STATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\MBS}[1]{%
\begin{tikzpicture}[]
\node[station] (base) {#1};
%\draw[line join=bevel] (base.110) -- (base.70) -- (base.north west) -- (base.north east) -- cycle;
\draw[line join=bevel] (base.100) -- (base.80) -- (base.110) -- (base.70) -- (base.north west) -- (base.north east);
\draw[line join=bevel] (base.100) -- (base.70) (base.110) -- (base.north east);
% original yshift=.8pt
%\draw[line cap=rect] ([xshift=.5cm,yshift=.3pt] base.north) [antenna=1];
%\draw[line cap=rect] ([yshift=.3pt]ant1 |- base.north) -- node[above,shape=rectangle,inner ysep=+.3333em]{\dots} ([xshift=-.5cm,yshift=.3pt]base.north) [antenna=2];
\draw[line cap=rect] ([xshift=-.1768cm,yshift=.6pt]base.north -| base.right tail) [antenna=1];
\draw[line cap=rect] ([yshift=.6pt]ant1 |- base.north) -- node[above,shape=rectangle,inner ysep=+.3333em]{\dots} ([xshift=.1768cm,yshift=.6pt]base.north -| base.left tail) [antenna=2];
%\draw[line cap=rect] ([yshift=.3pt]ant1 |- base.north) -- ([xshift=-.5cm,yshift=.3pt]base.north) [antenna=2];
%\node at ($(ant1)!0.5!(ant2)$) {\dots};
\end{tikzpicture}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%% DIAGRAM STARTS HERE %%%%%%%%%%%%%%%%%
\begin{document}
\begin{tikzpicture}%[every path/.append style={thick}]
\draw (-4,0) ellipse (8 and 3);
\draw (8,0) ellipse (8 and 3);
\draw (-4,0) node[scale=2]{\MBS{a}} ;
\draw (8,0) node[scale=2,color=red]{\MBS{2}} ;
\path (2,1) pic[scale=0.5,color=red] {relay};
\path (2,-1.2) pic[scale=0.5,color=red] {relay};
\draw (1,0) node[scale=.8]{\UE{1}};
\draw (-1,0) node[scale=.8]{\UE{2}};
\end{tikzpicture}
\end{document}
Respuesta1
¿Algo como esto?
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{radiation/.style={{decorate,decoration={expanding waves,angle=90,segment length=4pt}}},
relay/.pic={
code={\tikzset{scale=5/10}
\draw[semithick] (0,0) -- (1,4);% left line
\draw[semithick] (3,0) -- (2,4);% right line
\draw[semithick] (0,0) arc (180:0:1.5 and -0.5) node[above, midway]{#1};
\node[inner sep=4pt] (circ) at (1.5,5.5) {};
\draw[semithick] (1.5,5.5) circle(8pt);
\draw[semithick] (1.5,5.5cm-8pt) -- (1.5,4);
\draw[semithick] (1.5,4) ellipse (0.5 and 0.166);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm+8pt,5.5) -- +(0:2);
\draw[semithick,radiation,decoration={angle=45}] (1.5cm-8pt,5.5) -- +(180:2);
}}
}
\begin{document}
\begin{tikzpicture}
\path (2,-1.2) pic[scale=0.5,color=red] {relay=B};
\end{tikzpicture}
\end{document}