2018-09-14 21:04:15 +02:00
%% symbol library for TikZ track schematics
%
2022-01-06 20:17:51 +01:00
% Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
2019-07-21 19:28:30 +02:00
%
2018-09-14 21:04:15 +02:00
% 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.
2020-01-14 17:11:10 +01:00
%
\ProvidesFileRCS { tikzlibrarytrackschematic.vehicles.code.tex} %
%
%%%%%%%%%%%%%%%
% Requirements
%%%%%%%%%%%%%%%
2021-09-30 12:37:31 +02:00
\RequirePackage { tikz,etoolbox} %
2020-01-14 17:11:10 +01:00
\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,%
%% 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);
2022-02-21 16:50:57 +01:00
\pic [parked,operation=undefined,forward,#1] at (#3) { vehicles={ #2/#4/#5} } % symbol
2020-01-14 17:11:10 +01:00
} %
%% 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
2022-02-21 16:50:57 +01:00
label align/.store in=\labelalign ,% left, right OR center
2020-01-14 17:11:10 +01:00
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} %
2022-02-21 16:50:57 +01:00
\newtoggle { single_ bend} \settoggle { single_ bend} { false} %
2020-01-14 17:11:10 +01:00
\newtoggle { double_ bend} \settoggle { double_ bend} { false} %
%
%%%%%%%%%%%%%%%
% symbol definition
%%%%%%%%%%%%%%%
%
\tikzset { %
pics/vehicles/.default=,%
pics/vehicles/.style args={ #1/#2/#3} { code={ %
2022-02-21 16:50:57 +01:00
%%
%%%%%%%[steps]%%%%%%
%%
%% 0. setup settings
%% 1. calculate coordinates
%% - calculation of vehicle coordinates:
%%
%% rear bend front bend
%% (ts-b-r1) (ts-b-f1)
%% (ts-v-r1)•__________•_______•__________•(ts-v-f1)
%% | \
%% | label•(ts-v-l) •(ts-v-f) front tip
%% |__________ _______ __________ /
%% (ts-v-r2)• • • •(ts-v-f2)
%% (ts-b-r2) (ts-b-f2)
%%
%% - the base coord is depend on usage
%% for parked: (ts-v-l)
%% else: (ts-v-f)
%%
%% 2. set style for line and background
%% 3. draw arrows for speed indication
%% 4. draw vehicle shape
%% 5. draw operation mode
%% 6. draw label
%%
%%%%%%%%%%%%%%%%%%%%
%% 0. settings
2020-01-14 17:11:10 +01:00
\def \coordcommand { #1} % beware of leading and tailing spaces!
\def \labelcommand { #2} % beware of leading and tailing spaces!
\def \labelcontent { #3} %
2022-02-21 16:50:57 +01:00
%% 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}
%% bend setup
% determine number of bends and find front and rear bend from left to right
\ifdefstring { \bendleftcoord } { (none)} { } { % NOT default
\settoggle { single_ bend} { true} %
\path \bendleftcoord ;\pgfgetlastxy { \bendX } { \bendY } % absolut coord
\pgfmathsetmacro \bendfactor { 1} %
2020-01-14 17:11:10 +01:00
} %
2022-02-21 16:50:57 +01:00
\ifdefstring { \bendrightcoord } { (none)} { } { % NOT default
\iftoggle { single_ bend} { %
2020-01-14 17:11:10 +01:00
\settoggle { double_ bend} { true} %
2022-02-21 16:50:57 +01:00
\settoggle { single_ bend} { false} %
\path \bendrightcoord ;\pgfgetlastxy { \bendrightX } { \bendrightY }
\ifdimcomp { \bendrightX } { >} { \bendX } { % which one comes first?
\ifdefstring { \face } { forward} { %
\pgfmathsetmacro \frontBendfactor { 1} %
\pgfmathsetmacro \rearBendfactor { -1} %
\pgfmathsetlengthmacro \frontBendX { \bendrightX } %
\pgfmathsetlengthmacro \rearBendX { \bendX } %
\pgfmathsetlengthmacro \rearBendY { \bendY } %
} { % face backward
\pgfmathsetmacro \frontBendfactor { -1} %
\pgfmathsetmacro \rearBendfactor { 1} %
\pgfmathsetlengthmacro \frontBendX { \bendX } %
\pgfmathsetlengthmacro \rearBendX { \bendrightX } %
\pgfmathsetlengthmacro \rearBendY { \bendrightY } %
2020-01-14 17:11:10 +01:00
} %
2022-02-21 16:50:57 +01:00
} { % {\bendrightX}{<}{\bendleftX}%
\ifdefstring { \face } { forward} { %
\pgfmathsetmacro \frontBendfactor { -1} %
\pgfmathsetmacro \rearBendfactor { 1} %
\pgfmathsetlengthmacro \frontBendX { \bendX } %
\pgfmathsetlengthmacro \rearBendX { \bendrightX } %
\pgfmathsetlengthmacro \rearBendY { \bendrightY } %
} { % face backward
\pgfmathsetmacro \frontBendfactor { 1} %
\pgfmathsetmacro \rearBendfactor { -1} %
\pgfmathsetlengthmacro \frontBendX { \bendrightX } %
\pgfmathsetlengthmacro \rearBendX { \bendX } %
\pgfmathsetlengthmacro \rearBendY { \bendY } %
2020-01-14 17:11:10 +01:00
} %
} %
} { % NOT double bend
2022-02-21 16:50:57 +01:00
\settoggle { single_ bend} { true} %
\path \bendrightcoord ;\pgfgetlastxy { \bendX } { \bendY } % absolut coord
\pgfmathsetmacro \bendfactor { -1} %
2020-01-14 17:11:10 +01:00
} %
} %
2022-02-21 16:50:57 +01:00
%%%%%%%%%%%%%%%%%%%%
%% 1. coordinate calculations
%% basic coords for corners
\iftoggle { is_ parked} { %
\coordinate (ts-v-f1) at ($ 0 . 5 * ( \objectlength , 0 ) + ( 0 , 0 . 3 ) $ );%
\coordinate (ts-v-f2) at ($ 0 . 5 * ( \objectlength , 0 ) + ( 0 , - 0 . 3 ) $ );%
\coordinate (ts-v-r1) at ($ - 0 . 5 * ( \objectlength , 0 ) + ( 0 , 0 . 3 ) $ );%
\coordinate (ts-v-r2) at ($ - 0 . 5 * ( \objectlength , 0 ) + ( 0 , - 0 . 3 ) $ );%
} { %
\coordinate (ts-v-f1) at ($ \facefactor * ( - 0 . 3 , 0 ) + ( 0 , 0 . 3 ) $ );%
\coordinate (ts-v-f2) at ($ \facefactor * ( - 0 . 3 , 0 ) + ( 0 , - 0 . 3 ) $ );%
\coordinate (ts-v-r1) at ($ \facefactor * ( - \objectlength , 0 ) + ( 0 , 0 . 3 ) $ );%
\coordinate (ts-v-r2) at ($ \facefactor * ( - \objectlength , 0 ) + ( 0 , - 0 . 3 ) $ );%
} %
%% front tip for traveling direction
\iftoggle { is_ parked} { %
2020-01-14 17:11:10 +01:00
\coordinate (ts-v-f) at ($ 0 . 5 * ( \objectlength , 0 ) + ( 0 , 0 ) $ );%
2022-02-21 16:50:57 +01:00
} { %
\coordinate (ts-v-f) at (0,0);%
2020-01-14 17:11:10 +01:00
} %
2022-02-21 16:50:57 +01:00
%% bend - DEFAULT: no bend
\coordinate (ts-b-f1) at (ts-v-f1);%
\coordinate (ts-b-f2) at (ts-v-f2);%
\coordinate (ts-b-r1) at (ts-v-r1);%
\coordinate (ts-b-r2) at (ts-v-r2);%
2020-01-14 17:11:10 +01:00
%
2022-02-21 16:50:57 +01:00
\iftoggle { single_ bend} { %
% \bendX is a absolut coordinate
% make them relative to base
\path (0,0);\pgfgetlastxy { \baseX } { \baseY } % absolut coord
% calc bend position
\coordinate (ts-b-r1) at ($ ( - \baseX , 0 ) + ( \bendX , 0 . 3 ) + \facefactor * \bendfactor * ( 0 . 1 , 0 ) $ );%
\coordinate (ts-b-r2) at ($ ( - \baseX , 0 ) + ( \bendX , - 0 . 3 ) + \facefactor * \bendfactor * ( - 0 . 1 , 0 ) $ );%
% calc length from bend to end with factor ~0.7071 at 45 degree to a projected length
\pgfmathsetlengthmacro \bendlength { (\facefactor * \objectlength - \baseX + \bendX )*0.7071} %
\coordinate (ts-v-r1) at ($ ( ts - b - r 1 ) + ( - \bendlength , 0 ) + \facefactor * \bendfactor * ( 0 . 1 , \bendlength ) + ( 0 , - 0 . 1 ) $ );%
\coordinate (ts-v-r2) at ($ ( ts - b - r 2 ) + ( - \bendlength , 0 ) + \facefactor * \bendfactor * ( - 0 . 1 , \bendlength ) + ( 0 , 0 . 1 ) $ );%
} { } %
\iftoggle { double_ bend} { %
% \bendX and \bendY are absolut coords
% make them relative to base
\path (0,0);\pgfgetlastxy { \baseX } { \baseY } % absolut coord
% calc bend position
\coordinate (ts-b-f1) at ($ ( - \baseX , 0 ) + ( \frontBendX , 0 . 3 ) + \facefactor * \frontBendfactor * ( - 0 . 1 , 0 ) $ );%
\coordinate (ts-b-f2) at ($ ( - \baseX , 0 ) + ( \frontBendX , - 0 . 3 ) + \facefactor * \frontBendfactor * ( 0 . 1 , 0 ) $ );%
\coordinate (ts-b-r1) at ($ ( - \baseX , 0 ) + ( \rearBendX , 0 . 3 ) + ( 0 , - \baseY ) + ( 0 , \rearBendY ) + \facefactor * \rearBendfactor * ( 0 . 1 , 0 ) $ );%
\coordinate (ts-b-r2) at ($ ( - \baseX , 0 ) + ( \rearBendX , - 0 . 3 ) + ( 0 , - \baseY ) + ( 0 , \rearBendY ) + \facefactor * \rearBendfactor * ( - 0 . 1 , 0 ) $ );%
% calc length from bend to end with factor ~1.4142 at 45 degree to a projected length
\pgfmathsetlengthmacro \bendlength { \facefactor * \objectlength - (\frontBendX - \rearBendX )*1.4142 - (\baseX - \frontBendX )} %
\coordinate (ts-v-r1) at ($ ( ts - b - r 1 ) + ( - \bendlength , 0 ) + \facefactor * \rearBendfactor * ( - 0 . 1 , 0 ) $ );%
\coordinate (ts-v-r2) at ($ ( ts - b - r 2 ) + ( - \bendlength , 0 ) + \facefactor * \rearBendfactor * ( 0 . 1 , 0 ) $ );%
} { } %
%%
%%%%%%%%%%%%%%%%%%%%
%% 2. vehicle style
2020-01-14 17:11:10 +01:00
\iftoggle { in_ train_ mode} { % train mode
\iftoggle { train_ is_ a_ ghost} { % ghost train
\tikzset { every path/.style={ draw=\foreground , line width=0.8pt, dashed} } ;%
} { % 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 } } ;%
} %
2022-02-21 16:50:57 +01:00
%%
%%%%%%%%%%%%%%%%%%%%
%% 3. arrow shapes
%% (order before vehicle shape due to background fill!)
2020-01-14 17:11:10 +01:00
\iftoggle { is_ shunting} { % arrow for shunting
\iftoggle { in_ shunting_ mode} { % shunting mode
\fill [draw=none,fill=\background] ($ \facefactor * ( - 0 . 3 , 0 . 3 ) $ ) --%
2022-02-21 16:50:57 +01:00
($ \facefactor * ( - 0 . 1 , 0 . 3 ) $ ) --%
($ \facefactor * ( 0 . 2 , 0 ) $ ) --%
($ \facefactor * ( - 0 . 1 , - 0 . 3 ) $ ) --%
($ \facefactor * ( - 0 . 3 , - 0 . 3 ) $ ) -- cycle;% \background fill
2020-01-14 17:11:10 +01:00
\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}
2022-02-21 16:50:57 +01:00
\ifdefstring { \trainrun } { none} { } { % DEFAULT no arrow for train
2020-01-14 17:11:10 +01:00
\iftoggle { in_ train_ mode} { % train mode
\ifdefstring { \trainrun } { slow} { %
\fill [draw=none,fill=\background] ($ \facefactor * ( - 0 . 3 , 0 . 3 ) $ ) --%
2022-02-21 16:50:57 +01:00
($ \facefactor * ( - 0 . 1 , 0 . 3 ) $ ) --%
($ \facefactor * ( 0 . 2 , 0 ) $ ) --%
($ \facefactor * ( - 0 . 1 , - 0 . 3 ) $ ) --%
($ \facefactor * ( - 0 . 3 , - 0 . 3 ) $ ) -- cycle;% \background fill
2020-01-14 17:11:10 +01:00
\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 ) $ ) --%
2022-02-21 16:50:57 +01:00
($ \facefactor * ( 0 . 1 , 0 . 3 ) $ ) --%
($ \facefactor * ( 0 . 4 , 0 ) $ ) --%
($ \facefactor * ( 0 . 1 , - 0 . 3 ) $ ) --%
($ \facefactor * ( - 0 . 3 , - 0 . 3 ) $ ) -- cycle;% \background fill
2020-01-14 17:11:10 +01:00
\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 ) $ ) --%
2022-02-21 16:50:57 +01:00
($ \facefactor * ( 0 . 3 , 0 . 3 ) $ ) --%
($ \facefactor * ( 0 . 6 , 0 ) $ ) --%
($ \facefactor * ( 0 . 3 , - 0 . 3 ) $ ) --%
($ \facefactor * ( - 0 . 3 , - 0 . 3 ) $ ) -- cycle;% \background fill
2020-01-14 17:11:10 +01:00
\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
2022-02-21 16:50:57 +01:00
%%
%%%%%%%%%%%%%%%%%%%%
%% 4. vehicle shape
\path (ts-v-f)%
-- (ts-v-f1) -- (ts-b-f1) -- (ts-b-r1) -- (ts-v-r1)%
-- (ts-v-r2) -- (ts-b-r2) -- (ts-b-f2) -- (ts-v-f2)%
-- cycle;% vehicle shape
%%
%%%%%%%%%%%%%%%%%%%%
%% 5. operation mode
2020-01-14 17:11:10 +01:00
\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
} %
2022-02-21 16:50:57 +01:00
%%
%%%%%%%%%%%%%%%%%%%%
%% 6. label
\iftoggle { is_ parked} { %
\coordinate (ts-v-l) at (0,0);% DEFAULT center
} { %
\coordinate (ts-v-l) at ($ \facefactor * - 0 . 5 * ( \objectlength , 0 ) $ );% DEFAULT center
} %
\iftoggle { train_ is_ a_ ghost} { % ghost train
\coordinate (ts-v-l) at ($ ( ts - v - l ) + ( 0 , 0 . 16 ) $ );%
} { } %
\ifdefstring { \labelcoord } { (none)} { } { % initialize if NOT default
\path let \p 1=\labelcoord in coordinate (ts-v-l) at ($ ( ts - v - l ) + ( \x 1 , \y 1 ) $ );%
} %
2020-01-14 17:11:10 +01:00
\ifdefstring { \labelcontent } { } { } { % label NOT empty
2022-02-21 16:50:57 +01:00
\ifdefstring { \labelalign } { center} { % DEFAULT label align center
2020-01-14 17:11:10 +01:00
\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}
2022-02-21 16:50:57 +01:00
\node [text=\foreground,anchor=\labelanchor,align=\labelalign] at (ts-v-l) { \footnotesize \labelcontent } ;% label
2020-01-14 17:11:10 +01:00
} %
2021-01-02 14:04:05 +01:00
} } ,% END pics/vehicles/.style args={#1/#2/#3}
2022-02-21 16:50:57 +01:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2021-01-02 14:04:05 +01:00
% symbology entry
symbology_ parked_ vehicles/.pic = { %
\secondarytrack (0,0) -- (6,0);%
\parkedvehicles [] at (3,0) label ();%
} ,%
% symbology entry
symbology_ train_ shunt_ mode/.pic = { %
\maintrack (0,0) -- (6,0);%
\shunting [forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ shunting/.pic = { %
\maintrack (0,0) -- (6,0);%
\shunting [movement,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ moving_ slow/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [run=slow,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ moving/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [run=normal,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ moving_ fast/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [run=fast,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ ghost/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [ghost,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ drive_ automatic/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [operation=automatic,forward] at (5,0) label ();%
} ,%
% symbology entry
symbology_ train_ drive_ human/.pic = { %
\maintrack (0,0) -- (6,0);%
\train [operation=manual,forward] at (5,0) label ();%
} ,%
2020-01-14 17:11:10 +01:00
} %
%
%%%%%%%%%%%%%%%
\endinput %
%