%!TEX TS-program = pdflatexmk

% Copyright 2021 Martin Scheidt (Attribution 4.0 International, CC-BY 4.0)
% You are free to copy and redistribute the material in any medium or format. You are free to remix, transform, and build upon the material for any purpose, even commercially. You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. No warranties are given.

\documentclass{beamer}
\usepackage[
  size=a4,
]{beamerposter}
\beamertemplatenavigationsymbolsempty

\def\ROOT{./..}
\usepackage{material}

\newlength{\routelockerlength}\setlength{\routelockerlength}{4.3cm} % default 4cm
\newlength{\routelockerwidth}\setlength{\routelockerwidth}{2.3cm} % default 2cm
\newlength{\overlaplockerlength}\setlength{\overlaplockerlength}{3.9cm} % default 4cm
\newlength{\overlaplockerwidth}\setlength{\overlaplockerwidth}{1.9cm} % default 2cm
\newlength{\clockradius}

\tikzset{
  pics/key/.style args={#1}{
    code={
      \filldraw[#1]    (-0.5,0) ellipse   (0.25cm and 0.5cm);
      \filldraw[white] (-0.5,0) ellipse   (0.1cm and 0.35cm);
      \filldraw[#1]    (-0.25,-0.1) rectangle (0.75,0.1);
      \filldraw[#1]    ( 0.45,-0.1) rectangle (0.55,-0.2);
      \filldraw[#1]    ( 0.6 ,-0.1) rectangle (0.7,-0.3);
    }
  },
  pics/key/.default=black!30,
}

\tikzset{
  pics/flank_protection_symbol/.style = {
    code={
      \draw[fill] (-0.65,-0.1) circle (0.04);
      \draw[fill] ( 0.65,-0.1) circle (0.04);
      \draw[-> ,>=latex] (-0.65,-0.1) -- (0.65,-0.1);
      \draw[->|,>=latex,red] ( 0  , 0.4) -- (0   ,0   );
    }
  },
}

\tikzset{
  pics/route_protection_symbol/.style = {
    code={
      \draw[fill] (-0.65,-0.1) circle (0.04);
      \draw[fill] ( 0.65,-0.1) circle (0.04);
      \draw[-> ,>=latex,red] (-0.65,-0.1) -- (0.65,-0.1);
    }
  },
}

\tikzset{
  pics/overlap_protection_symbol/.style = {
    code={
      \draw[-> ,>=latex] (-0.65,-0.1) -- (0,-0.1);
      \draw[-| ,red] (0,-0.1) -- (0.65,-0.1);
      \filldraw[red] ( 0,-0.1) circle (0.04);
    }
  },
}

\tikzset{
  pics/clock/.style args={#1}{
    code={
      \setlength{\clockradius}{#1}

      \draw[fill=white] (0,0) circle [radius=\clockradius];
      \foreach \angle [count=\x] in {60,30,0,...,-270} {
        \draw[line width=0.05\clockradius] (\angle:0.92\clockradius) -- (\angle:\clockradius);
        % \node[inner sep=0,anchor=\angle] at (\angle:0.89\radius) {\tiny \textbf{\x}};
      }
      % draw hands on clock
      \draw[color=black,line width=0.027\clockradius] (0,0) -- (90:0.8\clockradius);
      \draw[color=red,line width=0.02\clockradius]    (0,0) -- (-45:0.85\clockradius);
      \filldraw[color=red] (0,0) circle [radius=0.05\clockradius];
    }
  },
  pics/clock/.default={2cm},
}

\tikzset{
  pics/flank_locker/.style = {
    code={
      % drawing
      \draw (0,0) rectangle ( 2, 2);
      \draw (0,2) rectangle ( 2, 4);
      \draw (0,0) rectangle ( 2,-2);
      \draw (2,2) rectangle ( 4, 0);
      \draw (0,0) rectangle (-2, 2);
      %
      \pic[scale=0.75,rotate=180] at (1, 3.15) {key};
      \pic at (1,1) {flank_protection_symbol};
      \pic[scale=0.75] at (1,-0.95) {key};
      % adhesive edge
      \tikzset{every path/.style={thin,base1}}
      \draw (0,0) -- ++(-1,-0.5) -- ++(0,-1) -- (0,-2);
      \draw (2,0) -- ++( 1,-0.5) -- ++(0,-1) -- (2,-2);
      \draw (0,2) -- ++(-1, 0.5) -- ++(0, 1) -- (0, 4);
      \draw (2,2) -- ++( 1, 0.5) -- ++(0, 1) -- (2, 4);
    } 
  },
}

\tikzset{
  pics/route_locker/.style = {
    code={
      % drawing
      \draw (0,0) rectangle ++(\routelockerlength, \routelockerwidth);
      % \draw (0,2) rectangle ( 4, 4);
      \draw (0.25\routelockerlength,1.75\routelockerwidth) -- ++(-0.125\routelockerlength,0.25\routelockerwidth) -- ++(-0.125\routelockerlength,0) -- ++(0,-\routelockerwidth) -- ++(\routelockerlength,0) -- ++(0,\routelockerwidth) -- ++(-0.125\routelockerlength,0) -- ++(-0.125\routelockerlength,-0.25\routelockerwidth) -- cycle;
      % \draw (0,0) rectangle ( 4,-2);
      \draw (0.25\routelockerlength,-0.75\routelockerwidth) -- ++(-0.125\routelockerlength,-0.25\routelockerwidth) -- ++(-0.125\routelockerlength,0) -- ++(0,\routelockerwidth) -- ++(\routelockerlength,0) -- ++(0,-\routelockerwidth) -- ++(-0.125\routelockerlength,0) -- ++(-0.125\routelockerlength,0.25\routelockerwidth) -- cycle;
      \draw (\routelockerlength,0) rectangle ++(\routelockerwidth,\routelockerwidth);
      \draw (0,0) rectangle ++(-\routelockerwidth, \routelockerwidth);
      %
      \pic[scale=0.75,rotate=180] at (2, 2.85) {key};
      \pic[scale=1.75] at (2,1) {route_protection_symbol};
      \pic[scale=0.75] at (2,-0.85) {key};
      % adhesive edge
      \tikzset{every path/.style={thin,base1}}
      \draw (0,0) -- ++(-0.5\routelockerwidth,-0.25\routelockerwidth) -- ++(0,-0.5\routelockerwidth) -- (0,-\routelockerwidth);
      \draw (\routelockerlength,0) -- ++(0.5\routelockerwidth,-0.25\routelockerwidth) -- ++(0,-0.5\routelockerwidth) -- (\routelockerlength,-\routelockerwidth);
      \draw (0,\routelockerwidth) -- ++(-0.5\routelockerwidth,0.25\routelockerwidth) -- ++(0,0.5\routelockerwidth) -- ++(0.5\routelockerwidth,0.25\routelockerwidth);
      \draw (\routelockerlength,\routelockerwidth) -- ++(0.5\routelockerwidth,0.25\routelockerwidth) -- ++(0,0.5\routelockerwidth) -- (\routelockerlength,2\routelockerwidth);
    } 
  },
}

\tikzset{
  pics/overlap_locker/.style = {
    code={
      \draw (0,0) rectangle ++(\overlaplockerlength, \overlaplockerwidth);
      % \draw (0,2) rectangle ( 4, 4);
      \draw (0.25\overlaplockerlength,1.75\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,0.25\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,0) -- ++(0,-\overlaplockerwidth) -- ++(\overlaplockerlength,0) -- ++(0,\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,0) -- ++(-0.125\overlaplockerlength,-0.25\overlaplockerwidth) -- cycle;
      % \draw (0,0) rectangle ( 4,-2);
      \draw (0.25\overlaplockerlength,-0.75\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,-0.25\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,0) -- ++(0,\overlaplockerwidth) -- ++(\overlaplockerlength,0) -- ++(0,-\overlaplockerwidth) -- ++(-0.125\overlaplockerlength,0) -- ++(-0.125\overlaplockerlength,0.25\overlaplockerwidth) -- cycle;
      \draw (\overlaplockerlength,0) rectangle ++(\overlaplockerwidth,\overlaplockerwidth);
      \draw (0,0) rectangle ++(-\overlaplockerwidth, \overlaplockerwidth);
      %
      \pic[scale=0.75,rotate=180] at (2, 2.8) {key};
      \pic at (2.5, 1.2) {clock=0.5cm};
      \pic[scale=1.75] at (2,0.5) {overlap_protection_symbol};
      \pic[scale=0.75] at (2,-0.85) {key};
      % adhesive edge
      \tikzset{every path/.style={thin,base1}}
      \draw (0,0) -- ++(-0.5\overlaplockerwidth,-0.25\overlaplockerwidth) -- ++(0,-0.5\overlaplockerwidth) -- (0,-\overlaplockerwidth);
      \draw (\overlaplockerlength,0) -- ++(0.5\overlaplockerwidth,-0.25\overlaplockerwidth) -- ++(0,-0.5\overlaplockerwidth) -- (\overlaplockerlength,-\overlaplockerwidth);
      \draw (0,\overlaplockerwidth) -- ++(-0.5\overlaplockerwidth,0.25\overlaplockerwidth) -- ++(0,0.5\overlaplockerwidth) -- ++(0.5\overlaplockerwidth,0.25\overlaplockerwidth);
      \draw (\overlaplockerlength,\overlaplockerwidth) -- ++(0.5\overlaplockerwidth,0.25\overlaplockerwidth) -- ++(0,0.5\overlaplockerwidth) -- (\overlaplockerlength,2\overlaplockerwidth);
    } 
  },
}

\begin{document}
  \selectlanguage{ngerman} % currently supported: english, ngerman
  \tikzset{every path/.style={ultra thick}}
  \begin{frame}
    \begin{tikzpicture}[remember picture,overlay,font=\sffamily]
      \path (current page.north west) rectangle (current page.south west); % rectangle for background to unify orientation
      \begin{scope}[shift={(1.5,-12)}]
        \foreach \x in {0}
          \foreach \y in {2.5,9,15.5}
            \pic at (\x,\y) {flank_locker};
        \foreach \x in {6.5}
          \foreach \y in {2.5,9,15.5}
            \pic at (\x,\y) {overlap_locker};
        \foreach \x in {17.3,24.5}
          \foreach \y in {3,13}
            \pic[rotate=90,transform shape] at (\x,\y) {route_locker};
        % \pic at (15,6) {route_locker};
        % \pic at (23,2) {flank_locker};
      \end{scope}
    \end{tikzpicture}
  \end{frame}
\end{document}