I wrote a TikZ pic
for a simple database icon (first picture below). What I want is to hide the two edges that are behind overlaying boxes, similar to the second picture. I thought I could add a white fill to the boxes, but how do I do that?
P.S.: this code is quite ugly and repetitive, feedback is always welcome.
\documentclass{standalone}
\usepackage{tikz}
\tikzset{
db/.pic={
\draw[-,pic actions] (-0.3,0 ) edge[looseness=0.5,bend right=90] (0.3,0 );
\draw[-,pic actions] (-0.3,0 ) -- ++(0,0.2);
\draw[-,pic actions] ( 0.3,0 ) -- ++(0,0.2);
\draw[-,pic actions] (-0.3,0.2 ) edge[looseness=0.5,bend right=90] (0.3,0.2 );
\draw[-,pic actions] (-0.3,0.2 ) edge[looseness=0.5,bend left=90] (0.3,0.2 );
\draw[-,pic actions] (-0.3,0.25) edge[looseness=0.5,bend right=90] (0.3,0.25);
\draw[-,pic actions] (-0.3,0.25) -- ++(0,0.2);
\draw[-,pic actions] ( 0.3,0.25) -- ++(0,0.2);
\draw[-,pic actions] (-0.3,0.45) edge[looseness=0.5,bend right=90] (0.3,0.45);
\draw[-,pic actions] (-0.3,0.45) edge[looseness=0.5,bend left=90] (0.3,0.45);
\draw[-,pic actions] (-0.3,0.5 ) edge[looseness=0.5,bend right=90] (0.3,0.5 );
\draw[-,pic actions] (-0.3,0.5 ) -- ++(0,0.2);
\draw[-,pic actions] ( 0.3,0.5 ) -- ++(0,0.2);
\draw[-,pic actions] (-0.3,0.7 ) edge[looseness=0.5,bend right=90] (0.3,0.7 );
\draw[-,pic actions] (-0.3,0.7 ) edge[looseness=0.5,bend left=90] (0.3,0.7 );
}
}
\begin{document}
\begin{tikzpicture}
\pic {db};
\end{tikzpicture}
\end{document}