2021-01-02 14:04:05 +01:00
%!TEX TS-program = pdflatexmk
%!TEX root = ../test/test.tex
%
2018-09-14 21:04:15 +02:00
%% symbol library for TikZ track schematics
%
2021-01-02 14:04:05 +01:00
% Copyright (c) 2018 - 2021, 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} %
%
% 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
} %
2021-01-02 14:04:05 +01:00
} } ,% END pics/vehicles/.style args={#1/#2/#3}
% 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 %
%