你能帮我写一下下面图片的 TikZ 代码吗?
我已经编写了 PSTricks 代码:
\psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-10.931543)(19.72964,10.931543)
\definecolor{colour0}{rgb}{0.9647059,0.9647059,0.9647059}
\definecolor{colour1}{rgb}{0.8,0.8,0.8}
\definecolor{colour2}{rgb}{0.2,0.2,0.2}
\definecolor{colour3}{rgb}{0.972549,0.972549,0.972549}
\pspolygon[linecolor=black, linewidth=0.04, shadow=true,shadowsize=0.10583334, fillstyle=solid,fillcolor=colour0](2.32,-5.868457)(10.8,-10.908457)(19.68,-5.9484572)(10.88,-3.0684571)(10.8,-3.0684571)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid,fillcolor=colour1, dimen=outer](10.790525,-6.1291337)(3.7075453,1.3763912)
\pscustom[linecolor=black, linewidth=0.04]
{
\newpath
\moveto(10.8,-1.068457)
}
\psframe[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](11.20679,-7.999532)(10.339969,-9.088625)
\psframe[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](11.12679,-3.788457)(10.419969,-4.353439)
\psframe[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](16.24,-5.7739944)(15.203328,-6.4369206)
\pspolygon[linecolor=black, linewidth=0.04, fillstyle=solid](13.04,-4.668457)(13.6,-4.908457)(14.08,-4.4284573)(13.52,-4.188457)(13.04,-4.668457)
\pspolygon[linecolor=black, linewidth=0.04, fillstyle=solid](8.0,-4.908457)(8.56,-4.668457)(8.08,-4.268457)(7.52,-4.508457)
\pspolygon[linecolor=black, linewidth=0.04, fillstyle=solid](13.12,-7.788457)(13.68,-7.548457)(14.32,-8.108457)(13.76,-8.508457)(13.12,-7.788457)
\pspolygon[linecolor=black, linewidth=0.04, fillstyle=solid](7.76,-7.468457)(8.361493,-7.737999)(7.84,-8.508457)(7.2,-8.108457)
\psframe[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](6.396672,-5.7266426)(5.36,-6.389569)
\psline[linecolor=black, linewidth=0.034](10.8,-8.028457)(10.8,-7.468457)
\psline[linecolor=black, linewidth=0.032](13.414456,-7.6721134)(12.96,-7.228457)
\psline[linecolor=black, linewidth=0.032](15.220512,-6.0530725)(14.482051,-6.0530725)
\psline[linecolor=black, linewidth=0.034](13.36,-4.808457)(13.04,-5.068457)
\psline[linecolor=black, linewidth=0.032](10.7488,-4.350057)(10.7488,-4.7603135)
\psline[linecolor=black, linewidth=0.03](8.24,-4.788457)(8.56,-5.0483956)
\psline[linecolor=black, linewidth=0.032](6.3589745,-6.0530725)(7.097436,-6.0530725)
\psline[linecolor=black, linewidth=0.032](8.0,-7.588549)(8.4,-7.148457)
\pspolygon[linecolor=black, linewidth=0.04, shadow=true,shadowangle=45.0,shadowsize=0.10583334,shadowcolor=colour2, fillstyle=solid,fillcolor=colour3](2.16,2.371543)(10.8,-0.66845703)(19.52,2.291543)(10.72,6.371543)(10.64,6.371543)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](5.92,2.531543)(0.56,0.32)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](10.84,4.611543)(0.76,0.48)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](10.84,0.13154297)(0.52,0.32)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](15.76,2.331543)(0.64,0.36)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](8.2,3.851543)(0.6,0.36)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](8.36,1.331543)(0.52,0.32)
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](13.48,1.171543)(0.52,0.32)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](10.16,4.451543)(8.72,3.971543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](11.28,4.211543)(13.28,1.411543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](10.56,4.131543)(8.64,1.571543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](7.92,1.571543)(6.32,2.291543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](14.08,3.571543)(15.28,2.531543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](15.2,2.131543)(13.92,1.331543)
\psline[linecolor=black, linewidth=0.04, linestyle=dotted, dotsep=0.10583334cm](11.28,0.29154298)(13.04,1.0115429)
\psline[linecolor=black, linewidth=0.018, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(5.84,2.531543)(5.84,-5.868457)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(8.0,-4.588457)(8.0,1.331543)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(7.76,-7.628457)(7.76,3.891543)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(10.48,-8.108457)(10.48,4.371543)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(11.04,-4.028457)(11.04,0.13154297)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(13.84,-4.508457)(13.84,1.091543)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(14.0,3.891543)(14.0,-8.028457)
\psline[linecolor=black, linewidth=0.016, arrowsize=0.073cm 3.65,arrowlength=1.4,arrowinset=0.0]{<->}(16.08,-5.868457)(16.08,2.131543)
\rput[bl](9.649231,-10.182303){Physical Layer}
\rput[bl](9.009231,5.2576966){Communication Layer}
\rput[bl](11.6,4.691543){DG1}
\rput[bl](11.28,-8.748457){DG1}
\rput[bl](14.4,-8.108457){DG2}
\rput[bl](14.32,3.811543){DG2}
\rput[bl](16.32,-6.268457){DG3}
\rput[bl](13.92,-4.748457){DG4}
\rput[bl](11.2,-4.108457){DG5}
\rput[bl](6.8,-4.748457){DG6}
\rput[bl](4.56,-6.188457){DG7}
\rput[bl](6.48,-7.9484572){DG8}
\rput[bl](16.4,2.211543){DG3}
\rput[bl](14.08,0.931543){DG4}
\rput[bl](11.36,-0.02845703){DG5}
\rput[bl](6.96,1.171543){DG6}
\rput[bl](4.64,2.4515429){DG7}
\rput[bl](6.88,3.811543){DG8}
\rput[r](11.489231,-6.102303){Network}
\psellipse[linecolor=black, linewidth=0.04, fillstyle=solid, dimen=outer](13.64,3.851543)(0.6,0.36)
\end{pspicture}
}
但我想将其翻译成 TikZ
答案1
只是为了让你开始......
\documentclass[tikz,border=5]{standalone}
\usepgfmodule{nonlineartransformations}
\makeatletter
\def\transformA{%
\pgfgetlastxy\xx\yy%
\pgfmathparse{\xx*(1+\yy/250}\let\x=\pgfmathresult
\pgfmathparse{\yy*(1+\xx/250}\let\y=\pgfmathresult
\pgfmathparse{\x*cos 15+\y*cos 165}%
\pgf@x=\pgfmathresult pt
\pgfmathparse{\y*sin 15+\x*sin 165+75}%
\pgf@y=\pgfmathresult pt
}
\def\transformB{%
\pgfgetlastxy\xx\yy%
\pgfmathparse{\xx*(1+\yy/250}\let\x=\pgfmathresult
\pgfmathparse{\yy*(1+\xx/250}\let\y=\pgfmathresult
\pgfmathparse{\x*cos 15+\y*cos 165}%
\pgf@x=\pgfmathresult pt
\pgfmathparse{-\y*sin 15-\x*sin 165-75}%
\pgf@y=\pgfmathresult pt
}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\pgftransformnonlinear{\transformA}
\draw [dotted, fill=gray!10] (-2,-2) rectangle (2,2);
\foreach \i in {1,...,4}
\filldraw [fill=gray, draw=black]
(\i*90-15:1.5) coordinate (upper A-\i) circle [radius=.25]
(\i*90+20:1.5) coordinate (upper B-\i) circle [radius=.25];
\end{scope}
\begin{scope}
\pgftransformnonlinear{\transformB}
\draw [dotted, fill=gray!10] (-2,-2) rectangle (2,2);
\filldraw [fill=gray!50, draw=black] circle [radius=1];
\foreach \i in {1,...,4}
\filldraw [fill=gray, draw=black]
(\i*90-15:1) -- ++(\i*90:.25)
+(\i*90:.25) coordinate (lower A-\i)
++(\i*90+90:.25) rectangle ++(\i*90-45:.5*sqrt 2)
(\i*90+20:1) -- ++(\i*90:.25)
+(\i*90:.25) coordinate (lower B-\i)
++(\i*90+90:.25) rectangle ++(\i*90-45:.5*sqrt 2);
\end{scope}
\foreach \i in {1,...,4}
\draw [stealth-stealth] (upper A-\i) -- (lower A-\i);
\foreach \i in {1,...,4}
\draw [stealth-stealth] (upper B-\i) -- (lower B-\i);
\end{tikzpicture}
\end{document}