%!TEX TS-program = pdflatexmk

% Copyright 2018 Martin Scheidt (ISC license)
% Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

\documentclass[tikz,border=2]{standalone}

\usepackage{lmodern}
\usepackage[prefix=]{xcolor-solarized}

\def\rootTrackschematic{../../tikz-trackschematic}
\def\srcTrackschematic{\rootTrackschematic/src}
\input{\srcTrackschematic/topology.tikz}
\input{\srcTrackschematic/constructions.tikz}
\input{\srcTrackschematic/vehicles.tikz}
\input{\srcTrackschematic/trafficControl.tikz}   % Order 1
\input{\srcTrackschematic/layoutSymbols_DE.tikz} % Order 2 (important)

\begin{document}
  \begin{tikzpicture}[font=\sffamily]
  {   % stations
    \tikzset{every node/.style={base00}};
    \node[right,align=left] at ( 2,1.3) {to and from\\ Arnau};
    \node                   at (21,3.3) {{\LARGE Bf Berg}};
    \node[left,align=right] at (38,1.3) {to and from\\ Chamstadt};
  }
  {   % tracks
    \draw[line width=2pt] ( 1.5, 0) -- ++(37,0);
    \draw[line width=2pt] (15  , 0) -- ++( 1,1) -- ++(10,0) -- ++(1,-1);
    \draw[line width=1pt] (11  ,-1) -- ++( 2,0) -- ++( 1,1);
    \draw[line width=1pt] ( 9  , 1) -- ++( 7,0);
    \draw[line width=1pt] (14  , 1) -- ++( 1,1) -- ++(10,0);
    % track numbers
    \node[fill=white] at (11.7, 1) {12};
    \node[fill=white] at (11.7,-1) {10};
    \node[fill=white] at (21.0, 2) { 3};
    \node[fill=white] at (21.0, 1) { 2};
    \node[fill=white] at (21.0, 0) { 1};
    % bufferstops
    \pic at ( 9, 1) {bufferstop_backward};
    \pic at (11,-1) {bufferstop_backward};
    \pic at (25, 2) {bufferstop_forward};
    % turnouts
    \pic  at (12.8,-1) {derailer_right_forward};
    \node at (12.7,-1.4) {\footnotesize Gs7};
    \pic  at (14,0) {turnout_left_backward};
    \pic  at (14,0) {fouling_point_left_backward};
    \node at (14,0.2) {\footnotesize W1};
    \pic  at (14,1) {turnout_left_forward};
    \pic  at (14,1) {fouling_point_left_forward};
    \node at (14,0.8) {\footnotesize W4};
    \pic  at (15,0) {turnout_left_forward};
    \pic  at (15,0) {fouling_point_left_forward};
    \node at (15,-0.2) {\footnotesize W2};
    \pic  at (16,1) {turnout_left_backward};
    \pic  at (16,1) {fouling_point_left_backward};
    \node at (16,1.2) {\footnotesize W3};
    \pic  at (27,0) {turnout_right_backward};
    \pic  at (27,0) {fouling_point_right_backward};
    \node at (27,-0.2) {\footnotesize W6};
    % platforms
    \pic at (19,0) {platform_left};
    \pic at (19,1) {platform_right};
  }
  {   % signals
    \pic         at ( 7, 0  ) {distant_signal_forward};
    \node[left]  at ( 7,-0.4) {Va};
    \pic         at (10, 0  ) {route_signal_forward};
    \pic         at (10, 0  ) {distant_signal_forward};
    \node[left]  at (10,-0.4) {A};
    \pic         at (18, 1  ) {route_signal_backward};
    \node[right] at (18, 1.4) {P2};
    \pic         at (18, 0  ) {route_signal_backward};
    \node[right] at (18, 0.4) {P1};
    \pic         at (24, 1  ) {route_signal_forward};
    \node[left]  at (24, 0.6) {N2};
    \pic         at (24, 0  ) {route_signal_forward};
    \node[left]  at (24,-0.4) {N1};
    \pic         at (30, 0  ) {route_signal_backward};
    \pic         at (30, 0  ) {distant_signal_backward};
    \node[right] at (30, 0.4) {F};
    \pic         at (33, 0  ) {distant_signal_backward};
    \node[right] at (33, 0.4) {Vf};
    % routes
    \pic at (20,0) {route_backward};
    \pic at (22,0) {route_forward};
    \pic at (20,1) {route_backward};
    \pic at (22,1) {route_forward};
  }
  {   % axle counters
    \pic at (10  , 0) {axle_counter_right};
    \pic at (12.3,-1) {axle_counter_right};
    \pic at (12.8, 0) {axle_counter_right};
    \pic at (13.4, 1) {axle_counter_right};
    \pic at (14.9, 1) {axle_counter_right};
    \pic [rotate=45] at (14.5, 2  ) {axle_counter_right};
    \pic [rotate=45] at (15.9, 0.4) {axle_counter_left};
    \pic at (16  , 0) {axle_counter_right};
    \pic at (18  , 1) {axle_counter_right};
    \pic at (18  , 0) {axle_counter_right};
    \pic at (24  , 1) {axle_counter_right};
    \pic at (24  , 0) {axle_counter_right};
    \pic at (26  , 0) {axle_counter_right};
    \pic at (27.5, 0) {axle_counter_right};
    \pic [rotate=315] at (26.2, 0.8) {axle_counter_left};
    \pic at (30  , 0) {axle_counter_right};
  }
  {   % vehicles
    \pic  at ( 6  ,0) {train_moving_forward};
    \node at ( 4  ,0) {\emph{RB}};
    \pic  at (21.5,2) {train=3};
    \node at (23  ,2) {\emph{WG}};
    \pic  at (10.2,1) {train=1};
    \node at (10.7,1) {\emph{Tfz}};
    \pic  at (34  ,0) {train_moving_backward};
    \node at (36  ,0) {\emph{IC}};
  }
  {   % hectometer posts
    \tikzset{every node/.style={left,base00,rotate=-90},every path/.style={base00,dashed}};
    \node at (07.0,-2.75) { 7.200};
    \draw    (07.0,-1.55) -- ++(0,0.7);
    \node at (10.0,-2.75) { 8.200};
    \draw    (10.0,-1.55) -- ++(0,0.7);
    \node at (12.8,-2.75) { 8.400};
    \draw    (12.8,-1.70) -- ++(0,0.1);
    \draw    (12.8,-0.70) -- ++(0,0.3);
    \node at (16.0,-2.75) { 8.600};
    \draw    (16.0,-1.55) -- ++(0,1.1);
    \node at (18.0,-2.75) { 8.700};
    \draw    (18.0,-1.55) -- ++(0,1.1);
    \node at (19.0,-2.75) { 8.750};
    \draw    (19.0,-1.55) -- ++(0,1.3);
    \node at (23.0,-2.75) { 9.000};
    \draw    (23.0,-1.55) -- ++(0,1.3);
    \node at (24.0,-2.75) { 9.100};
    \draw    (24.0,-1.55) -- ++(0,0.7);
    \node at (26.0,-2.75) { 9.200};
    \draw    (26.0,-1.55) -- ++(0,1.1);
    \node at (27.5,-2.75) { 9.300};
    \draw    (27.5,-1.55) -- ++(0,1.1);
    \node at (30.0,-2.75) { 9.500};
    \draw    (30.0,-1.55) -- ++(0,1.1);
    \node at (33.0,-2.75) {10.500};
    \draw    (33.0,-1.55) -- ++(0,1.3);
  }
  \end{tikzpicture}
\end{document}