diff --git a/CHANGELOG.md b/CHANGELOG.md index b299a3e..ebef98f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Categories: Added, Changed, Deprecated, Removed, Fixed, and Security. ### Changed * transmitters for balises + * replaced "\gettikzxy" with "\path let" syntax ### Fixed diff --git a/README.md b/README.md index 8dc4023..3bd9497 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,6 @@ Please consult the [symbology table](https://github.com/railtoolkit/tikz-tracksc * rethink syntax * provide option for internationalziation (i18n) - * replace "\gettikzxy" with "\path let" syntax * rewrite library with better coding skills * include support for glossaries package diff --git a/src/tikzlibrarytrackschematic.code.tex b/src/tikzlibrarytrackschematic.code.tex index d7b2a63..4086959 100644 --- a/src/tikzlibrarytrackschematic.code.tex +++ b/src/tikzlibrarytrackschematic.code.tex @@ -45,8 +45,7 @@ % \ifdefstring{\labelcontent}{}{}{% label NOT empty % \coordinate (label-coord) at (coord);% % \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default -% \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% -% \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% +% \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% % }% % \node at (label-coord) {\footnotesize \labelcontent};% % }% diff --git a/src/tikzlibrarytrackschematic.constructions.code.tex b/src/tikzlibrarytrackschematic.constructions.code.tex index 8f6cc0b..c054206 100644 --- a/src/tikzlibrarytrackschematic.constructions.code.tex +++ b/src/tikzlibrarytrackschematic.constructions.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) diff --git a/src/tikzlibrarytrackschematic.electrics.code.tex b/src/tikzlibrarytrackschematic.electrics.code.tex index 8269bea..d5565c5 100644 --- a/src/tikzlibrarytrackschematic.electrics.code.tex +++ b/src/tikzlibrarytrackschematic.electrics.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) @@ -15,13 +12,6 @@ \RequirePackage{tikz,etoolbox}% \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 %%%%%%%%%%%%%%% @@ -126,8 +116,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -201,8 +190,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -277,8 +265,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -352,8 +339,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -428,8 +414,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -504,8 +489,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% @@ -588,8 +572,7 @@ \ifdefstring{\labelcontent}{}{}{% label NOT empty \coordinate (label-coord) at ($\trafficfactor*\facefactor*(0,-0.4)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (label-coord) at ($(label-coord)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (label-coord) at ($(label-coord)+(\x1,\y1)$);% }% \node[\align] at (label-coord) {\footnotesize \labelcontent};% }% diff --git a/src/tikzlibrarytrackschematic.measures.code.tex b/src/tikzlibrarytrackschematic.measures.code.tex index c551ed0..4a80d5e 100644 --- a/src/tikzlibrarytrackschematic.measures.code.tex +++ b/src/tikzlibrarytrackschematic.measures.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) @@ -15,13 +12,6 @@ \RequirePackage{tikz,etoolbox}% \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 %%%%%%%%%%%%%%% @@ -210,10 +200,6 @@ \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}% @@ -230,14 +216,14 @@ %% (0,0.75) (ts-hm-b1) (ts-hm-b2) %% (0,0)• • ------- • --------- • ----- •(ts-hm-l) label %% - \coordinate (ts-hm-l) at (0,\basecoordY);% + \path let \p1=\basecoord in coordinate (ts-hm-l) at (0,\y1);% \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)$);% + \path let \p1=\labelcoord in coordinate (ts-hm-b2) at ($(ts-hm-l) + (\x1,0.25)$);% + \path let \p1=\labelcoord in coordinate (ts-hm-l) at ($(ts-hm-l) + (\x1,\y1)$);% }% %% symbol \path[draw=\hectometercolor,dashed,shorten <=0.75cm]% diff --git a/src/tikzlibrarytrackschematic.symbology.code.tex b/src/tikzlibrarytrackschematic.symbology.code.tex index fa25062..fa180a2 100644 --- a/src/tikzlibrarytrackschematic.symbology.code.tex +++ b/src/tikzlibrarytrackschematic.symbology.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) diff --git a/src/tikzlibrarytrackschematic.topology.code.tex b/src/tikzlibrarytrackschematic.topology.code.tex index 441964f..79085e3 100644 --- a/src/tikzlibrarytrackschematic.topology.code.tex +++ b/src/tikzlibrarytrackschematic.topology.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) @@ -15,13 +12,6 @@ \RequirePackage{tikz,etoolbox}% \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 %%%%%%%%%%%%%%% @@ -123,8 +113,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-tl-l) at ($(ts-tl-l)+(\x1,\y1)$);% }% \node at (ts-tl-l) {\labelcontent};% }% @@ -301,8 +290,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-y-l) at ($(ts-y-l)+(\x1,\y1)$);% }% \node at (ts-y-l) {\footnotesize \labelcontent};% }% @@ -524,16 +512,14 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-sy-l1) at ($(ts-sy-l1)+(\x1,\y1)$);% }% \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)$);% + \path let \p1=\labelcoord in coordinate (ts-sy-l2) at ($(ts-sy-l2)+(\x1,\y1)$);% }% \node[right] at (ts-sy-l2) {\footnotesize \labelcontentright};% }% @@ -585,8 +571,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-x-l) at ($(ts-x-l)+(\x1,\y1)$);% }% \node[right] at (ts-x-l) {\footnotesize \labelcontent};% }% @@ -662,8 +647,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-dr-l) at ($(ts-dr-l)+(\x1,\y1)$);% }% \node[right] at (ts-dr-l) {\footnotesize \labelcontent};% }% diff --git a/src/tikzlibrarytrackschematic.trafficcontrol.code.tex b/src/tikzlibrarytrackschematic.trafficcontrol.code.tex index 97978f5..b6b9225 100644 --- a/src/tikzlibrarytrackschematic.trafficcontrol.code.tex +++ b/src/tikzlibrarytrackschematic.trafficcontrol.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) @@ -15,13 +12,6 @@ \RequirePackage{tikz,etoolbox}% \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 %%%%%%%%%%%%%%% @@ -208,8 +198,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-s-l) at ($(ts-s-l)+(\x1,\y1)$);% }% \node[\align] at (ts-s-l) {\footnotesize \labelcontent};% }% @@ -414,8 +403,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-cp-l) at ($(ts-cp-l)+(\x1,\y1)$);% }% \node at (ts-cp-l) {\footnotesize \labelcontent};% }% @@ -504,8 +492,7 @@ \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)$);% + \path let \p1=\labelcoord in coordinate (ts-tm-l) at ($(ts-tm-l)+(\x1,\y1)$);% }% \node at (ts-tm-l) {\footnotesize \labelcontent};% }% @@ -636,8 +623,7 @@ \tikzset{every node/.style={font=\sffamily,text=\foreground}};% \coordinate (ts-ma-l) at ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.3,0)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (ts-ma-l) at ($(ts-ma-l) + (\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (ts-ma-l) at ($(ts-ma-l)+(\x1,\y1)$);% }% \node[\align] at (ts-ma-l) {\footnotesize \labelcontent};% }% @@ -701,8 +687,7 @@ \tikzset{every node/.style={font=\sffamily,text=\foreground}};% \coordinate (ts-bp-l) at ($\trafficfactor*\facefactor*(0,-0.6) + \facefactor*(0.3,0)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (ts-bp-l) at ($(ts-bp-l) + (\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (ts-bp-l) at ($(ts-bp-l)+(\x1,\y1)$);% }% \node[\align] at (ts-bp-l) {\footnotesize \labelcontent};% }% @@ -767,8 +752,7 @@ \tikzset{every node/.style={font=\sffamily,text=\foreground}};% \coordinate (ts-dp-l) at ($\trafficfactor*\facefactor*(0,0.25)$);% \ifdefstring{\labelcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\labelcoord}{\labelcoordX}{\labelcoordY}% - \coordinate (ts-dp-l) at ($(ts-dp-l)+(\labelcoordX,\labelcoordY)$);% + \path let \p1=\labelcoord in coordinate (ts-dp-l) at ($(ts-dp-l)+(\x1,\y1)$);% }% \node at (ts-dp-l) {\footnotesize \labelcontent};% }% diff --git a/src/tikzlibrarytrackschematic.vehicles.code.tex b/src/tikzlibrarytrackschematic.vehicles.code.tex index 4699971..de613d3 100644 --- a/src/tikzlibrarytrackschematic.vehicles.code.tex +++ b/src/tikzlibrarytrackschematic.vehicles.code.tex @@ -1,6 +1,3 @@ -%!TEX TS-program = pdflatexmk -%!TEX root = ../test/test.tex -% %% symbol library for TikZ track schematics % % Copyright (c) 2018 - 2022, Martin Scheidt (ISC license) @@ -15,13 +12,6 @@ \RequirePackage{tikz,etoolbox}% \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}% }% @@ -68,7 +58,7 @@ %% 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 + \pic[parked,operation=undefined,forward,#1] at (#3) {vehicles={#2/#4/#5}}% symbol }% %% command: shunting movements \newcommand\shunting{}% just for safety @@ -112,7 +102,7 @@ run=none,% DEFAULT /tikz/run/.forward to=/tikz/trackschematic/vehicles/run,% %% label - label align/.store in=\labelalign,% (coord) + label align/.store in=\labelalign,% left, right OR center label align=center,% DEFAULT /tikz/label align/.forward to=/tikz/trackschematic/vehicles/label align,% %% train bend @@ -129,7 +119,7 @@ \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{single_bend}\settoggle{single_bend}{false}% \newtoggle{double_bend}\settoggle{double_bend}{false}% % %%%%%%%%%%%%%%% @@ -139,211 +129,169 @@ \tikzset{% pics/vehicles/.default=,% pics/vehicles/.style args={#1/#2/#3}{code={% - %% settings + %% + %%%%%%%[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 \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} + %% 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}% }% - \ifdefstring{\bendleftcoord}{(none)}{}{% initialize if NOT default - \gettikzxy{\bendleftcoord}{\bendleftX}{\bendleftY}% - \iftoggle{bend}{% + \ifdefstring{\bendrightcoord}{(none)}{}{% NOT default + \iftoggle{single_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} + \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}% }% - }{% 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}% + }{% {\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}% }% }% }{% 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} + \settoggle{single_bend}{true}% + \path \bendrightcoord;\pgfgetlastxy{\bendX}{\bendY}% absolut coord + \pgfmathsetmacro\bendfactor{-1}% }% }% - %% - %% 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)$);% + %%%%%%%%%%%%%%%%%%%% + %% 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}{% \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);% - }% + }{% + \coordinate (ts-v-f) at (0,0);% }% + %% 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);% % - %% vehicle style + \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-r1) + (-\bendlength,0) + \facefactor*\bendfactor*( 0.1,\bendlength) + (0,-0.1)$);% + \coordinate (ts-v-r2) at ($(ts-b-r2) + (-\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-r1) + (-\bendlength,0) + \facefactor*\rearBendfactor*(-0.1,0)$);% + \coordinate (ts-v-r2) at ($(ts-b-r2) + (-\bendlength,0) + \facefactor*\rearBendfactor*( 0.1,0)$);% + }{}% + %% + %%%%%%%%%%%%%%%%%%%% + %% 2. 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 + %% + %%%%%%%%%%%%%%%%%%%% + %% 3. arrow shapes + %% (order before vehicle shape due to background fill!) \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 + ($\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 @@ -351,14 +299,14 @@ \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 + \ifdefstring{\trainrun}{none}{}{% DEFAULT no 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 + ($\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 )$) --% @@ -367,10 +315,10 @@ }{% \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 + ($\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 )$) --% @@ -385,10 +333,10 @@ }{% \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 + ($\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 )$) --% @@ -414,11 +362,16 @@ \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 + %% + %%%%%%%%%%%%%%%%%%%% + %% 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 \iftoggle{is_parked}{}{% vehicle NOT parked \ifdefstring{\operationmode}{manual}{% \path[draw=none, fill=\foreground] ($\facefactor*(-0.4,0)$) circle (0.15);% dot @@ -434,10 +387,22 @@ }% end automatically_operated }% end manually_operated }% - % - %% label + %% + %%%%%%%%%%%%%%%%%%%% + %% 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 \p1=\labelcoord in coordinate (ts-v-l) at ($(ts-v-l)+(\x1,\y1)$);% + }% \ifdefstring{\labelcontent}{}{}{% label NOT empty - \ifdefstring{\labelalign}{center}{% label align default + \ifdefstring{\labelalign}{center}{% DEFAULT label align center \def\labelanchor{center} }{% label align NOT default \ifdefstring{\labelalign}{left}{% label align left @@ -450,9 +415,10 @@ }% \ifdefstring{\labelalign}{right} }% \ifdefstring{\labelalign}{left} }% \ifdefstring{\labelalign}{center} - \node[text=\foreground,anchor=\labelanchor,align=\labelalign] at (ts-v-l) {\footnotesize\emph{\labelcontent}};% label + \node[text=\foreground,anchor=\labelanchor,align=\labelalign] at (ts-v-l) {\footnotesize \labelcontent};% label }% }},% END pics/vehicles/.style args={#1/#2/#3} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % symbology entry symbology_parked_vehicles/.pic = {% \secondarytrack (0,0) -- (6,0);% diff --git a/test/bend_vehicles_expected.pdf b/test/bend_vehicles_expected.pdf deleted file mode 100644 index 8f18ee2..0000000 Binary files a/test/bend_vehicles_expected.pdf and /dev/null differ diff --git a/test/measure.tex b/test/measure.tex index 252cb3b..c0a363c 100644 --- a/test/measure.tex +++ b/test/measure.tex @@ -26,12 +26,12 @@ \coordinate (X\i-4) at ($(7,0) + 2*(0,-\i)$); } - \trackdistance between (3,-1) and (X1-2) label (4,50); - \trackdistance between (X1-2) and (X2-3) label (6,50~m); - \trackdistance between (X1-4) and (X2-4) label (5,50); + \trackdistance between (3,-1) and (X1-2) label (4.50); + \trackdistance between (X1-2) and (X2-3) label (6.50~m); + \trackdistance between (X1-4) and (X2-4) label (5.50); \tikzset{hectometer base={(A3)},orientation=right}; - \hectometer[] at (X2-1) mileage (6,505~km); + \hectometer[] at (X2-1) mileage (6.505~km); \hectometer[shift label={(0.3,-1)}] at (X2-2) mileage (name); % \measureline between (a) and (b); diff --git a/test/measure_expected.pdf b/test/measure_expected.pdf index 226c636..df4df27 100644 Binary files a/test/measure_expected.pdf and b/test/measure_expected.pdf differ diff --git a/test/bend_vehicles.tex b/test/vehicles_bend.tex similarity index 78% rename from test/bend_vehicles.tex rename to test/vehicles_bend.tex index ef3177f..aa5953d 100644 --- a/test/bend_vehicles.tex +++ b/test/vehicles_bend.tex @@ -33,28 +33,28 @@ \train[forward, length=5cm, bend right at={(T1-6)}, bend left at={(T2-7)}, - shift label={(T1-6)}, label align=left] at (T2-8) label (T2 T2 T1 bend); + shift label={(T1-6)}, label align=right] at (T2-8) label (T2 T2 T1 bend); \train[forward, length=5cm, bend left at={(T4-6)},bend right at={(T3-7)}, - shift label={(T4-6)}, label align=left] at (T3-8) label (T3 T3 T4 bend); + shift label={(T4-6)}, label align=right] at (T3-8) label (T3 T3 T4 bend); \train[backward, length=5cm, bend right at={(T1-1)}, bend left at={(T2-2)}, - shift label={(T2-2)}, label align=right] at (T1-0) label (T1 T1 T2 bend); + shift label={(T2-2)}, label align=left] at (T1-0) label (T1 T1 T2 bend); \train[backward, length=5cm, bend left at={(T4-1)},bend right at={(T3-2)}, - shift label={(T3-2)}, label align=right] at (T4-0) label (T4 T3 T3 bend); + shift label={(T3-2)}, label align=left] at (T4-0) label (T4 T3 T3 bend); \train[backward, length=2cm, bend left at={(T6-1)}, shift label={(T6-1)}, label align=left] at (T6-0) label (A6 T6 bend); \train[forward, length=2cm, bend right at={(T5-3)}, - shift label={(T5-2)}, label align=right] at (T5-4) label (T5 T5 bend); + shift label={(T5-3)}, label align=right] at (T5-4) label (T5 T5 bend); \train[backward, length=2cm, bend right at={(T5-5)}, - shift label={(T5-6)}, label align=left] at (T5-4) label (T5 T5 bend); + shift label={(T5-5)}, label align=left] at (T5-4) label (T5 T5 bend); \train[forward, length=2cm, bend left at={(T6-7)}, - shift label={(T6-7)}, label align=left] at (T6-8) label (B6 T6 bend); + shift label={(T6-7)}, label align=right] at (T6-8) label (B6 T6 bend); \end{tikzpicture} \end{document} \ No newline at end of file diff --git a/test/vehicles_bend_expected.pdf b/test/vehicles_bend_expected.pdf new file mode 100644 index 0000000..a442df5 Binary files /dev/null and b/test/vehicles_bend_expected.pdf differ diff --git a/test/shunting.tex b/test/vehicles_shunting.tex similarity index 90% rename from test/shunting.tex rename to test/vehicles_shunting.tex index e8abac5..8d508d7 100644 --- a/test/shunting.tex +++ b/test/vehicles_shunting.tex @@ -25,9 +25,9 @@ \coordinate (T\i-3) at ($(7,0) + 2*(0,-\i)$); } - \parkedvehicles[length=0.5cm] at (T1-1) label (T1-1); - \parkedvehicles[] at (T1-2) label (T1-2); - \parkedvehicles[length=1.5cm] at (T1-3) label (T1-3); + \parkedvehicles[length=0.5cm] at (T1-1) label (T1-1); + \parkedvehicles[shift label={(0,-0.5)}] at (T1-2) label (T1-2); + \parkedvehicles[length=1.5cm] at (T1-3) label (T1-3); \shunting[forward] at (T2-2) label (T2-2); \shunting[forward ,length=2.5cm] at (T2-3) label (T2-3); diff --git a/test/shunting_expected.pdf b/test/vehicles_shunting_expected.pdf similarity index 76% rename from test/shunting_expected.pdf rename to test/vehicles_shunting_expected.pdf index 766d3c9..4838251 100644 Binary files a/test/shunting_expected.pdf and b/test/vehicles_shunting_expected.pdf differ diff --git a/test/train.tex b/test/vehicles_train.tex similarity index 100% rename from test/train.tex rename to test/vehicles_train.tex diff --git a/test/train_expected.pdf b/test/vehicles_train_expected.pdf similarity index 100% rename from test/train_expected.pdf rename to test/vehicles_train_expected.pdf