%!TEX TS-program = pdflatexmk

% Copyright 2019 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{./..}
\input{\ROOT/src/material_header.tex}
\input{\ROOT/src/colors.tex}
% \input{\ROOT/src/hyperref.tex}

\tikzset{
  pics/distant_signal_go/.style args={#1}{
    code={
      \draw[loosely dashdotted] (0,1) -- ( 0,0) -- ++(8,0) -- ++(0,1);

      \draw[line width=4pt] (0,0) -- ++(0,-1.5) -- ++(4, 0); % signal pole
      \draw[line width=4pt,fill=base1!50] (2.1,-1.5) -- ++(2,-1) -- ++(0,2) -- cycle;  % signal screen
      \draw[fill=#1] (3.5,-1.5) circle (0.5); % signal aspect
      \draw[double] (3,-1.5) -- ++(1.0,0); % signal aspect
      \node[right] at (0.2,-1) {
        \IfLanguage{english}{\Large distant signal}
        \IfLanguage{ngerman}{\Large Vorsignal}
      }; % label
    }
  },
  pics/distant_signal_go/.default=signalgreen,
}
\tikzset{
  pics/block_signal_go/.style args={#1}{
    code={
      \draw[loosely dashdotted] (0,1) -- ( 0,0) -- ++(8,0) -- ++(0,1);
      
      \draw[line width=4pt] (0,0) -- ++(0,-1.5) -- ++(4, 0); % signal pole
      \draw[line width=4pt,fill=base1!50] (4,-0.5) rectangle ++(2,-2); % signal screen
      \draw[fill=#1] (5,-1.5) circle (0.5); % signal aspect
      \draw[double] (4.5,-1.5) -- ++(1.0,0); % signal aspect
      \node[right] at (0.2,-1) {
        \IfLanguage{english}{\Large block signal}
        \IfLanguage{ngerman}{\Large Blocksignal}
      }; % label
    }
  },
  pics/block_signal_go/.default=signalgreen,
}
\tikzset{
  pics/distant_signal_stop/.style args={#1}{
    code={
      \draw[loosely dashdotted] (0,1) -- ( 0,0) -- ++(8,0) -- ++(0,1);

      \draw[line width=4pt] (0,0) -- ++(0,-1.5) -- ++(4, 0); % signal pole
      \draw[line width=4pt,fill=base1!50] (2.1,-1.5) -- ++(2,-1) -- ++(0,2) -- cycle;  % signal screen
      \draw[fill=#1] (3.5,-1.5) circle (0.5); % signal aspect
      \draw[double] (3.14,-1.14) -- ++(0.72,-0.72); % signal aspect
      \node[right] at (0.2,-1) {
        \IfLanguage{english}{\Large distant signal}
        \IfLanguage{ngerman}{\Large Vorsignal}
      }; % label
    }
  },
  pics/distant_signal_stop/.default=signalyellow,
}
\tikzset{
  pics/block_signal_stop/.style args={#1}{
    code={
      \draw[loosely dashdotted] (0,1) -- ( 0,0) -- ++(8,0) -- ++(0,1);

      \draw[line width=4pt] (0,0) -- ++(0,-1.5) -- ++(4, 0); % signal pole
      \draw[line width=4pt,fill=base1!50] (4,-0.5) rectangle ++(2,-2); % signal screen
      \draw[fill=#1] (5,-1.5) circle (0.5); % signal aspect
      \draw[double] (5,-1) -- ++(0,-1); % signal aspect
      \node[right] at (0.2,-1) {
        \IfLanguage{english}{\Large block signal}
        \IfLanguage{ngerman}{\Large Blocksignal}
      }; % label
    }
  },
  pics/block_signal_stop/.default=signalred,
}

\begin{document}
  \selectlanguage{english} % currently supported: english, ngerman
  \tikzset{every path/.style={ultra thick}}
  \begin{frame}
    \vfill
    \begin{tikzpicture}[font=\sffamily]
      \foreach \x in {0,9.5,19}
        \foreach \y in {10,15}
          \pic at (\x,\y) {block_signal_go};
      \foreach \x in {0,9.5,19}
        \foreach \y in {0,5}
          \pic at (\x,\y) {distant_signal_go};
    \end{tikzpicture}
    \vfil
  \end{frame}
  \begin{frame}
    \vfill
    \begin{tikzpicture}[font=\sffamily]
      \foreach \x in {0,9.5,19}
        \foreach \y in {10,15}
          \pic at (\x,\y) {distant_signal_stop};
      \foreach \x in {0,9.5,19}
        \foreach \y in {0,5}
          \pic at (\x,\y) {block_signal_stop};
    \end{tikzpicture}
    \vfil
  \end{frame}
\end{document}