summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-trackschematic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-16 22:01:23 +0000
committerKarl Berry <karl@freefriends.org>2020-01-16 22:01:23 +0000
commit027668ae0269a68a604395640ca7ebd51e554c4a (patch)
treec096f005eaf9be6ceb156a46c3d818dbf6c1fa18 /Master/texmf-dist/tex/latex/tikz-trackschematic
parente76d924f69c5d9f65440dbb689b18d3440d80468 (diff)
tikz-trackschematic (16jan20)
git-svn-id: svn://tug.org/texlive/trunk@53426 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-trackschematic')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.code.tex23
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.constructions.code.tex389
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.messures.code.tex253
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.topology.code.tex595
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.trafficcontrol.code.tex606
-rw-r--r--Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.vehicles.code.tex457
6 files changed, 2323 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.code.tex
new file mode 100644
index 00000000000..41e831304bb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.code.tex
@@ -0,0 +1,23 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.code.tex}%
+%
+\RequirePackage{tikz,etoolbox,lmodern}%
+%
+%%%%%%%%%%%%%%%
+% symbol definitions
+%%%%%%%%%%%%%%%
+\usetikzlibrary{trackschematic.topology}%
+\usetikzlibrary{trackschematic.trafficcontrol}%
+\usetikzlibrary{trackschematic.vehicles}%
+\usetikzlibrary{trackschematic.constructions}%
+\usetikzlibrary{trackschematic.messures}%
+% \usetikzlibrary{trackschematic.i18n}%
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.constructions.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.constructions.code.tex
new file mode 100644
index 00000000000..a8713de5119
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.constructions.code.tex
@@ -0,0 +1,389 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.construction.code.tex}%
+%
+%%%%%%%%%%%%%%%
+% global settings
+%%%%%%%%%%%%%%%
+\RequirePackage{tikz,etoolbox,lmodern}%
+\usetikzlibrary{calc}%
+%
+\ifdeflength{\objectlength}{}{% Not defined, so define it!
+ \newlength{\objectlength}%
+}%
+\setlength{\objectlength}{4cm}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys for multiple use
+%%%%%%%%%%%%%%%
+\pgfkeys{%
+ /tikz/trackschematic/.is family,%
+ /tikz/trackschematic/.cd,%
+ %% color foreground
+ foreground/.store in=\foreground,%
+ foreground=black,% DEFAULT
+ /tikz/foreground/.forward to=/tikz/trackschematic/foreground,%
+ %% color background
+ background/.store in=\background,%
+ background=white,% DEFAULT
+ /tikz/background/.forward to=/tikz/trackschematic/background,%
+ %% length
+ length/.store in=\objectlength,% default length 4cm
+ /tikz/length/.forward to=/tikz/trackschematic/length,%
+ %% traffic practice
+ traffic practice/.value required,% left OR right
+ traffic practice/.store in=\trafficpractice,%
+ traffic practice=right,% DEFAULT
+ /tikz/traffic practice/.forward to=/tikz/trackschematic/traffic practice,%
+ /tikz/position/.forward to=/tikz/trackschematic/traffic practice,%
+}%
+\newlength{\objectwidth}\setlength{\objectwidth}{0.5cm}%
+\pgfkeys{%
+ /tikz/trackschematic/constructions/.is family,%
+ /tikz/trackschematic/constructions/.cd,%
+ %% side
+ side/.value required,% left, right OR both
+ side/.store in=\side,% left, right OR both
+ /tikz/side/.forward to=/tikz/trackschematic/constructions/side,%
+ %% width
+ width/.store in=\objectwidth,% default width 0.5cm
+ /tikz/width/.forward to=/tikz/trackschematic/constructions/width,%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol platform
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\platform{}% just for safety
+\def\platform[#1]#2(#3){% \platform[options] at (coord);
+ \pic[#1] at (#3) {platform={#2}}% symbol
+}%
+%% symbol definition
+\tikzset{%
+ pics/platform/.default=,%
+ pics/platform/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ %
+ \ifdefstring{\side}{left}{% side
+ \pgfmathsetmacro{\sidefactor}{1}%
+ }{%
+ \ifdefstring{\side}{right}{% side
+ \pgfmathsetmacro{\sidefactor}{-1}%
+ }{%
+ \ifdefstring{\side}{both}{% side
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/constructions/side}{“left“, “right“ OR “both“ as key required}}%
+ }%
+ }%
+ }% end \ifdefstring{\side}
+ %% platform shape
+ \tikzset{every path/.style={draw=\foreground,line width=0.75pt}};%
+ \ifdefstring{\side}{both}{% double side
+ \path ($-0.5*(\objectlength,0) + (0, \objectwidth)$) --%
+ ($-0.5*(\objectlength,0) + (0, 0.2)$) --%
+ ($ 0.5*(\objectlength,0) + (0, 0.2)$) --%
+ ($ 0.5*(\objectlength,0) + (0, \objectwidth)$);% part 1
+ \path ($-0.5*(\objectlength,0) + (0, 0.3)$) --%
+ ($ 0.5*(\objectlength,0) + (0, 0.3)$);% part 2
+ \path ($-0.5*(\objectlength,0) + (0,-\objectwidth)$) --%
+ ($-0.5*(\objectlength,0) + (0,-0.2)$) --%
+ ($ 0.5*(\objectlength,0) + (0,-0.2)$) --%
+ ($ 0.5*(\objectlength,0) + (0,-\objectwidth)$);% part 3
+ \path ($-0.5*(\objectlength,0) + (0,-0.3)$) --%
+ ($ 0.5*(\objectlength,0) + (0,-0.3)$);% part 4
+ }{% single side
+ \path ($-0.5*(\objectlength,0) + \sidefactor*(0,\objectwidth)$) --%
+ ($-0.5*(\objectlength,0) + \sidefactor*(0,0.2)$) --%
+ ($ 0.5*(\objectlength,0) + \sidefactor*(0,0.2)$) --%
+ ($ 0.5*(\objectlength,0) + \sidefactor*(0,\objectwidth)$);% part 1
+ \path ($-0.5*(\objectlength,0) + \sidefactor*(0,0.3)$) --%
+ ($ 0.5*(\objectlength,0) + \sidefactor*(0,0.3)$);% part 2
+ }%
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol level crossing
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\levelcrossing{}% just for safety
+\def\levelcrossing[#1]#2(#3){% \levelcrossing[options] at (coord);
+ \pic[side=both,#1] at (#3) {level_crossing={#2}}% symbol
+}%
+%% tikz keys
+\newlength{\roadwidth}\setlength{\roadwidth}{0.4cm}%
+\newtoggle{show_road}\settoggle{show_road}{true}%
+\pgfkeys{%
+ /tikz/trackschematic/constructions/level crossing/.is family,%
+ /tikz/trackschematic/constructions/level crossing/.cd,%
+ %% barrier
+ barrier/.store in=\barrier,% full, semi OR none
+ barrier=none,% DEFAULT
+ /tikz/barrier/.forward to=/tikz/trackschematic/constructions/level crossing/barrier,%
+ /tikz/barrier side/.forward to=/tikz/trackschematic/constructions/side,%
+ %% show road
+ no road/.value forbidden,%
+ no road/.code={\settoggle{show_road}{false}},%
+ /tikz/no road/.forward to=/tikz/trackschematic/constructions/level crossing/no road,%
+ %% road width
+ road width/.store in=\roadwidth,% default width 0.4cm
+ /tikz/road width/.forward to=/tikz/trackschematic/constructions/level crossing/road width,%
+}%
+%% symbol definition
+\tikzset{%
+ pics/level_crossing/.default=,%
+ pics/level_crossing/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% symbol
+ \tikzset{every path/.style={draw=\foreground,line width=1pt}};%
+ \iftoggle{show_road}{% true
+ \path ($0.5*(-\roadwidth,0) + (0,-0.1)$) --%
+ ++($(0,-\objectwidth)$);% road part 1
+ \path ($0.5*( \roadwidth,0) + (0,-0.1)$) --%
+ ++($(0,-\objectwidth)$);% road part 2
+ \path ($0.5*(-\roadwidth,0) + (0, 0.1)$) --%
+ ++($(0, \objectwidth)$);% road part 3
+ \path ($0.5*( \roadwidth,0) + (0, 0.1)$) --%
+ ++($(0, \objectwidth)$);% road part 4
+ }{}% END \iftoggle{show_road}
+ \ifdefstring{\barrier}{full}{% full barrier
+ \ifdefstring{\side}{both}{%
+ \filldraw[\foreground]% left barrier part 1
+ ($(-0.5\roadwidth,0)+(-0.2,0)+(0,0.35)$) circle (0.05);%
+ \filldraw[\foreground]% left barrier part 2
+ ($( 0.5\roadwidth,0)+( 0.2,0)+(0,0.35)$) circle (0.05);%
+ \path ($(-0.5\roadwidth,0)+(-0.2,0)+(0,0.35)$) --%
+ ++($( 0.45\roadwidth,0)+( 0.2,0)$);% left barrier part 3
+ \path ($( 0.5\roadwidth,0)+( 0.2,0)+(0,0.35)$) --%
+ ++($(-0.45\roadwidth,0)+(-0.2,0)$);% left barrier part 4
+ %
+ \filldraw[\foreground]% right barrier part 1
+ ($( 0.5\roadwidth,0)+( 0.2,0)+(0,-0.35)$) circle (0.05);%
+ \filldraw[\foreground]% right barrier part 2
+ ($(-0.5\roadwidth,0)+(-0.2,0)+(0,-0.35)$) circle (0.05);%
+ \path ($( 0.5\roadwidth,0)+( 0.2,0)+(0,-0.35)$) --%
+ ++($(-0.45\roadwidth,0)+(-0.2,0)$);% right barrier part 3
+ \path ($(-0.5\roadwidth,0)+(-0.2,0)+(0,-0.35)$) --%
+ ++($( 0.45\roadwidth,0)+( 0.2,0)$);% right barrier part 4
+ }{%
+ \ifdefstring{\side}{left}{%
+ \filldraw[\foreground]% left barrier part 1
+ ($(-0.5\roadwidth,0)+(-0.2,0)+(0,0.35)$) circle (0.05);%
+ \filldraw[\foreground]% left barrier part 2
+ ($( 0.5\roadwidth,0)+( 0.2,0)+(0,0.35)$) circle (0.05);%
+ \path ($(-0.5\roadwidth,0)+(-0.2,0)+(0,0.35)$) --%
+ ++($( 0.45\roadwidth,0)+( 0.2,0)$);% left barrier part 3
+ \path ($( 0.5\roadwidth,0)+( 0.2,0)+(0,0.35)$) --%
+ ++($(-0.45\roadwidth,0)+(-0.2,0)$);% left barrier part 4
+ }{%
+ \ifdefstring{\side}{right}{%
+ \filldraw[\foreground]% right barrier part 1
+ ($( 0.5\roadwidth,0)+( 0.2,0)+(0,-0.35)$) circle (0.05);%
+ \filldraw[\foreground]% right barrier part 2
+ ($(-0.5\roadwidth,0)+(-0.2,0)+(0,-0.35)$) circle (0.05);%
+ \path ($( 0.5\roadwidth,0)+( 0.2,0)+(0,-0.35)$) --%
+ ++($(-0.45\roadwidth,0)+(-0.2,0)$);% right barrier part 3
+ \path ($(-0.5\roadwidth,0)+(-0.2,0)+(0,-0.35)$) --%
+ ++($( 0.45\roadwidth,0)+( 0.2,0)$);% right barrier part 4
+ }{%% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/constructions/side}{“left“, “right“ OR “both“ as key required}}%
+ }% END \ifdefstring{\side}{right}
+ }% END \ifdefstring{\side}{left}
+ }% END \ifdefstring{\side}{both}
+ }{%
+ \ifdefstring{\barrier}{semi}{% semi barrier
+ \ifdefstring{\side}{both}{%
+ \filldraw[\foreground]% left barrier part 1
+ ($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)+(0,0.35)$) circle (0.05);%
+ \path ($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)+(0,0.35)$) --%
+ ++($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)$);% left barrier part 2
+ %
+ \filldraw[\foreground]% right barrier part 1
+ ($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)+(0,-0.35)$) circle (0.05);%
+ \path ($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)+(0,-0.35)$) --%
+ ++($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)$);% right barrier part 2
+ }{%
+ \ifdefstring{\side}{left}{%
+ \filldraw[\foreground]% left barrier part 1
+ ($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)+(0,0.35)$) circle (0.05);%
+ \path ($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)+(0,0.35)$) --%
+ ++($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)$);% left barrier part 2
+ }{%
+ \ifdefstring{\side}{right}{%
+ \filldraw[\foreground]% right barrier part 1
+ ($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)+(0,-0.35)$) circle (0.05);%
+ \path ($\trafficfactor*(0.5\roadwidth,0)+\trafficfactor*(0.2,0)+(0,-0.35)$) --%
+ ++($\trafficfactor*(-0.5\roadwidth,0)+\trafficfactor*(-0.2,0)$);% right barrier part 2
+ }{%% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/constructions/side}{“left“, “right“ OR “both“ as key required}}%
+ }% END \ifdefstring{\side}{right}
+ }% END \ifdefstring{\side}{left}
+ }% END \ifdefstring{\side}{both}
+ }{%
+ \ifdefstring{\barrier}{none}{% no barriers
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/constructions/level crossing/barrier}{“full“, “semi“ OR “none“ as key required}}%
+ }%
+ }% END \ifdefstring{\barrier}{semi}
+ }% END \ifdefstring{\barrier}{full}
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol bridge
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\bridge{}% just for safety
+\def\bridge[#1]#2(#3){% \bridge[options] at (coord);
+ \pic[side=both,#1] at (#3) {bridge={#2}}% symbol
+}%
+\newlength{\shiftleft}\setlength{\shiftleft}{0cm}%
+\newlength{\shiftright}\setlength{\shiftright}{0cm}%
+\newtoggle{show_background}\settoggle{show_background}{true}%
+%% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/constructions/bridge/.is family,%
+ /tikz/trackschematic/constructions/bridge/.cd,%
+ % shift
+ shift left/.store in=\shiftleft,% default shift 0cm
+ /tikz/shift left/.forward to=/tikz/trackschematic/constructions/bridge/shift left,%
+ shift right/.store in=\shiftright,% default shift 0cm
+ /tikz/shift right/.forward to=/tikz/trackschematic/constructions/bridge/shift right,%
+ %% show road
+ no background/.value forbidden,%
+ no background/.code={\settoggle{show_background}{false}},%
+ /tikz/no background/.forward to=/tikz/trackschematic/constructions/bridge/no background,%
+}%
+%% symbol definition
+\tikzset{%
+ pics/bridge/.default=,%
+ pics/bridge/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% symbol
+ \iftoggle{show_background}{% true
+ \fill[\background]%
+ ($(-0.5\objectlength,\objectwidth)+(0,-0.1)$) rectangle%
+ ($(0.5\objectlength,-\objectwidth)+(0,0.1)$);%
+ }{}%
+ \tikzset{every path/.style={draw=\foreground,line width=0.75pt}};%
+ \ifdefstring{\side}{both}{%
+ \path ($-0.5*(\objectlength,0)+(-0.1,0)+(\shiftleft,\objectwidth)$) --%
+ ++($(0.1,-0.1)$) --%
+ ++($(\objectlength,0)$) --%
+ ++($(0.1,0.1)$);% left bridge
+ \path ($-0.5*(\objectlength,0)+(-0.1,0)+(\shiftright,-\objectwidth)$) --%
+ ++($(0.1,0.1)$) --%
+ ++($(\objectlength,0)$) --%
+ ++($(0.1,-0.1)$);% right bridge
+ }{%
+ \ifdefstring{\side}{left}{%
+ \path ($-0.5*(\objectlength,0)+(-0.1,0)+(\shiftleft,\objectwidth)$) --%
+ ++($(0.1,-0.1)$) --%
+ ++($(\objectlength,0)$) --%
+ ++($(0.1,0.1)$);% left bridge
+ }{%
+ \ifdefstring{\side}{right}{%
+ \path ($-0.5*(\objectlength,0)+(-0.1,0)+(\shiftright,-\objectwidth)$) --%
+ ++($(0.1,0.1)$) --%
+ ++($(\objectlength,0)$) --%
+ ++($(0.1,-0.1)$);% right bridge
+ }{%% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/constructions/side}{“left“, “right“ OR “both“ as key required}}%
+ }% END \ifdefstring{\side}{right}
+ }% END \ifdefstring{\side}{left}
+ }% END \ifdefstring{\side}{both}
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol interlocking
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\interlocking{}% just for safety
+\def\interlocking#1(#2){% \interlocking at (coord);
+ \pic at (#2) {interlocking={#1}}% symbol
+}%
+%% tikz keys
+% \pgfkeys{%
+% /tikz/trackschematic/.is family,%
+% /tikz/trackschematic/.cd,%
+% }%
+%% symbol definition
+\tikzset{%
+ pics/interlocking/.default=,%
+ pics/interlocking/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% symbol
+ \tikzset{every path/.style={draw=\foreground,line width=1pt}};%
+ \path (-0.6,-0.4 ) rectangle ++(1.2,0.8); % building
+ \path[fill=\foreground] (-0.5,-0.3 ) rectangle ++(1.0,0.2); % table
+ \path[fill=\foreground] ( 0 , 0.15) circle (0.15); % human dot
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol hump
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\hump{}% just for safety
+\def\hump#1(#2){% \hump at (coord);
+ \pic at (#2) {hump={#1}}% symbol
+}%
+%% tikz keys
+% \pgfkeys{%
+% /tikz/trackschematic/.is family,%
+% /tikz/trackschematic/.cd,%
+% }%
+%% symbol definition
+\tikzset{%
+ pics/hump/.default=,%
+ pics/hump/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% symbol
+ \tikzset{every path/.style={draw=\foreground,line width=0.75pt}};%
+ % left side
+ \path (-0.3, 0.1) -- ++(0,0.05);
+ \path (-0.2, 0.1) -- ++(0,0.15);
+ \path (-0.1, 0.1) -- ++(0,0.25);
+ \path ( 0.0, 0.1) -- ++(0,0.35);
+ \path ( 0.1, 0.1) -- ++(0,0.25);
+ \path ( 0.2, 0.1) -- ++(0,0.15);
+ \path ( 0.3, 0.1) -- ++(0,0.05);
+ % right side
+ \path (-0.3,-0.1) -- ++(0,-0.05);
+ \path (-0.2,-0.1) -- ++(0,-0.15);
+ \path (-0.1,-0.1) -- ++(0,-0.25);
+ \path ( 0.0,-0.1) -- ++(0,-0.35);
+ \path ( 0.1,-0.1) -- ++(0,-0.25);
+ \path ( 0.2,-0.1) -- ++(0,-0.15);
+ \path ( 0.3,-0.1) -- ++(0,-0.05);
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.messures.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.messures.code.tex
new file mode 100644
index 00000000000..290701b919f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.messures.code.tex
@@ -0,0 +1,253 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.messures.code.tex}%
+%
+%%%%%%%%%%%%%%%
+% global settings
+%%%%%%%%%%%%%%%
+\RequirePackage{tikz,etoolbox,lmodern}%
+\usetikzlibrary{calc,intersections,arrows.meta}%
+%
+% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz
+\providecommand{\gettikzxy}[3]{%
+ \tikz@scan@one@point\pgfutil@firstofone#1\relax%
+ \edef#2{\the\pgf@x}%
+ \edef#3{\the\pgf@y}%
+}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys for multiple use
+%%%%%%%%%%%%%%%
+\ifdeflength{\objectlength}{}{% Not defined, so define it!
+ \newlength{\objectlength}%
+}%
+\setlength{\objectlength}{4cm}%
+%
+\pgfkeys{%
+ /tikz/trackschematic/.is family,%
+ /tikz/trackschematic/.cd,%
+ %% color foreground
+ foreground/.store in=\foreground,%
+ foreground=black,% DEFAULT
+ /tikz/foreground/.forward to=/tikz/trackschematic/foreground,%
+ %% color background
+ background/.store in=\background,%
+ background=white,% DEFAULT
+ /tikz/background/.forward to=/tikz/trackschematic/background,%
+ %% face
+ face/.value required,% forward, backward OR bidirectional
+ face/.store in=\face,% forward, backward OR bidirectional
+ /tikz/face/.forward to=/tikz/trackschematic/face,%
+ /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
+ /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
+ /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
+ %% length
+ length/.store in=\objectlength,% default length 4cm
+ /tikz/length/.forward to=/tikz/trackschematic/length,%
+ %% traffic practice
+ traffic practice/.value required,% left OR right
+ traffic practice/.store in=\trafficpractice,%
+ /tikz/traffic practice/.forward to=/tikz/trackschematic/traffic practice,%
+ /tikz/position/.forward to=/tikz/trackschematic/traffic practice,%
+ %% label
+ shift label/.store in=\labelcoord,% (coord)
+ shift label=(none),% DEFAULT
+ /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
+}%
+\tikzset{traffic practice=right}%
+%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/messures/.is family,%
+ /tikz/trackschematic/messures/.cd,%
+ %% color hectometer
+ color/.store in=\hectometercolor,%
+ color=\foreground!50!\background,% DEFAULT
+ /tikz/hectometer color/.forward to=/tikz/trackschematic/messures/color,%
+}%
+%%%%%%%%%%%%%%%%
+% symbol train berth
+%%%%%%%%%%%%%%%
+%% command
+\newcommand\berth{}% just for safety
+\def\berth[#1]#2(#3)#4(#5){% \berth[options] at (coord) length (usable length);
+ \pic[#1] at (#3) {train_berth={#2/#4/#5}}% symbol
+}%
+%%
+%% symbol definition
+\tikzset{%
+ pics/train_berth/.default=,%
+ pics/train_berth/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% face setup
+ \ifdefstring{\face}{bidirectional}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“, “backward“ OR “bidirectional“ as key required}}%
+ }%
+ }%
+ }% end \ifdefstring{\face}
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %
+ \tikzset{every path/.style={draw=\foreground,line width=0.75pt,line cap=round,dash pattern=on 0pt off 2.4\pgflinewidth}};%
+ \path% berth shape forward
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.25)$) --%
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$)%
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.35) + (\pgflinewidth,0)$) --%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$)%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.25)$) --%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$);% berth shape forward
+ \path[draw=none,fill=\foreground]% arrow front
+ ($\facefactor*0.5*(\objectlength,0) + \facefactor*(-0.1,0) + \trafficfactor*\facefactor*(0,-0.35)$) --%
+ ++($(0,-0.04) + \facefactor*(-0.1,0)$) -- ++(0,0.08) -- cycle;% arrow
+ \path[draw=none,fill=\foreground]% arrow back
+ ($\facefactor*-0.5*(\objectlength,0) + \facefactor*(0.2,0) + \trafficfactor*\facefactor*(0,-0.35)$) --%
+ ++($(0,-0.04) + \facefactor*(-0.1,0)$) -- ++(0,0.08) -- cycle;% arrow
+ \ifdefstring{\face}{bidirectional}{% bidirectional
+ \pgfmathsetmacro{\facefactor}{-1}%
+ \path% berth shape forward
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.25)$) --%
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$)%
+ ($-0.5*(\objectlength,0) + (-0.05,0) + \trafficfactor*\facefactor*(0,-0.35) + (\pgflinewidth,0)$) --%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$)%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.25)$) --%
+ ($ 0.5*(\objectlength,0) + ( 0.05,0) + \trafficfactor*\facefactor*(0,-0.35)$);% berth shape forward
+ \path[draw=none,fill=\foreground]% arrow front
+ ($\facefactor*0.5*(\objectlength,0) + \facefactor*(-0.1,0) + \trafficfactor*\facefactor*(0,-0.35)$) --%
+ ++($(0,-0.04) + \facefactor*(-0.1,0)$) -- ++(0,0.08) -- cycle;% arrow
+ \path[draw=none,fill=\foreground]% arrow back
+ ($\facefactor*-0.5*(\objectlength,0) + \facefactor*(0.2,0) + \trafficfactor*\facefactor*(0,-0.35)$) --%
+ ++($(0,-0.04) + \facefactor*(-0.1,0)$) -- ++(0,0.08) -- cycle;% arrow
+ }{}%
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \node[fill=\background,text=\foreground,inner sep=1pt] at ($\facefactor*(0,-0.35)$) {\tiny \labelcontent};%
+ \ifdefstring{\face}{bidirectional}{% bidirectional
+ \pgfmathsetmacro{\facefactor}{1}%
+ \node[fill=\background,text=\foreground,inner sep=1pt] at ($\facefactor*(0,-0.35)$) {\tiny \labelcontent};%
+ }{}%
+ }%
+ }},% end pics/train_berth/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol track distance
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\trackdistance{}% just for safety
+\def\trackdistance#1(#2)#3(#4)#5(#6){% \trackdistance between (coord1) and (coord2) label (distance);
+ \path[draw=\background,<->,>={Stealth[\foreground,inset=0pt,angle=50:0.2cm]},shorten <=1pt,shorten >=1pt] (#2) -- (#4)% arrow tips
+ node[hectometer base=(current bounding box.center),text=\foreground,midway,sloped,rotate=90] {#6};% label
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol hectometer posts
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\hectometer{}% just for safety
+\def\hectometer[#1]#2(#3)#4(#5){% \hectometer[options] at (coord) label (name);
+ \pic[#1] at (#3) {hectometer_posts={#2/#4/#5}}% symbol
+}%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/messures/hectometer/.is family,%
+ /tikz/trackschematic/messures/hectometer/.cd,%
+ %% hectometer base
+ base/.value required,%
+ base/.store in=\basecoord,%
+ /tikz/hectometer base/.forward to=/tikz/trackschematic/messures/hectometer/base,%
+ %% hectometer base
+ orientation/.value required,%
+ orientation/.store in=\orientation,%
+ /tikz/orientation/.forward to=/tikz/trackschematic/messures/hectometer/orientation,%
+}%
+%% symbol definition
+\tikzset{%
+ pics/hectometer_posts/.default=,%
+ pics/hectometer_posts/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %
+ \gettikzxy{\basecoord}{\basecoordX}{\basecoordY}%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ }
+ %% orientation setup
+ \ifdefstring{\orientation}{left}{% orientation
+ \def\align{right}%
+ }{%
+ \ifdefstring{\orientation}{right}{% orientation
+ \def\align{left}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/messures/hectometer/orientation}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\orientation}
+ %% calculation of coordinates
+ %%
+ %% bend 1 bend 2
+ %% (0,0.75) (ts-hm-b1) (ts-hm-b2)
+ %% (0,0)• • ------- • --------- • ----- •(ts-hm-l) label
+ %%
+ \coordinate (ts-hm-l) at (0,\basecoordY);%
+ \ifdefstring{\labelcoord}{(none)}{%
+ \coordinate (ts-hm-b1) at (ts-hm-l);%
+ \coordinate (ts-hm-b2) at (ts-hm-l);%
+ }{% initialize if NOT default
+ \coordinate (ts-hm-b1) at ($(ts-hm-l) + (0,0.5)$);%
+ \coordinate (ts-hm-b2) at ($(ts-hm-l) + (\labelcoordX,0.25)$);%
+ \coordinate (ts-hm-l) at ($(ts-hm-l) + (\labelcoordX,\labelcoordY)$);%
+ }%
+ %% symbol
+ \path[draw=\hectometercolor,dashed,shorten <=0.75cm]%
+ (0,0) -- (ts-hm-b1) -- (ts-hm-b2) -- (ts-hm-l);%
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \node[font=\sffamily,text=\hectometercolor,rotate=-90,\orientation,align=\align,fill=\background] at (ts-hm-l) {\labelcontent};%
+ }%
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol messureline
+%%%%%%%%%%%%%%%
+%
+% command
+\newcommand\messureline{}% just for safety
+\def\messureline{\path[MessureLine]}% \maintrack (coord1) -- (coord2);
+%
+\tikzset{MessureLine/.style={draw=\hectometercolor,dashed,shorten <=0.75cm,shorten >=0.75cm}}%
+%
+%%%%%%%%%%%%%%%
+% TODO:
+% * platform length
+% * direction of milage
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.topology.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.topology.code.tex
new file mode 100644
index 00000000000..8ca7a669828
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.topology.code.tex
@@ -0,0 +1,595 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.topology.code.tex}%
+%
+%%%%%%%%%%%%%%%
+% Requirements
+%%%%%%%%%%%%%%%
+\RequirePackage{tikz,etoolbox,lmodern}%
+\usetikzlibrary{calc,patterns}%
+%
+% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz
+\providecommand{\gettikzxy}[3]{%
+ \tikz@scan@one@point\pgfutil@firstofone#1\relax%
+ \edef#2{\the\pgf@x}%
+ \edef#3{\the\pgf@y}%
+}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys for multiple use
+%%%%%%%%%%%%%%%
+\pgfkeys{%
+ /tikz/trackschematic/.is family,%
+ /tikz/trackschematic/.cd,%
+ %% color foreground
+ foreground/.store in=\foreground,%
+ foreground=black,% DEFAULT
+ /tikz/foreground/.forward to=/tikz/trackschematic/foreground,%
+ %% color background
+ background/.store in=\background,%
+ background=white,% DEFAULT
+ /tikz/background/.forward to=/tikz/trackschematic/background,%
+ %% face
+ face/.value required,% forward OR backward
+ face/.store in=\face,%
+ /tikz/face/.forward to=/tikz/trackschematic/face,%
+ /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
+ /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
+ /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
+ %% operation
+ operation mode/.store in=\operationmode,% manual, remote OR none
+ operation mode=none,% DEFAULT
+ /tikz/operation/.forward to=/tikz/trackschematic/operation mode,%
+ %% label
+ shift label/.store in=\labelcoord,% (coord)
+ shift label=(none),% DEFAULT
+ /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
+}%
+%
+\pgfkeys{%
+ /tikz/trackschematic/topology/.is family,%
+ /tikz/trackschematic/topology/.cd,%
+ %% branch
+ branch/.value required,% left OR right
+ branch/.store in=\branch,% left OR right
+ /tikz/branch/.forward to=/tikz/trackschematic/topology/branch,%
+ %% fouling point
+ fouling point/.value forbidden,%
+ fouling point/.code={\settoggle{fouling_point}{true}},%
+ /tikz/fouling point/.forward to=/tikz/trackschematic/topology/fouling point,%
+ %% points
+ points/.store in=\points,% moving, left, right OR none
+ points=none,% DEFAULT
+ /tikz/points/.forward to=/tikz/trackschematic/topology/points,%
+}%
+% options
+\newtoggle{fouling_point}\settoggle{fouling_point}{false}%
+%
+%%%%%%%%%%%%%%%
+% symbol track
+%%%%%%%%%%%%%%%
+%
+% tracks
+\newcommand\maintrack{}% just for safety
+\def\maintrack{\path[draw,MainTrack]}% \maintrack (coord1) -- (coord2);
+\newcommand\secondarytrack{}% just for safety
+\def\secondarytrack{\path[draw,SecondaryTrack]}% \secondarytrack (coord1) -- (coord2);
+\newcommand\sidetrack{}% just for safety
+\def\sidetrack{\path[draw,SecondaryTrack]}% alias for \secondarytrack
+%
+\tikzset{MainTrack/.style={line width=2pt,\foreground}}%
+\tikzset{SecondaryTrack/.style={line width=0.7pt,\foreground}}%
+%
+%%%%%%%%%%%%%%%
+% symbol track number
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\tracklabel{}% just for safety
+\def\tracklabel#1(#2)#3(#4){% \tracklabel at (coord) label (name);
+ \pic at (#2) {track_label={#1/#3/#4}}% symbol
+}%
+%% tikz keys
+% \pgfkeys{%
+% /tikz/trackschematic/.is family,%
+% /tikz/trackschematic/.cd,%
+% }%
+%% symbol definition
+\tikzset{%
+ pics/track_label/.default=,%
+ pics/track_label/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ \def\labelcommand{#2} % beware of leading and tailing spaces!
+ \def\labelcontent{#3}
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={fill=\background,text=\foreground}};%
+ \coordinate (ts-tl-l) at (0,0);%
+ \ifdefstring{\labelcoord}{(none)}{% default coord
+ }{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-tl-l) at ($(ts-tl-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node at (ts-tl-l) {\labelcontent};%
+ }%
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol buffer stop
+%%%%%%%%%%%%%%%
+%
+% command
+\newcommand\bufferstop{}% just for safety
+\def\bufferstop[#1]#2(#3){% \bufferstop[options] at (coord);
+ \pic[#1] at (#3) {bufferstop={#2}}% symbol
+}%
+\newlength{\friction}\setlength{\friction}{0.5cm}
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/topology/bufferstop/.is family,%
+ /tikz/trackschematic/topology/bufferstop/.cd,%
+ %% friction
+ friction/.store in=\friction,% length OR none
+ friction=none,% length OR none
+ /tikz/friction/.forward to=/tikz/trackschematic/topology/bufferstop/friction,%
+}%
+% symbol definition
+\tikzset{%
+ pics/bufferstop/.default=,%
+ pics/bufferstop/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% symbol
+ \ifdefstring{\friction}{none}{% friction
+ \path[draw=\foreground, line width=1pt] ($\facefactor*(-0.1,0) + (0,0.2)$) -- ++($\facefactor*( 0.1,0)$) -- ++(0,-0.4) -- ++ ($\facefactor*(-0.1,0)$); % bufferstop marker
+ }{
+ \path[draw=\foreground, line width=1pt] ($\facefactor*(-\friction,0) + \facefactor*( 0.1,0) + (0,0.2)$) -- ++($\facefactor*(-0.1,0)$) -- ++(0,-0.4) -- ++ ($\facefactor*( 0.1,0)$); % bufferstop marker
+ \fill[\foreground] (0,0) circle (0.06);% track closure indicator
+ }
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol track closure
+%%%%%%%%%%%%%%%
+%
+%% command
+\newcommand\trackclosure{}% just for safety
+\def\trackclosure#1(#2){% \trackclosure at (coord);
+ \pic at (#2) {track_closure={#1}}% symbol
+}%
+\tikzset{%
+ pics/track_closure/.default=,%
+ pics/track_closure/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %%
+ \fill[\foreground] (0,0) circle (0.06);% track closure indicator
+ % \path[fill=\foreground] (0.04,0.02) -- (0.04,-0.02) -- (0.02,-0.04) -- (-0.02,-0.04) -- (-0.04,-0.02) -- (-0.04,0.02) -- (-0.02,0.04) -- (0.02,0.04) -- cycle;% label
+ }},% end pics/track_closure/.style args={#1}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol turnout
+%%%%%%%%%%%%%%%
+%
+% command
+\newcommand\turnout{}% just for safety
+\def\turnout[#1]#2(#3)#4(#5){% \turnout[options] at (coord) label (name);
+ \pic[operation=remote,#1] at (#3) {turnout={#2/#4/#5}}% symbol
+}%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/topology/turnout/.is family,%
+ /tikz/trackschematic/topology/turnout/.cd,%
+ %% points
+ points/.store in=\points,% moving, left, right OR none
+ points=none,% moving, left, right OR none
+ /tikz/points/.forward to=/tikz/trackschematic/topology/turnout/points,%
+}%
+% symbol definition
+\tikzset{%
+ pics/turnout/.default=,%
+ pics/turnout/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% branch setup
+ \ifdefstring{\branch}{left}{% branch
+ \pgfmathsetmacro{\branchfactor}{1}%
+ }{%
+ \ifdefstring{\branch}{right}{% branch
+ \pgfmathsetmacro{\branchfactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\branch}
+ %% turnout marker
+ \ifdefstring{\operationmode}{manual}{% operation=manual
+ \ifdefstring{\face}{forward}{%
+ \ifdefstring{\branch}{left}{% branch
+ \def\patterntype{north west lines}%
+ }{%
+ \def\patterntype{north east lines}%
+ }%
+ }{%
+ \ifdefstring{\branch}{right}{% branch
+ \def\patterntype{north west lines}%
+ }{%
+ \def\patterntype{north east lines}%
+ }%
+ }%
+ \path[draw=\foreground,pattern=\patterntype, pattern color=\foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker
+ }{%
+ \ifdefstring{\operationmode}{remote}{% operation=remote
+ \path[fill=\foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker
+ }{%
+ \ifdefstring{\operationmode}{none}{
+ \path[draw=\foreground] (0,0) -- ++($\facefactor*(0.4,0)$) -- ++($\branchfactor*(0,0.4)$) -- cycle;% turnout marker
+ }{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “remote“ OR “none“ as key required}}%
+ }%
+ }
+ }%
+ %
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={text=\foreground}};%
+ \coordinate (ts-y-l) at ($\branchfactor*(0,-8pt)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-y-l) at ($(ts-y-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node at (ts-y-l) {\footnotesize \labelcontent};%
+ }%
+ %
+ %% fouling point indicator
+ \iftoggle{fouling_point}{%
+ \path[draw=\foreground] ($\facefactor*(0.7,0)$) -- ++($\branchfactor*(0,0.7)$);% fouling point indicator
+ }{}%
+ %
+ %% points
+ \ifdefstring{\points}{left}{% points left
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] ($\facefactor*(-0.035,0)+(0,0.1)$) -- ++($\facefactor*(0.2,0)+(0,0.2)$);%
+ }{%
+ \path[draw=\foreground,line width=1.5pt] ($\facefactor*( 0.035,0)+(0,0.1)$) -- ++($\facefactor*( 0.265,0 )$);%
+ }%
+ }{%
+ \ifdefstring{\points}{right}{% points right
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] ($\facefactor*( 0.035,0)+(0,-0.1)$) -- ++($\facefactor*( 0.265,0 )$);%
+ }{%
+ \path[draw=\foreground,line width=1.5pt] ($\facefactor*(-0.035,0)+(0,-0.1)$) -- ++($\facefactor*(0.2,0)+(0,-0.2)$);%
+ }%
+ }{%
+ \ifdefstring{\points}{moving}{% moving points
+ \fill[\foreground] ($\facefactor*(0.075,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($\facefactor*(0.225,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($\facefactor*(0.015,0) + \branchfactor*(0, 0.15)$) circle (0.05);% points indicator right
+ \fill[\foreground] ($\facefactor*(0.115,0) + \branchfactor*(0, 0.25)$) circle (0.05);% points indicator right
+ }{% error message
+ \ifdefstring{\points}{none}{%
+ }{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/turnout/points}{“left“, “right“ OR “moving“ as key required}}%
+ }%
+ }%
+ }%
+ }% end \ifdefstring{\points}
+ %
+ }},% end pics/turnout/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol slip switch turnout - using parts of turnout
+%%%%%%%%%%%%%%%
+%
+\newcommand\slipturnout{}% just for safety
+\def\slipturnout[#1]#2(#3)#4(#5)(#6){% \slipturnout[options] at (coord) label (name1)(name2);
+ \pic[operation=remote,slip=double,#1] at (#3) {slipturnout={#2/#4/#5/#6}}% symbol
+}%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/topology/slipturnout/.is family,%
+ /tikz/trackschematic/topology/slipturnout/.cd,%
+ %% points
+ forward points/.store in=\forwardpoints,% moving, left, right OR none
+ forward points=none,% moving, left, right OR none
+ /tikz/forward points/.forward to=/tikz/trackschematic/topology/slipturnout/forward points,%
+ backward points/.store in=\backwardpoints,% moving, left, right OR none
+ backward points=none,% moving, left, right OR none
+ /tikz/backward points/.forward to=/tikz/trackschematic/topology/slipturnout/backward points,%
+ %% slips
+ slip/.store in=\slip,% double, left, right OR none
+ slip=none,% double, left, right OR none
+ /tikz/slip/.forward to=/tikz/trackschematic/topology/slipturnout/slip,%
+}%
+% symbol definition
+\tikzset{%
+ pics/slipturnout/.default=,%
+ pics/slipturnout/.style args={#1/#2/#3/#4}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontentleft{#3}%
+ \def\labelcontentright{#4}%
+ %% branch setup
+ \ifdefstring{\branch}{left}{% branch
+ \pgfmathsetmacro{\branchfactor}{1}%
+ }{%
+ \ifdefstring{\branch}{right}{% branch
+ \pgfmathsetmacro{\branchfactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\branch}
+ %% turnout marker
+ \ifdefstring{\operationmode}{manual}{% operation=manual
+ \ifdefstring{\branch}{left}{% branch
+ \def\patterntype{north west lines}%
+ }{%
+ \def\patterntype{north east lines}%
+ }%
+ \path[draw,pattern=\patterntype, pattern color=\foreground] (0,0) -- ++($( 0.4,0)$) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker
+ \path[draw,pattern=\patterntype, pattern color=\foreground] (0,0) -- ++($(-0.4,0)$) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker
+ }{% operated automaticly
+ \ifdefstring{\operationmode}{remote}{% operation=remote
+ \path[fill=\foreground] (0,0) -- ++($( 0.4,0)$) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker
+ \path[fill=\foreground] (0,0) -- ++($(-0.4,0)$) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker
+ }{%
+ \ifdefstring{\operationmode}{none}{}{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “remote“ OR “none“ as key required}}%
+ }%
+ }%
+ }%
+ %
+ %% label
+ \tikzset{every node/.style={text=\foreground}};%
+ \ifdefstring{\labelcontentleft}{}{}{% label NOT empty
+ \coordinate (ts-sy-l1) at ($(2pt,0) + \branchfactor*(0, 10pt)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-sy-l1) at ($(ts-sy-l1)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[left] at (ts-sy-l1) {\footnotesize \labelcontentleft};%
+ }%
+ \ifdefstring{\labelcontentright}{}{}{% label NOT empty
+ \coordinate (ts-sy-l2) at ($(2pt,0) + \branchfactor*(0,-10pt)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-sy-l2) at ($(ts-sy-l2)-(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[right] at (ts-sy-l2) {\footnotesize \labelcontentright};%
+ }%
+ %
+ %% fouling point indicator
+ \iftoggle{fouling_point}{%
+ \path[draw=\foreground] ( 0.7,0) -- ++($\branchfactor*(0, 0.7)$);% fouling point indicator
+ \path[draw=\foreground] (-0.7,0) -- ++($\branchfactor*(0,-0.7)$);% fouling point indicator
+ }{}%
+ %
+ %% points
+ \ifdefstring{\forwardpoints}{left}{% points left
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] (-0.035,0.1) -- ++(0.2,0.2);%
+ }{%
+ \path[draw=\foreground,line width=1.5pt] ( 0.035,0.1) -- ++(0.265,0);%
+ }%
+ }{%
+ \ifdefstring{\forwardpoints}{right}{% points right
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] ( 0.035,-0.1) -- ++(0.265,0);
+ }{%
+ \path[draw=\foreground,line width=1.5pt] (-0.035,-0.1) -- ++(0.2,-0.2);%
+ }%
+ }{%
+ \ifdefstring{\forwardpoints}{moving}{% moving points
+ \fill[\foreground] ($(0.075,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($(0.225,0) + \branchfactor*(0,-0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($(0.015,0) + \branchfactor*(0, 0.15)$) circle (0.05);% points indicator right
+ \fill[\foreground] ($(0.115,0) + \branchfactor*(0, 0.25)$) circle (0.05);% points indicator right
+ }{% error message
+ \ifdefstring{\forwardpoints}{none}{%
+ }{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/forward points}{“left“, “right“ OR “moving“ as key required}}%
+ }%
+ }%
+ }%
+ }% end of \ifdefstring{\forwardpoints}
+ \ifdefstring{\backwardpoints}{left}{% points left
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] (0.035,-0.1) -- ++(-0.2,-0.2);%
+ }{%
+ \path[draw=\foreground,line width=1.5pt] (-0.035,-0.1) -- ++(-0.265,0);%
+ }%
+ }{%
+ \ifdefstring{\backwardpoints}{right}{% points right
+ \ifdefstring{\branch}{left}{%
+ \path[draw=\foreground,line width=1.5pt] (-0.035,0.1) -- ++(-0.265,0);
+ }{%
+ \path[draw=\foreground,line width=1.5pt] (0.035,0.1) -- ++(-0.2,0.2);%
+ }%
+ }{%
+ \ifdefstring{\backwardpoints}{moving}{% moving points
+ \fill[\foreground] ($(-0.075,0) + \branchfactor*(0, 0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($(-0.225,0) + \branchfactor*(0, 0.1 )$) circle (0.05);% points indicator left
+ \fill[\foreground] ($(-0.015,0) + \branchfactor*(0,-0.15)$) circle (0.05);% points indicator right
+ \fill[\foreground] ($(-0.115,0) + \branchfactor*(0,-0.25)$) circle (0.05);% points indicator right
+ }{% error message
+ \ifdefstring{\backwardpoints}{none}{%
+ }{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/forward points}{“left“, “right“ OR “moving“ as key required}}%
+ }%
+ }%
+ }%
+ }% end of \ifdefstring{\backwardpoints}
+ %
+ %% slips
+ \ifdefstring{\slip}{double}{% slip
+ \path[draw=\foreground,line width=0.75pt] ($\branchfactor*(-0.4,0) + (0, 0.1)$) -- ($\branchfactor*( 0.3,0) + (0, 0.4)$);% slip
+ \path[draw=\foreground,line width=0.75pt] ($\branchfactor*( 0.4,0) + (0,-0.1)$) -- ($\branchfactor*(-0.3,0) + (0,-0.4)$);% slip
+ }{%
+ \ifdefstring{\slip}{left}{%
+ \path[draw=\foreground,line width=0.75pt] ($\branchfactor*(-0.4,0) + (0,0.1)$) -- ($\branchfactor*(0.3,0) + (0,0.4)$);% slip
+ }{%
+ \ifdefstring{\slip}{right}{%
+ \path[draw=\foreground,line width=0.75pt] ($\branchfactor*(0.4,0) + (0,-0.1)$) -- ($\branchfactor*(-0.3,0) + (0,-0.4)$);% slip
+ }{%
+ \ifdefstring{\slip}{none}{%
+ %
+ }{%error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/slipturnout/slip}{“double“, “left“, “right“ OR “none“ as key required}}%
+ }%
+ }%
+ }%
+ }%
+ %
+ }},% end of pics/slipturnout/.style args={#1/#2/#3/#4}{
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol crossing - using parts of turnout
+%%%%%%%%%%%%%%%
+%
+\newcommand\crossing{}% just for safety
+\def\crossing[#1]#2(#3)#4(#5){% \crossing[options] at (coord) label (name);
+ \pic[#1] at (#3) {crossing={#2/#4/#5}}% symbol
+}%
+% symbol definition
+\tikzset{%
+ pics/crossing/.default=,%
+ pics/crossing/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% face setup
+ %% branch setup
+ \ifdefstring{\branch}{left}{% branch
+ \pgfmathsetmacro{\branchfactor}{1}%
+ }{%
+ \ifdefstring{\branch}{right}{% branch
+ \pgfmathsetmacro{\branchfactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}%
+ }%
+ }%
+ %
+ %% crossing marker
+ \path[draw=\foreground] (0,0) -- ++( 0.4,0) -- ++($\branchfactor*(0, 0.4)$) -- cycle;% turnout marker
+ \path[draw=\foreground] (0,0) -- ++(-0.4,0) -- ++($\branchfactor*(0,-0.4)$) -- cycle;% turnout marker
+ %
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={text=\foreground}};%
+ \coordinate (ts-x-l) at ($(2pt,0) + \branchfactor*(0,-9pt)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-x-l) at ($(ts-x-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[right] at (ts-x-l) {\footnotesize \labelcontent};%
+ }%
+ %
+ %% fouling point indicator
+ \iftoggle{fouling_point}{%
+ \path[draw=\foreground] ( 0.7,0) -- ++($\branchfactor*(0, 0.7)$);% fouling point indicator
+ \path[draw=\foreground] (-0.7,0) -- ++($\branchfactor*(0,-0.7)$);% fouling point indicator
+ }{}%
+ %
+ }},% end of pics/crossing/.style args={#1/#2/#3}{
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol derailer
+%%%%%%%%%%%%%%%
+%
+% command
+\newcommand\derailer{}% just for safety
+\def\derailer[#1]#2(#3)#4(#5){% \derailer[options] at (coord) label (name);
+ \pic[#1] at (#3) {derailer={#2/#4/#5}}% symbol
+}%
+% symbol definition
+\tikzset{%
+ pics/derailer/.default=,%
+ pics/derailer/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% branch setup
+ \ifdefstring{\branch}{left}{% branch
+ \ifdefstring{\face}{forward}{%
+ \pgfmathsetmacro{\branchfactor}{1}%
+ }{%
+ \pgfmathsetmacro{\branchfactor}{-1}%
+ }%
+ }{%
+ \ifdefstring{\branch}{right}{% branch
+ \ifdefstring{\face}{forward}{%
+ \pgfmathsetmacro{\branchfactor}{-1}%
+ }{%
+ \pgfmathsetmacro{\branchfactor}{1}%
+ }%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/topology/branch}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\branch}
+ %
+ %% symbol
+ \path[draw=\foreground, line width=1pt] (0,0.1) -- ++(0,-0.2);% derailer marker
+ \path[draw=\foreground,->,>=latex,line width=1pt,dashed] (0,0) -- ++($\facefactor*(0.4,0) + \branchfactor*(0,0.4)$);% derailer arrow
+ %
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={text=\foreground}};%
+ \coordinate (ts-dr-l) at ($\branchfactor*(0,-10pt)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-dr-l) at ($(ts-dr-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[right] at (ts-dr-l) {\footnotesize \labelcontent};%
+ }%
+ %
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.trafficcontrol.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.trafficcontrol.code.tex
new file mode 100644
index 00000000000..4d32c178aa6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.trafficcontrol.code.tex
@@ -0,0 +1,606 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.trafficcontrol.code.tex}%
+%
+%%%%%%%%%%%%%%%
+% Requirements
+%%%%%%%%%%%%%%%
+\RequirePackage{tikz,etoolbox,lmodern}%
+\usetikzlibrary{calc}%
+%
+% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz
+\providecommand{\gettikzxy}[3]{%
+ \tikz@scan@one@point\pgfutil@firstofone#1\relax%
+ \edef#2{\the\pgf@x}%
+ \edef#3{\the\pgf@y}%
+}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys for multiple use
+%%%%%%%%%%%%%%%
+\pgfkeys{%
+ /tikz/trackschematic/.is family,%
+ /tikz/trackschematic/.cd,%
+ %% color \foreground
+ foreground/.store in=\foreground,%
+ foreground=black,% DEFAULT
+ /tikz/foreground/.forward to=/tikz/trackschematic/foreground,%
+ %% color \background
+ background/.store in=\background,%
+ background=white,% DEFAULT
+ /tikz/background/.forward to=/tikz/trackschematic/background,%
+ %% face
+ face/.value required,% forward OR backward
+ face/.store in=\face,% forward OR backward
+ /tikz/face/.forward to=/tikz/trackschematic/face,%
+ /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
+ /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
+ /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
+ %% traffic practice
+ traffic practice/.value required,% left OR right
+ traffic practice/.store in=\trafficpractice,%
+ traffic practice=right,% DEFAULT
+ /tikz/traffic practice/.forward to=/tikz/trackschematic/traffic practice,%
+ /tikz/position/.forward to=/tikz/trackschematic/traffic practice,%
+ %% label
+ shift label/.store in=\labelcoord,% (coord)
+ shift label=(none),% DEFAULT
+ /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
+}%
+%
+\pgfkeys{%
+ /tikz/trackschematic/trafficcontrol/.is family,%
+ /tikz/trackschematic/trafficcontrol/.cd,%
+ %% type
+ type/.value required,% balise OR loop
+ type/.store in=\type,% balise OR loop
+ /tikz/type/.forward to=/tikz/trackschematic/trafficcontrol/type,%
+ %% block signal type
+ block type/.value forbidden,%
+ block type/.code={\settoggle{is_block_type}{true}},%
+ /tikz/block/.forward to=/tikz/trackschematic/trafficcontrol/block type,%
+ %% route signal type
+ route type/.value forbidden,%
+ route type/.code={\settoggle{is_route_type}{true}},%
+ /tikz/route/.forward to=/tikz/trackschematic/trafficcontrol/route type,%
+}%
+% options
+\newtoggle{is_block_type}\settoggle{is_block_type}{false}%
+\newtoggle{is_route_type}\settoggle{is_route_type}{false}%
+%%%%%%%%%%%%%%%
+% symbol signal
+%%%%%%%%%%%%%%%
+% command
+\newcommand\signal{}% just for safety
+\def\signal[#1]#2(#3)#4(#5){% \signal[options] at (coord) label (name);
+ \pic[#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\distantsignal{}% just for safety
+\def\distantsignal[#1]#2(#3)#4(#5){% \distantsignal[options] at (coord) label (name);
+ \pic[distant,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\speedsign{}% just for safety
+\def\speedsign[#1]#2(#3)#4(#5){% \speedsign[options] at (coord) label (name);
+ \pic[speed type,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\speedsignal{}% just for safety
+\def\speedsignal[#1]#2(#3)#4(#5){% \speedsignal[options] at (coord) label (name);
+ \pic[speed type,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\speeddistantsignal{}% just for safety
+\def\speeddistantsignal[#1]#2(#3)#4(#5){% \speedsignal[options] at (coord) label (name);
+ \pic[speed type,distant,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\blocksignal{}% just for safety
+\def\blocksignal[#1]#2(#3)#4(#5){% \blocksignal[options] at (coord) label (name);
+ \pic[block,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\routesignal{}% just for safety
+\def\routesignal[#1]#2(#3)#4(#5){% \routesignal[options] at (coord) label (name);
+ \pic[route,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\shuntsignal{}% just for safety
+\def\shuntsignal[#1]#2(#3)#4(#5){% \shuntsignal[options] at (coord) label (name);
+ \pic[shunting,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\shuntlimit{}% just for safety
+\def\shuntlimit[#1]#2(#3)#4(#5){% \shuntlimit[options] at (coord) label (name);
+ \pic[shunt limit,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\berthsignal{}% just for safety
+\def\berthsignal[#1]#2(#3)#4(#5){% \berthsignal[options] at (coord) label (name);
+ \pic[berth,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+\newcommand\berthsign{}% just for safety
+\def\berthsign[#1]#2(#3)#4(#5){% \berthsign[options] at (coord) label (name);
+ \pic[berth,#1] at (#3) {signal={#2/#4/#5}}% symbol
+}%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/trafficcontrol/signal/.is family,%
+ /tikz/trackschematic/trafficcontrol/signal/.cd,%
+ %% distant signal type
+ distant type/.value forbidden,%
+ distant type/.code={\settoggle{is_distant_type}{true}},%
+ /tikz/distant/.forward to=/tikz/trackschematic/trafficcontrol/signal/distant type,%
+ %% block signal type
+ speed type/.value forbidden,%
+ speed type/.code={\settoggle{is_speed_type}{true}},%
+ /tikz/speed type/.forward to=/tikz/trackschematic/trafficcontrol/signal/speed type,%
+ %% shunting signal type
+ shunting type/.value forbidden,%
+ shunting type/.code={\settoggle{is_shunting_type}{true}},%
+ /tikz/shunting/.forward to=/tikz/trackschematic/trafficcontrol/signal/shunting type,%
+ %% shunting signal type
+ shunt limit/.value forbidden,%
+ shunt limit/.code={\settoggle{is_shunt_limit}{true}},%
+ /tikz/shunt limit/.forward to=/tikz/trackschematic/trafficcontrol/signal/shunt limit,%
+ %% berth signal type
+ berth type/.value forbidden,%
+ berth type/.code={\settoggle{is_berth_type}{true}},%
+ /tikz/berth/.forward to=/tikz/trackschematic/trafficcontrol/signal/berth type,%
+ %% speed value
+ speed/.store in=\speed,% number
+ speed=,% number
+ /tikz/speed/.forward to=/tikz/trackschematic/trafficcontrol/signal/speed,%
+ %% speed value
+ distant speed/.store in=\distantspeed,% number
+ distant speed=,% number
+ /tikz/distant speed/.forward to=/tikz/trackschematic/trafficcontrol/signal/distant speed,%
+ %% locked signal
+ locked/.value forbidden,%
+ locked/.code={\settoggle{is_locked}{true}},%
+ /tikz/locked/.forward to=/tikz/trackschematic/trafficcontrol/signal/locked,%
+}%
+% options
+\newtoggle{is_distant_type}\settoggle{is_distant_type}{false}%
+\newtoggle{is_speed_type}\settoggle{is_speed_type}{false}%
+\newtoggle{is_shunting_type}\settoggle{is_shunting_type}{false}%
+\newtoggle{is_shunt_limit}\settoggle{is_shunt_limit}{false}%
+\newtoggle{is_berth_type}\settoggle{is_berth_type}{false}%
+\newtoggle{is_locked}\settoggle{is_locked}{false}%
+% symbol definition
+\tikzset{% generic symbol
+ pics/signal/.default=,%
+ pics/signal/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ \def\align{left}%
+ \def\rotate{-90}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ \def\align{right}%
+ \def\rotate{90}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ \tikzset{every path/.style={draw=\foreground,line width=1pt}};%
+ \tikzset{every node/.style={text=\foreground,inner sep=1pt}};%
+ %% signal pole
+ \path (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.4)$) -- ++($\facefactor*(0.7,0)$);% signal pole
+ %
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \coordinate (ts-s-l) at ($\trafficfactor*\facefactor*(0,-0.4)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-s-l) at ($(ts-s-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[\align] at (ts-s-l) {\footnotesize \labelcontent};%
+ }%
+ \tikzset{every path/.style={draw=\foreground,line width=1pt,fill=\background},rounded corners=0.1pt};%
+ %% signal marker
+ \iftoggle{is_distant_type}{% marker for distant signal
+ \path ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.35,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.35,0)$) --%
+ ++($\trafficfactor*\facefactor*(0, 0.4)$) -- cycle;% signal marker
+ %
+ }{}%
+ \iftoggle{is_speed_type}{% marker for speed signal
+ \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.35,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.4)$) --%
+ ++($\trafficfactor*\facefactor*(0, 0.2) + \facefactor*(0.35,0)$) -- cycle;% signal marker
+ %
+ }{}%
+ \iftoggle{is_block_type}{% marker for block signal
+ \path ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.7,0)$) rectangle%
+ ++($\trafficfactor*\facefactor*(0, 0.4) + \facefactor*(0.4,0)$);% signal marker
+ %
+ }{}%
+ \iftoggle{is_route_type}{% marker for route signal
+ \path ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.9,0)$) circle (0.2);% signal marker
+ %
+ }{}%
+ \iftoggle{is_shunting_type}{% marker for shunting signal
+ \path ($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*(0.6,0)$) circle (0.1);% signal marker
+ %
+ }{}%
+ \iftoggle{is_shunt_limit}{% marker for shunting signal
+ \tikzset{semicircle/.pic={\path (0,0) arc (180:0:0.1) -- cycle;};}%
+ \pgfmathsetmacro{\trafficfactorTEST}{-1}%
+ \ifdefequal{\trafficfactor}{\trafficfactorTEST}{%
+ \pgfmathsetmacro{\trafficfactorX}{-2}%
+ }{%
+ \pgfmathsetmacro{\trafficfactorX}{1}%
+ }%
+ \pic[rotate=\rotate] at ($\trafficfactorX*\facefactor*(0,-0.2) + \facefactor*(0.6,0)$) {semicircle}; % signal marker
+ %
+ }{}%
+ \iftoggle{is_berth_type}{% marker for berth signal
+ \path ($\trafficfactor*\facefactor*(0,-0.575) + \facefactor*(0.3,0)$) rectangle%
+ ++($\trafficfactor*\facefactor*(0, 0.35 ) + \facefactor*(0.5,0)$);% % signal marker
+ \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.3) + \facefactor*(0.375,0)$) -- ++($\facefactor*(0.35,0)$);%
+ \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*(0.55 ,0)$) -- ++($\trafficfactor*\facefactor*(0,0.2)$);%
+ \path[line width=0.75pt] ($\trafficfactor*\facefactor*(0,-0.5) + \facefactor*(0.375,0)$) -- ++($\facefactor*(0.35,0)$);%
+ %
+ }{}%
+ %% speed indicator
+ \ifdefstring{\speed}{}{}{% speed NOT empty
+ \tikzset{every node/.style={font=\sffamily,text=\foreground}};%
+ \iftoggle{is_speed_type}{% marker for speed signal
+ \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.85,0)$) {\speed};%
+ }{%
+ \iftoggle{is_shunting_type}{}{% is NOT shunting tyoe
+ \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(1.3,0)$) {\speed};%
+ }%
+ }%
+ }%
+ \ifdefstring{\distantspeed}{}{}{% distant speed NOT empty
+ \tikzset{every node/.style={font=\sffamily,text=\foreground,fill=\background,inner sep=0.5pt}};%
+ \node[rotate=\rotate] at ($\trafficfactor*\facefactor*(0,-0.4) + \facefactor*(0.2,0)$) {\distantspeed};%
+ }%
+ %% locked
+ \iftoggle{is_locked}{% marker for route signal
+ \iftoggle{is_block_type}{% marker for block signal
+ \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.9,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.4)$);% signal aspect
+ }{}%
+ \iftoggle{is_route_type}{% marker for route signal
+ \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.9,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.4)$);% signal aspect
+ }{}%
+ \iftoggle{is_shunting_type}{%
+ \path ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(0.6,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.2)$);% signal aspect
+ }{}%
+ }{}%
+ }},% end pics/signal/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol clearing point
+%%%%%%%%%%%%%%%
+% command
+\newcommand\clearingpoint{}% just for safety
+\def\clearingpoint[#1]#2(#3)#4(#5){% \clearingpoint[options] at (coord) label (name);
+ \pic[standard,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
+}%
+\newcommand\blockclearing{}% just for safety
+\def\blockclearing[#1]#2(#3)#4(#5){% \blockclearing[options] at (coord) label (name);
+ \pic[block,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
+}%
+\newcommand\routeclearing{}% just for safety
+\def\routeclearing[#1]#2(#3)#4(#5){% \routeclearing[options] at (coord) label (name);
+ \pic[route,#1] at (#3) {clearing_point={#2/#4/#5}}% symbol
+}%
+\pgfkeys{%
+ /tikz/trackschematic/trafficcontrol/clearing point/.is family,%
+ /tikz/trackschematic/trafficcontrol/clearing point/.cd,%
+ %% standard type
+ standard type/.value forbidden,%
+ standard type/.code={\settoggle{is_standard_type}{true}},%
+ /tikz/standard/.forward to=/tikz/trackschematic/trafficcontrol/clearing point/standard type,%
+}%
+% options
+\newtoggle{is_standard_type}\settoggle{is_standard_type}{false}%
+% symbol definition
+\tikzset{%
+ pics/clearing_point/.default=,%
+ pics/clearing_point/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% face setup
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% default case
+ \pgfmathsetmacro{\facefactor}{1}%
+ }% end \ifdefstring{\face}
+ \tikzset{every path/.style={draw=\foreground,line width=1pt}};%
+ %% marker
+ \path ($\trafficfactor*\facefactor*(0,-0.1)$) -- ++($\trafficfactor*\facefactor*(0,0.2)$);% marker
+ %% sign
+ \iftoggle{is_standard_type}{% marker for block signal
+ \path ($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*(0.1,0)$) -- ++($\facefactor*(-0.2,0)$);% sign
+ }{}%
+ \iftoggle{is_block_type}{% marker for block signal
+ \path ($\trafficfactor*\facefactor*(0,-0.1)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*(-0.1,0)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.1) + \facefactor*( 0.1,0)$) --%
+ ++($\trafficfactor*\facefactor*(0, 0.1) + \facefactor*( 0.1,0)$) -- cycle;% sign
+ }{}%
+ \iftoggle{is_route_type}{% marker for route signal
+ \path ($\trafficfactor*\facefactor*(0,-0.2)$) circle (0.1);% sign
+ }{}%
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={font=\sffamily,text=\foreground}};%
+ \coordinate (ts-cp-l) at ($\trafficfactor*\facefactor*(0,0.25)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-cp-l) at ($(ts-cp-l)+(\labelcoordX,\labelcoordY)$);%
+ }%
+ \node at (ts-cp-l) {\footnotesize \labelcontent};%
+ }%
+ }},% end pics/clearing_point/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol transmitter
+%%%%%%%%%%%%%%%
+% command
+\newcommand\transmitter{}% just for safety
+\def\transmitter[#1]#2(#3)#4(#5){% \transmitter[options] at (coord) label (name);
+ \pic[#1] at (#3) {transmitter={#2/#4/#5}}% symbol
+}%
+\newcommand\balise{}% just for safety
+\def\balise[#1]#2(#3)#4(#5){% \balise[options] at (coord) label (name);
+ \pic[type=balise,#1] at (#3) {transmitter={#2/#4/#5}}% symbol
+}%
+\newcommand\trackloop{}% just for safety
+\def\trackloop[#1]#2(#3)#4(#5){% \trackloop[options] at (coord) label (name);
+ \pic[type=loop,#1] at (#3) {transmitter={#2/#4/#5}}% symbol
+}%
+% symbol definition
+\tikzset{%
+ pics/transmitter/.default=,%
+ pics/transmitter/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% marker
+ \tikzset{every path/.style={draw=\foreground}};%
+ \ifdefstring{\type}{balise}{% type balise
+ \path[line width=1pt,fill=\background] ($(-0.25,0)$) rectangle%
+ ($\trafficfactor*(0,-0.25) + (0.25,0)$);% balise marker
+ \ifdefstring{\face}{forward}{% face
+ \path ($\trafficfactor*(0,-0.05) + (0.1,0)$) -- ($\trafficfactor*(0,-0.125) + (0.2,0)$) --%
+ ($\trafficfactor*(0,-0.2) + (0.1,0)$) -- cycle;% arrow forward
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \path ($\trafficfactor*(0,-0.05) + (-0.1,0)$) -- ($\trafficfactor*(0,-0.125) + (-0.2,0)$) --%
+ ($\trafficfactor*(0,-0.2) + (-0.1,0)$) -- cycle;% arrow backward
+ }{
+ \ifdefstring{\face}{bidirectional}{% face
+ \path ($\trafficfactor*(0,-0.05) + (0.1,0)$) -- ($\trafficfactor*(0,-0.125) + (0.2,0)$) --%
+ ($\trafficfactor*(0,-0.2) + (0.1,0)$) -- cycle;% arrow forward
+ \path ($\trafficfactor*(0,-0.05) + (-0.1,0)$) -- ($\trafficfactor*(0,-0.125) + (-0.2,0)$) --%
+ ($\trafficfactor*(0,-0.2) + (-0.1,0)$) -- cycle;% arrow backward
+ }{}%
+ }%
+ }% end \ifdefstring{\face}
+ }{%
+ \ifdefstring{\type}{loop}{% type loop
+ \path[line width=1pt] ($\trafficfactor*(0,-0.175)$) -- ++(-0.0625,-0.0625) -- ++(-0.2,0) -- ++(-0.125,0.125) -- ++(-0.1,0) -- ++(0,-0.125) -- ++(0.1,0) -- ++(0.125,0.125) -- ++(0.2,0) -- ++(0.125,-0.125) -- ++(0.2,0) -- ++(0.125,0.125) -- ++(0.1,0) -- ++(0,-0.125) -- ++(-0.1,0) -- ++(-0.125,0.125) -- ++(-0.2,0) -- cycle;% loop marker
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/transmitter/type}{“balise“ OR “loop“ as key required}}%
+ }%
+ }% end \ifdefstring{\type}
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={font=\sffamily,text=\foreground}};%
+ \coordinate (ts-tm-l) at ($\trafficfactor*(0,0.25)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-tm-l) at ($(ts-tm-l) + (\labelcoordX,\labelcoordY)$);%
+ }%
+ \node at (ts-tm-l) {\footnotesize \labelcontent};%
+ }%
+ }},% end pics/transmitter/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol view point
+%%%%%%%%%%%%%%%
+% command
+\newcommand\viewpoint{}% just for safety
+\def\viewpoint[#1]#2(#3){% \viewpoint[options] at (coord);
+ \pic[#1] at (#3) {view_point={#2}};% symbol
+}%
+% symbol definition
+\tikzset{%
+ pics/view_point/.default=,%
+ pics/view_point/.style args={#1}{code={%
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% arrow
+ \path[draw=\foreground,<-,>=latex,line width=1pt]%
+ ($\facefactor*\trafficfactor*(0,-0.1)$) -- ++($\facefactor*\trafficfactor*(0,-0.3)$) -- ++($\facefactor*(0.2,0)$);% arrow
+ %% eye
+ \filldraw[\foreground] ($\facefactor*(0.4,0) + \facefactor*\trafficfactor*(0,-0.4)$) circle (0.1);% pupil
+ \path[draw=\foreground, line width=1pt]% eye contour
+ ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.15)$) .. controls%
+ ($\facefactor*(0.25,0) + \facefactor*\trafficfactor*(0,-0.25)$) and%
+ ($\facefactor*(0.25,0) + \facefactor*\trafficfactor*(0,-0.55)$) ..%
+ ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.65)$) .. controls%
+ ($\facefactor*(0.55,0) + \facefactor*\trafficfactor*(0,-0.55)$) and%
+ ($\facefactor*(0.55,0) + \facefactor*\trafficfactor*(0,-0.25)$) ..%
+ ($\facefactor*(0.4, 0) + \facefactor*\trafficfactor*(0,-0.15)$) --cycle;% eye contour
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol end of authority marker
+%%%%%%%%%%%%%%%
+% command
+\newcommand\movementauthority{}% just for safety
+\def\movementauthority[#1]#2(#3)#4(#5){% \movementauthority[options] at (coord) label (name);
+ \pic[#1] at (#3) {movement_authority_marker={#2/#4/#5}}% symbol
+}%
+% tikz keys
+\pgfkeys{%
+ /tikz/trackschematic/trafficcontrol/EoA/.is family,%
+ /tikz/trackschematic/trafficcontrol/EoA/.cd,%
+ %% option \directionarrow
+ direction arrow/.store in=\directionarrow,% true or false
+ direction arrow=true,% true or false
+ /tikz/direction arrow/.forward to=/tikz/trackschematic/trafficcontrol/EoA/direction arrow,%
+}%
+% symbol definition
+\tikzset{%
+ pics/movement_authority_marker/.default=,%
+ pics/movement_authority_marker/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %
+ %% traffic practice setup
+ \ifdefstring{\trafficpractice}{left}{% branch
+ \pgfmathsetmacro{\trafficfactor}{-1}%
+ }{%
+ \ifdefstring{\trafficpractice}{right}{% branch
+ \pgfmathsetmacro{\trafficfactor}{1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/traffic practice}{“left“ OR “right“ as key required}}%
+ }%
+ }% end \ifdefstring{\trafficpractice}
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ \def\align{left}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ \def\align{right}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ \tikzset{every path/.style={draw=\foreground,line width=1pt}};%
+ %% marker
+ \path (0,0) -- ++($\trafficfactor*\facefactor*(0,-0.5)$);% marker
+ \path ($\trafficfactor*\facefactor*(0,-0.7) + \facefactor*(-0.1,0)$) rectangle%
+ ++($\trafficfactor*\facefactor*(0, 0.2) + \facefactor*(0.2,0)$);% sign
+ %% arrow
+ \ifdefstring{\directionarrow}{true}{%
+ \path[line width=0.5pt] ($\trafficfactor*\facefactor*(0,-0.2) + \facefactor*(-0.2,0)$) --%
+ ++($\facefactor*(0.2,0)$);% arrow body
+ \path[draw=none,fill=\foreground]% arrow tip
+ ($\trafficfactor*\facefactor*(0,-0.2)$) --%
+ ++($\trafficfactor*\facefactor*(0,-0.04) + \facefactor*(-0.1,0)$) -- ++($\trafficfactor*\facefactor*(0,0.08)$) -- cycle;%
+ }{% error message
+ \ifdefstring{\directionarrow}{false}{}{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/trafficcontrol/EoA/direction arrow}{'true' OR 'false' as key required}}%
+ }%
+ }%
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \tikzset{every node/.style={font=\sffamily,text=\foreground}};%
+ \coordinate (ts-ma-l) at ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(-0.05,0)$);%
+ \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-ma-l) at ($(ts-ma-l) + (\labelcoordX,\labelcoordY)$);%
+ }%
+ \node[\align] at (ts-ma-l) {\footnotesize \labelcontent};%
+ }%
+ }},% end pics/movement_authority_marker/.style args={#1/#2/#3}
+}%
+%
+%%%%%%%%%%%%%%%
+% symbol route
+%%%%%%%%%%%%%%%
+% command
+\newcommand\route{}% just for safety
+\def\route[#1]#2(#3){% \route[options] at (coord);
+ \pic[#1] at (#3) {route={#2}}% symbol
+}%
+% symbol definition
+\tikzset{%
+ pics/route/.default=,%
+ pics/route/.style args={#1}{code={%
+ %% settings
+ \def\coordcommand{#1} % beware of leading and tailing spaces!
+ %% face setup
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% symbol
+ \fill[\foreground] ($\facefactor*(-0.175,0)+(0,-0.15)$) --%
+ ($\facefactor*(-0.175,0)+(0, 0.15)$) --%
+ ($\facefactor*( 0.175,0)+(0, 0 )$) -- cycle;%
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.vehicles.code.tex b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.vehicles.code.tex
new file mode 100644
index 00000000000..8ba0aeaa1b0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-trackschematic/tikzlibrarytrackschematic.vehicles.code.tex
@@ -0,0 +1,457 @@
+%% symbol library for TikZ track schematics
+%
+% Copyright (c) 2018 - 2020, 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.
+%
+\ProvidesFileRCS{tikzlibrarytrackschematic.vehicles.code.tex}%
+%
+%%%%%%%%%%%%%%%
+% Requirements
+%%%%%%%%%%%%%%%
+\RequirePackage{tikz,etoolbox,lmodern}%
+\usetikzlibrary{calc}%
+%
+% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz
+\providecommand{\gettikzxy}[3]{%
+ \tikz@scan@one@point\pgfutil@firstofone#1\relax%
+ \edef#2{\the\pgf@x}%
+ \edef#3{\the\pgf@y}%
+}%
+%
+\ifdeflength{\objectlength}{}{% Not defined, so define it!
+ \newlength{\objectlength}%
+}%
+\setlength{\objectlength}{4cm}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys for multiple use
+%%%%%%%%%%%%%%%
+\pgfkeys{%
+ /tikz/trackschematic/.is family,%
+ /tikz/trackschematic/.cd,%
+ %% color foreground
+ foreground/.store in=\foreground,%
+ foreground=black,% DEFAULT
+ /tikz/foreground/.forward to=/tikz/trackschematic/foreground,%
+ %% color background
+ background/.store in=\background,%
+ background=white,% DEFAULT
+ /tikz/background/.forward to=/tikz/trackschematic/background,%
+ %% face
+ face/.value required,% forward OR backward
+ face/.store in=\face,%
+ /tikz/face/.forward to=/tikz/trackschematic/face,%
+ /tikz/forward/.code={\pgfkeys{/tikz/trackschematic/face=forward}},%
+ /tikz/backward/.code={\pgfkeys{/tikz/trackschematic/face=backward}},%
+ /tikz/bidirectional/.code={\pgfkeys{/tikz/trackschematic/face=bidirectional}},%
+ %% operation
+ operation mode/.store in=\operationmode,% manual, automatic OR undefined
+ operation mode=none,% DEFAULT
+ /tikz/operation/.forward to=/tikz/trackschematic/operation mode,%
+ %% length
+ length/.store in=\objectlength,% default length 4cm
+ /tikz/length/.forward to=/tikz/trackschematic/length,%
+ %% label
+ shift label/.store in=\labelcoord,% (coord)
+ shift label=(none),% DEFAULT
+ /tikz/shift label/.forward to=/tikz/trackschematic/shift label,%
+}%
+%
+%%%%%%%%%%%%%%%
+% commands
+%%%%%%%%%%%%%%%
+%
+%% command: parked vehicles
+\newcommand\parkedvehicles{}% just for safety
+\def\parkedvehicles[#1]#2(#3)#4(#5){% \parkedvehicles[options] at (coord) label (name);
+ \pic[parked,operation=undefined,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
+}%
+%% command: shunting movements
+\newcommand\shunting{}% just for safety
+\def\shunting[#1]#2(#3)#4(#5){% \shunting[options] at (coord) label (name);
+ \pic[shunting mode,operation=undefined,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
+}%
+%% command: train run
+\newcommand\train{}% just for safety
+\def\train[#1]#2(#3)#4(#5){% \train[options] at (coord) label (name);
+ \pic[train mode,operation=undefined,#1] at (#3) {vehicles={#2/#4/#5}}% symbol
+}%
+%
+%%%%%%%%%%%%%%%
+% tikz keys
+%%%%%%%%%%%%%%%
+\pgfkeys{%
+ /tikz/trackschematic/vehicles/.is family,%
+ /tikz/trackschematic/vehicles/.cd,%
+ %% parked vehicles
+ parked/.value forbidden,%
+ parked/.code={\settoggle{is_parked}{true}},%
+ /tikz/parked/.forward to=/tikz/trackschematic/vehicles/parked,%
+ %% shunting mode
+ shunting mode/.value forbidden,%
+ shunting mode/.code={\settoggle{in_shunting_mode}{true}},%
+ /tikz/shunting mode/.forward to=/tikz/trackschematic/vehicles/shunting mode,%
+ %% shunting movement
+ movement/.value forbidden,%
+ movement/.code={\settoggle{is_shunting}{true}},%
+ /tikz/movement/.forward to=/tikz/trackschematic/vehicles/movement,%
+ %% train mode
+ train mode/.value forbidden,%
+ train mode/.code={\settoggle{in_train_mode}{true}},%
+ /tikz/train mode/.forward to=/tikz/trackschematic/vehicles/train mode,%
+ %% ghost train
+ ghost train/.value forbidden,%
+ ghost train/.code={\settoggle{train_is_a_ghost}{true}},%
+ /tikz/ghost/.forward to=/tikz/trackschematic/vehicles/ghost train,%
+ %% train run
+ run/.store in=\trainrun,% slow, normal, fast OR none
+ run=none,% DEFAULT
+ /tikz/run/.forward to=/tikz/trackschematic/vehicles/run,%
+ %% label
+ label align/.store in=\labelalign,% (coord)
+ label align=center,% DEFAULT
+ /tikz/label align/.forward to=/tikz/trackschematic/vehicles/label align,%
+ %% train bend
+ bend right at/.store in=\bendrightcoord,% (coord)
+ bend right at=(none),% DEFAULT
+ /tikz/bend right at/.forward to=/tikz/trackschematic/vehicles/bend right at,%
+ bend left at/.store in=\bendleftcoord,% (coord)
+ bend left at=(none),% DEFAULT
+ /tikz/bend left at/.forward to=/tikz/trackschematic/vehicles/bend left at,%
+}%
+% options
+\newtoggle{is_parked}\settoggle{is_parked}{false}%
+\newtoggle{in_shunting_mode}\settoggle{in_shunting_mode}{false}%
+\newtoggle{is_shunting}\settoggle{is_shunting}{false}%
+\newtoggle{in_train_mode}\settoggle{in_train_mode}{false}%
+\newtoggle{train_is_a_ghost}\settoggle{train_is_a_ghost}{false}%
+\newtoggle{bend}\settoggle{bend}{false}%
+\newtoggle{double_bend}\settoggle{double_bend}{false}%
+%
+%%%%%%%%%%%%%%%
+% symbol definition
+%%%%%%%%%%%%%%%
+%
+\tikzset{%
+ pics/vehicles/.default=,%
+ pics/vehicles/.style args={#1/#2/#3}{code={%
+ %% settings
+ \def\coordcommand{#1}% beware of leading and tailing spaces!
+ \def\labelcommand{#2}% beware of leading and tailing spaces!
+ \def\labelcontent{#3}%
+ %% bend
+ % determine number of bends and
+ % find front and back bend from head to tail
+ \ifdefstring{\bendrightcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\bendrightcoord}{\bendrightX}{\bendrightY}%
+ \settoggle{bend}{true}%
+ \ifdefstring{\face}{forward}{%
+ \pgfmathsetlengthmacro\forwardbendX{\bendrightX}%
+ \pgfmathsetlengthmacro\forwardbendY{\bendrightY}%
+ \pgfmathsetlengthmacro\bendlength{\objectlength + \bendrightX}%
+ \pgfmathsetmacro\forwardbendTYPE{1}%
+ }{% face backward
+ \pgfmathsetlengthmacro\backwardbendX{\bendrightX}%
+ \pgfmathsetlengthmacro\backwardbendY{\bendrightY}%
+ \pgfmathsetlengthmacro\bendlength{\objectlength - \bendrightX}%
+ \pgfmathsetmacro\backwardbendTYPE{1}%
+ }% END \ifdefstring{\face}{forward}
+ }%
+ \ifdefstring{\bendleftcoord}{(none)}{}{% initialize if NOT default
+ \gettikzxy{\bendleftcoord}{\bendleftX}{\bendleftY}%
+ \iftoggle{bend}{%
+ \settoggle{double_bend}{true}%
+ \ifdefstring{\face}{forward}{%
+ \ifdimcomp{\bendrightX}{>}{\bendleftX}{%
+ \pgfmathsetlengthmacro\forwardbendX{\bendrightX}%
+ \pgfmathsetmacro\forwardbendTYPE{1}%
+ \pgfmathsetlengthmacro\backwardbendX{\bendleftX}%
+ \pgfmathsetlengthmacro\backwardbendY{\bendleftY}%
+ \pgfmathsetmacro\backwardbendTYPE{-1}%
+ }{% {\bendrightX}{<}{\bendleftX}
+ \pgfmathsetlengthmacro\forwardbendX{\bendleftX}%
+ \pgfmathsetmacro\forwardbendTYPE{-1}%
+ \pgfmathsetlengthmacro\backwardbendX{\bendrightX}%
+ \pgfmathsetlengthmacro\backwardbendY{\bendrightY}%
+ \pgfmathsetmacro\backwardbendTYPE{1}
+ }%
+ }{% face backward
+ \ifdimcomp{\bendrightX}{<}{\bendleftX}{%
+ \pgfmathsetlengthmacro\backwardbendX{\bendrightX}%
+ \pgfmathsetmacro\backwardbendTYPE{-1}%
+ \pgfmathsetlengthmacro\forwardbendX{\bendleftX}%
+ \pgfmathsetlengthmacro\forwardbendY{\bendleftY}%
+ \pgfmathsetmacro\forwardbendTYPE{1}%
+ }{% {\bendrightX}{>}{\bendleftX}
+ \pgfmathsetlengthmacro\backwardbendX{\bendleftX}%
+ \pgfmathsetmacro\backwardbendTYPE{1}%
+ \pgfmathsetlengthmacro\forwardbendX{\bendrightX}%
+ \pgfmathsetlengthmacro\forwardbendY{\bendrightY}%
+ \pgfmathsetmacro\forwardbendTYPE{-1}%
+ }%
+ }%
+ }{% NOT double bend
+ \settoggle{bend}{true}%
+ \ifdefstring{\face}{forward}{%
+ \pgfmathsetlengthmacro\forwardbendX{\bendleftX}%
+ \pgfmathsetlengthmacro\forwardbendY{\bendleftY}%
+ \pgfmathsetlengthmacro\bendlength{\objectlength + \bendleftX}%
+ \pgfmathsetmacro\forwardbendTYPE{-1}%
+ }{% face backward
+ \pgfmathsetlengthmacro\backwardbendX{\bendleftX}%
+ \pgfmathsetlengthmacro\backwardbendY{\bendleftY}%
+ \pgfmathsetlengthmacro\bendlength{\objectlength - \bendleftX}%
+ \pgfmathsetmacro\backwardbendTYPE{-1}%
+ }% END \ifdefstring{\face}{forward}
+ }%
+ }%
+ %%
+ %% calculation of vehicle coordinates
+ %%
+ %% backward bend forward bend
+ %% (ts-b-b1) (ts-b-f1)
+ %% (ts-v-4)•_______•_______•_______•(ts-v-1)
+ %% / \
+ %% backward (ts-v-r)• label•(ts-v-l) •(ts-v-f) forward
+ %% \_______ _______ _______/
+ %% (ts-v-3)• • • •(ts-v-2)
+ %% (ts-b-b2) (ts-b-f2)
+ %%
+ \iftoggle{is_parked}{% vehicle parked
+ \coordinate (ts-v-1) at ($ 0.5*(\objectlength,0) + (0, 0.3)$);%
+ \coordinate (ts-v-2) at ($ 0.5*(\objectlength,0) + (0,-0.3)$);%
+ \coordinate (ts-v-3) at ($-0.5*(\objectlength,0) + (0,-0.3)$);%
+ \coordinate (ts-v-4) at ($-0.5*(\objectlength,0) + (0, 0.3)$);%
+ \coordinate (ts-v-f) at ($ 0.5*(\objectlength,0) + (0, 0 )$);%
+ \coordinate (ts-v-r) at ($-0.5*(\objectlength,0) + (0, 0 )$);%
+ \iftoggle{bend}{% currently not supported for parked vehicles
+ % \coordinate (ts-b-f1) at (ts-v-1);%
+ % \coordinate (ts-b-f2) at (ts-v-2);%
+ % \coordinate (ts-b-b1) at (ts-v-4);%
+ % \coordinate (ts-b-b2) at (ts-v-3);%
+ }{% NOT bend
+ \coordinate (ts-b-f1) at (ts-v-1);%
+ \coordinate (ts-b-f2) at (ts-v-2);%
+ \coordinate (ts-b-b1) at (ts-v-4);%
+ \coordinate (ts-b-b2) at (ts-v-3);%
+ }%
+ \ifdefstring{\labelcoord}{(none)}{%
+ \coordinate (ts-v-l) at (0,0);%
+ }{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-v-l) at (\labelcoordX,\labelcoordY);%
+ }%
+ }{% vehicle NOT parked
+ \ifdefstring{\face}{forward}{% face
+ \pgfmathsetmacro{\facefactor}{1}%
+ \coordinate (ts-v-1) at (-0.3, 0.3);%
+ \coordinate (ts-v-2) at (-0.3,-0.3);%
+ \coordinate (ts-v-f) at (0,0);%
+ \iftoggle{double_bend}{%
+ \coordinate (ts-v-3) at ($(-\objectlength,-0.3) + (0,\backwardbendY)$);%
+ \coordinate (ts-v-4) at ($(-\objectlength, 0.3) + (0,\backwardbendY)$);%
+ \coordinate (ts-v-r) at ($(-\objectlength, 0 ) + (0,\backwardbendY)$);%
+ \coordinate (ts-b-f1) at ($( \forwardbendX, 0.3) + \forwardbendTYPE*(-0.1,0)$);%
+ \coordinate (ts-b-f2) at ($( \forwardbendX,-0.3) + \forwardbendTYPE*( 0.1,0)$);%
+ \coordinate (ts-b-b1) at ($(\backwardbendX, 0.3) + \backwardbendTYPE*( 0.1,0) + (0,\backwardbendY)$);%
+ \coordinate (ts-b-b2) at ($(\backwardbendX,-0.3) + \backwardbendTYPE*(-0.1,0) + (0,\backwardbendY)$);%
+ }{% NOT double bend
+ \iftoggle{bend}{%
+ \coordinate (ts-b-f1) at ($( \forwardbendX, 0.3) + \forwardbendTYPE*(-0.1,0)$);%
+ \coordinate (ts-b-f2) at ($( \forwardbendX,-0.3) + \forwardbendTYPE*( 0.1,0)$);%
+ \coordinate (ts-b-b1) at (ts-b-f1);%
+ \coordinate (ts-b-b2) at (ts-b-f2);%
+ \coordinate (ts-v-3) at ($(-\objectlength,-0.2) + \forwardbendTYPE*(0,-\bendlength) + \forwardbendTYPE*( 0.2,0)$);%
+ \coordinate (ts-v-4) at ($(-\objectlength, 0.2) + \forwardbendTYPE*(0,-\bendlength) + \forwardbendTYPE*(-0.2,0)$);%
+ \coordinate (ts-v-r) at ($(-\objectlength, 0 ) + \forwardbendTYPE*(0,-\bendlength)$);%
+ }{% NOT bend
+ \coordinate (ts-b-f1) at (ts-v-1);%
+ \coordinate (ts-b-f2) at (ts-v-2);%
+ \coordinate (ts-v-3) at ($(-\objectlength,0) + (0,-0.3)$);%
+ \coordinate (ts-v-4) at ($(-\objectlength,0) + (0, 0.3)$);%
+ \coordinate (ts-b-b1) at (ts-v-4);%
+ \coordinate (ts-b-b2) at (ts-v-3);%
+ \coordinate (ts-v-r) at ($(-\objectlength,0)$);%
+ }%
+ }%
+ }{%
+ \ifdefstring{\face}{backward}{% face
+ \pgfmathsetmacro{\facefactor}{-1}%
+ \coordinate (ts-v-3) at (0.3,-0.3);%
+ \coordinate (ts-v-4) at (0.3, 0.3);%
+ \coordinate (ts-v-r) at (0,0);%
+ \iftoggle{double_bend}{%
+ \coordinate (ts-v-1) at ($( \objectlength, 0.3) + (0,\forwardbendY)$);%
+ \coordinate (ts-v-2) at ($( \objectlength,-0.3) + (0,\forwardbendY)$);%
+ \coordinate (ts-v-f) at ($( \objectlength, 0 ) + (0,\forwardbendY)$);%
+ \coordinate (ts-b-f1) at ($( \forwardbendX, 0.3) + \forwardbendTYPE*( 0.1,0) + (0,\forwardbendY)$);%
+ \coordinate (ts-b-f2) at ($( \forwardbendX,-0.3) + \forwardbendTYPE*(-0.1,0) + (0,\forwardbendY)$);%
+ \coordinate (ts-b-b1) at ($(\backwardbendX, 0.3) + \backwardbendTYPE*(-0.1,0)$);%
+ \coordinate (ts-b-b2) at ($(\backwardbendX,-0.3) + \backwardbendTYPE*( 0.1,0)$);%
+ }{% NOT double bend
+ \iftoggle{bend}{%
+ \coordinate (ts-b-b1) at ($( \backwardbendX, 0.3) + \backwardbendTYPE*( 0.1,0)$);%
+ \coordinate (ts-b-b2) at ($( \backwardbendX,-0.3) + \backwardbendTYPE*(-0.1,0)$);%
+ \coordinate (ts-b-f1) at (ts-b-b1);%
+ \coordinate (ts-b-f2) at (ts-b-b2);%
+ \coordinate (ts-v-1) at ($( \objectlength, 0.2) + \backwardbendTYPE*(0,-\bendlength) + \backwardbendTYPE*( 0.2,0)$);%
+ \coordinate (ts-v-2) at ($( \objectlength,-0.2) + \backwardbendTYPE*(0,-\bendlength) + \backwardbendTYPE*(-0.2,0)$);%
+ \coordinate (ts-v-f) at ($( \objectlength, 0 ) + \backwardbendTYPE*(0,-\bendlength)$);%
+ }{% NOT bend
+ \coordinate (ts-b-b1) at (ts-v-4);%
+ \coordinate (ts-b-b2) at (ts-v-3);%
+ \coordinate (ts-v-1) at ($(\objectlength,0) + (0, 0.3)$);%
+ \coordinate (ts-v-2) at ($(\objectlength,0) + (0,-0.3)$);%
+ \coordinate (ts-b-f1) at (ts-v-1);%
+ \coordinate (ts-b-f2) at (ts-v-2);%
+ \coordinate (ts-v-f) at ($(\objectlength,0)$);%
+ }%
+ }%
+ }{% error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/face}{“forward“ OR “backward“ as key required}}%
+ }%
+ }% end \ifdefstring{\face}
+ %% label coord for NOT parked
+ \ifdefstring{\labelcoord}{(none)}{%
+ \coordinate (ts-v-l) at ($\facefactor*-0.5*(\objectlength,0) + (0,0)$);%
+ }{% initialize if NOT default
+ \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}%
+ \coordinate (ts-v-l) at (\labelcoordX,\labelcoordY);%
+ }%
+ }%
+ %
+ %% vehicle style
+ \iftoggle{in_train_mode}{% train mode
+ \iftoggle{train_is_a_ghost}{% ghost train
+ \tikzset{every path/.style={draw=\foreground, line width=0.8pt, dashed}};%
+ \coordinate (ts-v-l) at ($(ts-v-l) + (0,0.16)$);%
+ }{% normal train
+ \tikzset{every path/.style={draw=\foreground, line width=1pt, fill=\background}};%
+ }%
+ }{% shunting mode
+ \tikzset{every path/.style={draw=\foreground, double, double distance=0.5mm, line width=0.3pt, fill=\background}};%
+ }%
+ %
+ %% arrow shapes
+ \iftoggle{is_shunting}{% arrow for shunting
+ \iftoggle{in_shunting_mode}{% shunting mode
+ \fill[draw=none,fill=\background] ($\facefactor*(-0.3, 0.3)$) --%
+ ($\facefactor*(-0.1, 0.3)$) --%
+ ($\facefactor*( 0.2, 0 )$) --%
+ ($\facefactor*(-0.1,-0.3)$) --%
+ ($\facefactor*(-0.3,-0.3)$) -- cycle;% \background fill
+ \path[line cap=rect,fill=none] ($\facefactor*(-0.1, 0.3)$) --%
+ ($\facefactor*( 0.2, 0 )$) --%
+ ($\facefactor*(-0.1,-0.3)$);% arrow shape
+ }{% train mode
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicle/movement}{movement can only be combined with shunting}}%
+ }%
+ }{}% end \iftoggle{shunting_movement}
+ \ifdefstring{\trainrun}{none}{}{% arrow for train
+ \iftoggle{in_train_mode}{% train mode
+ \ifdefstring{\trainrun}{slow}{%
+ \fill[draw=none,fill=\background] ($\facefactor*(-0.3, 0.3)$) --%
+ ($\facefactor*(-0.1, 0.3)$) --%
+ ($\facefactor*( 0.2, 0 )$) --%
+ ($\facefactor*(-0.1,-0.3)$) --%
+ ($\facefactor*(-0.3,-0.3)$) -- cycle;% \background fill
+ \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
+ ($\facefactor*(-0.1 , 0.3)$) --%
+ ($\facefactor*( 0.2 , 0 )$) --%
+ ($\facefactor*(-0.1 ,-0.3)$) --%
+ ($\facefactor*(-0.15,-0.3)$);% arrow shape
+ }{%
+ \ifdefstring{\trainrun}{normal}{%
+ \fill[draw=none,fill=\background] ($\facefactor*(-0.3, 0.3)$) --%
+ ($\facefactor*( 0.1, 0.3)$) --%
+ ($\facefactor*( 0.4, 0 )$) --%
+ ($\facefactor*( 0.1,-0.3)$) --%
+ ($\facefactor*(-0.3,-0.3)$) -- cycle;% \background fill
+ \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
+ ($\facefactor*(-0.1 , 0.3)$) --%
+ ($\facefactor*( 0.2 , 0 )$) --%
+ ($\facefactor*(-0.1 ,-0.3)$) --%
+ ($\facefactor*(-0.15,-0.3)$);% arrow shape part 1
+ \path[fill=none] ($\facefactor*( 0.05, 0.3)$) --%
+ ($\facefactor*( 0.1 , 0.3)$) --%
+ ($\facefactor*( 0.4 , 0 )$) --%
+ ($\facefactor*( 0.1 ,-0.3)$) --%
+ ($\facefactor*( 0.05,-0.3)$);% arrow shape part 2
+ %
+ }{%
+ \ifdefstring{\trainrun}{fast}{%
+ \fill[draw=none,fill=\background] ($\facefactor*(-0.3, 0.3)$) --%
+ ($\facefactor*( 0.3, 0.3)$) --%
+ ($\facefactor*( 0.6, 0 )$) --%
+ ($\facefactor*( 0.3,-0.3)$) --%
+ ($\facefactor*(-0.3,-0.3)$) -- cycle;% \background fill
+ \path[fill=none] ($\facefactor*(-0.15, 0.3)$) --%
+ ($\facefactor*(-0.1 , 0.3)$) --%
+ ($\facefactor*( 0.2 , 0 )$) --%
+ ($\facefactor*(-0.1 ,-0.3)$) --%
+ ($\facefactor*(-0.15,-0.3)$);% arrow shape part 1
+ \path[fill=none] ($\facefactor*( 0.05, 0.3)$) --%
+ ($\facefactor*( 0.1 , 0.3)$) --%
+ ($\facefactor*( 0.4 , 0 )$) --%
+ ($\facefactor*( 0.1 ,-0.3)$) --%
+ ($\facefactor*( 0.05,-0.3)$);% arrow shape part 2
+ \path[fill=none] ($\facefactor*( 0.25, 0.3)$) --%
+ ($\facefactor*( 0.3 , 0.3)$) --%
+ ($\facefactor*( 0.6 , 0 )$) --%
+ ($\facefactor*( 0.3 ,-0.3)$) --%
+ ($\facefactor*( 0.25,-0.3)$);% arrow shape part 3
+ %
+ }{%error message
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicles/run}{“normal“, “slow“, “fast“ OR “none“ as key required}}%
+ }%
+ }%
+ }%
+ }{% shunting mode
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/vehicle/run}{run can only be combined with train}}%
+ }% end \iftoggle{in_train_mode}
+ }% end \ifdefstring{\trainrun}{none} % end arrow shapes
+ %
+ %% vehicle shape
+ \path (ts-v-1) -- (ts-v-f) -- (ts-v-2) -- (ts-b-f2) -- (ts-b-b2) -- (ts-v-3) -- (ts-v-r) -- (ts-v-4) -- (ts-b-b1) -- (ts-b-f1) -- cycle;% vehicle shape
+ %
+ %% operated
+ \iftoggle{is_parked}{}{% vehicle NOT parked
+ \ifdefstring{\operationmode}{manual}{%
+ \path[draw=none, fill=\foreground] ($\facefactor*(-0.4,0)$) circle (0.15);% dot
+ \coordinate (ts-v-l) at ($(ts-v-l) + \facefactor*(-0.25,0)$);%
+ }{
+ \ifdefstring{\operationmode}{automatic}{%
+ \path[draw=none, fill=\foreground] ($\facefactor*(-0.15,0)$) -- ++($\facefactor*(-0.15,0) +(0,0.15)$) -- ++(0,-0.3) -- cycle;% triangle
+ \coordinate (ts-v-l) at ($(ts-v-l) + \facefactor*(-0.15,0)$);%
+ }{%
+ \ifdefstring{\operationmode}{undefined}{}{%
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/operation}{“manual“, “automatic“ OR “undefined“ as key required}}%
+ }%
+ }% end automatically_operated
+ }% end manually_operated
+ }%
+ %
+ %% label
+ \ifdefstring{\labelcontent}{}{}{% label NOT empty
+ \ifdefstring{\labelalign}{center}{% label align default
+ \def\labelanchor{center}
+ }{% label align NOT default
+ \ifdefstring{\labelalign}{left}{% label align left
+ \def\labelanchor{east}
+ }{%
+ \ifdefstring{\labelalign}{right}{% label align left
+ \def\labelanchor{west}
+ }{% NOT center, left, or right
+ \pgfkeys{/errors/unknown choice value={/tikz/trackschematic/label align}{“center“, “left“ OR “right“ as key required}}%
+ }% \ifdefstring{\labelalign}{right}
+ }% \ifdefstring{\labelalign}{left}
+ }% \ifdefstring{\labelalign}{center}
+ \node[text=\foreground,anchor=\labelanchor,align=\labelalign] at (ts-v-l) {\footnotesize\emph{\labelcontent}};% label
+ }%
+ }},%
+}%
+%
+%%%%%%%%%%%%%%%
+\endinput%
+% \ No newline at end of file